From f33d0b1153a01d4097432004dd9372663fdb97a0 Mon Sep 17 00:00:00 2001 From: Alexandre Galdeano Date: Sat, 18 Jan 2025 12:09:06 +0100 Subject: [PATCH] [MIG] stock_storage_type: Migration to 17.0 --- stock_storage_type/__manifest__.py | 2 +- stock_storage_type/i18n/de.po | 2 +- stock_storage_type/i18n/es.po | 2 +- stock_storage_type/i18n/es_AR.po | 2 +- stock_storage_type/i18n/fr.po | 2 +- stock_storage_type/i18n/it.po | 2 +- .../i18n/stock_storage_type.pot | 2 +- .../migrations/16.0.1.0.1/post-migrate.py | 104 ------------ .../migrations/16.0.1.0.1/pre-migrate.py | 159 ------------------ stock_storage_type/models/stock_location.py | 33 ++-- stock_storage_type/models/stock_quant.py | 3 +- .../models/stock_storage_location_sequence.py | 6 +- .../stock_storage_location_sequence_cond.py | 20 +-- stock_storage_type/tests/common.py | 4 +- .../tests/test_auto_assign_storage_type.py | 4 +- stock_storage_type/tests/test_storage_type.py | 3 +- .../tests/test_storage_type_move.py | 26 +-- .../test_storage_type_putaway_strategy.py | 24 +-- test-requirements.txt | 3 + 19 files changed, 72 insertions(+), 331 deletions(-) delete mode 100644 stock_storage_type/migrations/16.0.1.0.1/post-migrate.py delete mode 100644 stock_storage_type/migrations/16.0.1.0.1/pre-migrate.py create mode 100644 test-requirements.txt diff --git a/stock_storage_type/__manifest__.py b/stock_storage_type/__manifest__.py index 48b4a0e18a..fadeaca9e1 100644 --- a/stock_storage_type/__manifest__.py +++ b/stock_storage_type/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Storage Type", "summary": "Manage packages and locations storage types", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "development_status": "Beta", "category": "Warehouse Management", "website": "https://github.com/OCA/wms", diff --git a/stock_storage_type/i18n/de.po b/stock_storage_type/i18n/de.po index 476a9c34aa..5f7dd2f193 100644 --- a/stock_storage_type/i18n/de.po +++ b/stock_storage_type/i18n/de.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" diff --git a/stock_storage_type/i18n/es.po b/stock_storage_type/i18n/es.po index 3b36874fcc..0e38b9430e 100644 --- a/stock_storage_type/i18n/es.po +++ b/stock_storage_type/i18n/es.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2023-09-07 18:37+0000\n" "Last-Translator: Ivorra78 \n" diff --git a/stock_storage_type/i18n/es_AR.po b/stock_storage_type/i18n/es_AR.po index 2b2617198f..86e7a3453f 100644 --- a/stock_storage_type/i18n/es_AR.po +++ b/stock_storage_type/i18n/es_AR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2022-06-29 20:05+0000\n" "Last-Translator: Ignacio Buioli \n" diff --git a/stock_storage_type/i18n/fr.po b/stock_storage_type/i18n/fr.po index d254068244..137d6f2041 100644 --- a/stock_storage_type/i18n/fr.po +++ b/stock_storage_type/i18n/fr.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" diff --git a/stock_storage_type/i18n/it.po b/stock_storage_type/i18n/it.po index 40c7092404..cca6dc46ee 100644 --- a/stock_storage_type/i18n/it.po +++ b/stock_storage_type/i18n/it.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2024-06-07 12:35+0000\n" "Last-Translator: mymage \n" diff --git a/stock_storage_type/i18n/stock_storage_type.pot b/stock_storage_type/i18n/stock_storage_type.pot index 33290bbb28..0ef912e690 100644 --- a/stock_storage_type/i18n/stock_storage_type.pot +++ b/stock_storage_type/i18n/stock_storage_type.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/stock_storage_type/migrations/16.0.1.0.1/post-migrate.py b/stock_storage_type/migrations/16.0.1.0.1/post-migrate.py deleted file mode 100644 index 532acba534..0000000000 --- a/stock_storage_type/migrations/16.0.1.0.1/post-migrate.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright 2022 ACSONE SA -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) - -from openupgradelib import openupgrade - - -def _move_product_package_type(env): - """ - stock.package.storage.type has been merged with product.package.type - which is in core now. - """ - # Update fields values - query = """ - UPDATE stock_package_type - SET height_required = ( - SELECT height_required FROM stock_package_storage_type - WHERE id = old_storage_type_id) - """ - openupgrade.logged_query(env.cr, query) - # Update ids on product template - query = """ - UPDATE product_template - SET package_type_id = ( - SELECT id FROM stock_package_type - WHERE old_storage_type_id = product_package_storage_type_id - ) - WHERE product_package_storage_type_id IS NOT NULL - """ - openupgrade.logged_query(env.cr, query) - # Update ids on product packaging - query = """ - UPDATE product_packaging - SET package_type_id = ( - SELECT id FROM stock_package_type - WHERE old_storage_type_id = package_storage_type_id - ) - WHERE package_storage_type_id IS NOT NULL - """ - openupgrade.logged_query(env.cr, query) - - -def _move_location_storage_type(env): - """ - Update location storage type values => capacities - """ - # Update fields values - query = """ - UPDATE stock_storage_category_capacity sscc - SET allow_new_product = ( - SELECT - (CASE - WHEN do_not_mix_lots = true THEN 'same_lot' - WHEN do_not_mix_products = true - AND do_not_mix_lots = false THEN 'same' - WHEN only_empty = True THEN 'empty' - ELSE 'mixed' - END) - FROM stock_location_storage_type - WHERE id = old_location_storage_type_id) - FROM stock_location_storage_type slst - WHERE slst.id = sscc.old_location_storage_type_id - """ - openupgrade.logged_query(env.cr, query) - - -def _update_location_sequence(env): - query = """ - UPDATE stock_storage_location_sequence ssls - SET package_type_id = spt.id - FROM stock_package_type spt - WHERE spt.old_storage_type_id = ssls.package_storage_type_id - """ - openupgrade.logged_query(env.cr, query) - - -def _update_quant_package(env): - query = """ - UPDATE stock_quant_package sqp - SET package_type_id = spt.id - FROM stock_package_type spt - WHERE spt.old_storage_type_id = sqp.package_storage_type_id - """ - openupgrade.logged_query(env.cr, query) - - -def _update_product_template(env): - query = """ - ALTER TABLE product_template - DROP CONSTRAINT product_template_product_package_storage_type_id_fkey; - UPDATE product_template pt - SET product_package_storage_type_id = spt.id - FROM stock_package_type spt - WHERE spt.old_storage_type_id = pt.product_package_storage_type_id; - """ - openupgrade.logged_query(env.cr, query) - - -@openupgrade.migrate() -def migrate(env, version): - _move_product_package_type(env) - _move_location_storage_type(env) - _update_location_sequence(env) - _update_quant_package(env) - _update_product_template(env) diff --git a/stock_storage_type/migrations/16.0.1.0.1/pre-migrate.py b/stock_storage_type/migrations/16.0.1.0.1/pre-migrate.py deleted file mode 100644 index 230572b90c..0000000000 --- a/stock_storage_type/migrations/16.0.1.0.1/pre-migrate.py +++ /dev/null @@ -1,159 +0,0 @@ -# Copyright 2022 ACSONE SA -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) - -from openupgradelib import openupgrade - - -def _move_product_package_type(env): - """ - stock.package.storage.type has been merged with product.package.type - which is in core now. - """ - query = "ALTER TABLE stock_package_type ADD COLUMN old_storage_type_id integer" - openupgrade.logged_query(env.cr, query) - # Insert data from old model to new - query = """ - INSERT INTO stock_package_type (name, old_storage_type_id) - (SELECT name, id FROM stock_package_storage_type sspt) - RETURNING id, old_storage_type_id - """ - openupgrade.logged_query(env.cr, query) - openupgrade.merge_models( - env.cr, - "stock.package.storage.type", - "stock.package.type", - "old_storage_type_id", - ) - # Update possible xml ids - query = """ - UPDATE ir_model_data - SET model = 'stock.package.type' - WHERE model = 'stock.package.storage.type' - """ - openupgrade.logged_query(env.cr, query) - - -def _move_location_storage_type(env): - """ - stock.storage.location.type has been merged with stock.storage.category.capacity - which is in core now. - """ - query = """ - ALTER TABLE stock_storage_category_capacity - ADD COLUMN old_location_storage_type_id integer - """ - openupgrade.logged_query(env.cr, query) - - _create_categories(env) - - openupgrade.merge_models( - env.cr, - "stock.location.storage.type", - "stock.storage.category.capacity", - "old_location_storage_type_id", - ) - # Update possible xml ids - query = """ - UPDATE ir_model_data - SET model = 'stock.storage.category.capacity' - WHERE model = 'stock.location.storage.type' - """ - openupgrade.logged_query(env.cr, query) - - -def _create_categories(env): - """ - Iterate on locations that have the field location_storage_type_ids - filled in and create a storage category for each combination. - Don't duplicate capacities that have the same: - - category - - package type - """ - query = """ - SELECT DISTINCT(location_id) FROM stock_location_location_storage_type_rel; - """ - openupgrade.logged_query(env.cr, query) - result = env.cr.fetchall() - ids = [r[0] for r in result] - existing_location_type_ids = {} - for location_id in ids: - query = """ - SELECT id, name FROM stock_location_storage_type - WHERE id in ( - SELECT location_storage_type_id - FROM stock_location_location_storage_type_rel - WHERE location_id = %s - ) - """ - openupgrade.logged_query(env.cr, query, (location_id,)) - result = env.cr.fetchall() - location_type_ids = {res[0] for res in result} - name = "/".join([res[1] for res in result]) - category_id = None - for category, existing_location_type in existing_location_type_ids.items(): - if all( - location_type_id in existing_location_type - for location_type_id in location_type_ids - ): - # All ids are found in the existing category - category_id = category - break - if category_id is None: - query = """ - INSERT INTO stock_storage_category (name, allow_new_product) - VALUES (%s, 'mixed') - RETURNING id - """ - openupgrade.logged_query(env.cr, query, (name,)) - result = env.cr.fetchone() - category_id = result[0] - - # Update the location by setting the category - query = """ - UPDATE stock_location - SET storage_category_id = %s - WHERE id = %s - AND storage_category_id IS NULL; - """ - openupgrade.logged_query( - env.cr, - query, - ( - category_id, - location_id, - ), - ) - - # Get all the linked package storage types (former package_storage_type_ids) - query = """ - SELECT spt.id, rel.location_storage_type_id - FROM stock_location_package_storage_type_rel rel - JOIN stock_package_type spt - ON spt.old_storage_type_id = rel.package_storage_type_id - WHERE location_storage_type_id IN %s - """ - openupgrade.logged_query(env.cr, query, (tuple(list(location_type_ids)),)) - results = env.cr.fetchall() - for result in results: - query = """ - INSERT INTO stock_storage_category_capacity - (storage_category_id, quantity, package_type_id, old_location_storage_type_id) - VALUES (%s, 1, %s, %s) - ON CONFLICT (storage_category_id, package_type_id) DO NOTHING - """ - openupgrade.logged_query( - env.cr, - query, - ( - category_id, - result[0], - result[1], - ), - ) - existing_location_type_ids[category_id] = location_type_ids - - -@openupgrade.migrate() -def migrate(env, version): - _move_product_package_type(env) - _move_location_storage_type(env) diff --git a/stock_storage_type/models/stock_location.py b/stock_storage_type/models/stock_location.py index 5d4be871c4..9ae9d4c463 100644 --- a/stock_storage_type/models/stock_location.py +++ b/stock_storage_type/models/stock_location.py @@ -24,8 +24,8 @@ class StockLocation(models.Model): compute="_compute_computed_storage_category_id", store=True, recursive=True, - help="This represents the Storage Category that will be used. It depends either " - "on the category set on the location or on one of its parent.", + help="This represents the Storage Category that will be used. It depends " + "either on the category set on the location or on one of its parent.", ) computed_storage_capacity_ids = fields.One2many( related="computed_storage_category_id.capacity_ids", @@ -233,7 +233,8 @@ def _compute_computed_storage_category_id(self): @api.depends("child_ids.leaf_location_ids", "child_ids.active") def _compute_leaf_location_ids(self): - """Compute all children leaf locations. Current location is excluded (not a child)""" + """Compute all children leaf locations. + Current location is excluded (not a child)""" query = """ SELECT parent.id, ARRAY_AGG(sub.id) AS leaves FROM stock_location parent @@ -310,7 +311,7 @@ def _compute_location_will_contain_lot_ids(self): @api.depends( "quant_ids.quantity", - "out_move_line_ids.qty_done", + "out_move_line_ids.quantity", "in_move_ids", "in_move_line_ids", "only_empty", @@ -320,7 +321,7 @@ def _compute_location_is_empty(self): # locations and we don't need to compute is empty # if there is no limit on the location only_empty_locations = self.filtered( - lambda l: not l._should_compute_location_is_empty() + lambda location: not location._should_compute_location_is_empty() ) only_empty_locations.update({"location_is_empty": True}) records = self - only_empty_locations @@ -331,11 +332,11 @@ def _compute_location_is_empty(self): qty_by_location = {} for group in self.env["stock.move.line"].read_group( OUT_MOVE_LINE_DOMAIN + location_domain, - fields=["qty_done:sum"], + fields=["quantity:sum"], groupby=["location_id"], ): location_id = group["location_id"][0] - out_qty_by_location[location_id] = group["qty_done"] + out_qty_by_location[location_id] = group["quantity"] for group in self.env["stock.quant"].read_group( location_domain, fields=["quantity:sum"], groupby=["location_id"] ): @@ -370,7 +371,8 @@ def _putaway_strategy_finalizer( putaway_location, product, quantity, package, packaging, additional_qty ) if package: - # If package provided, the product is not set (in the get_putaway_strategy() method) + # If package provided, the product is not set + # (in the get_putaway_strategy() method) product = package.single_product_id or product return self._get_package_type_putaway_strategy( putaway_location, package, product, quantity @@ -382,15 +384,15 @@ def _get_package_type(self, package, product): if package: package_type = package.package_type_id _logger.debug( - "Computing putaway for package %s of package type %s" - % (package, package_type) + f"Computing putaway for package {package} " + f"of package type {package_type}" ) elif product.package_type_id: - # Get default package type on product if defined + # Get the default package type on product if defined package_type = product.package_type_id _logger.debug( - "Computing putaway for product %s of package type %s" - % (product, product.package_type_id) + f"Computing putaway for product {product} " + f"of package type {package_type}" ) return package_type @@ -437,8 +439,9 @@ def _get_package_type_putaway_strategy( "Applied putaway strategy to location %s" % allowed_location.complete_name ) - # Reapply putaway strategy if particular rules have been put on product level - # Check if the allowed location is not self to avoid recursive computations + # Reapply putaway strategy if particular rules have been put on + # product level and check if the allowed location is not self to + # avoid recursive computations if allowed_location != self: final_location = allowed_location._get_putaway_strategy( product, quantity, package diff --git a/stock_storage_type/models/stock_quant.py b/stock_storage_type/models/stock_quant.py index 9852f52a8b..1beb6a7f78 100644 --- a/stock_storage_type/models/stock_quant.py +++ b/stock_storage_type/models/stock_quant.py @@ -20,7 +20,8 @@ def _check_storage_capacities(self): if not quant.package_id or not package_type or not storage_capacities: continue allowed_capacities = storage_capacities.filtered( - lambda capacity: package_type == capacity.package_type_id + lambda capacity, package_type=package_type: package_type + == capacity.package_type_id ) if not allowed_capacities: raise ValidationError( diff --git a/stock_storage_type/models/stock_storage_location_sequence.py b/stock_storage_type/models/stock_storage_location_sequence.py index 29c75d1fff..e2c5b4312b 100644 --- a/stock_storage_type/models/stock_storage_location_sequence.py +++ b/stock_storage_type/models/stock_storage_location_sequence.py @@ -27,8 +27,10 @@ def _format_package_storage_type_message(self, last=False): self.ensure_one() # TODO improve ugly code type_matching_locations = self.location_id.get_storage_locations().filtered( - lambda l: self.package_type_id - in l.computed_storage_category_id.capacity_ids.mapped("package_type_id") + lambda location: self.package_type_id + in location.computed_storage_category_id.capacity_ids.mapped( + "package_type_id" + ) ) if type_matching_locations: # Get the selection description diff --git a/stock_storage_type/models/stock_storage_location_sequence_cond.py b/stock_storage_type/models/stock_storage_location_sequence_cond.py index 723ea69b71..b29d026929 100644 --- a/stock_storage_type/models/stock_storage_location_sequence_cond.py +++ b/stock_storage_type/models/stock_storage_location_sequence_cond.py @@ -46,7 +46,8 @@ def _check_condition_type_code(self): if not rec._code_snippet_valued(): raise exceptions.UserError( _( - "Condition type is set to `Code`: you must provide a piece of code" + "Condition type is set to `Code`: " + "you must provide a piece of code" ) ) @@ -108,18 +109,11 @@ def _exec_code(self, storage_location_sequence, putaway_location, quant, product ) if not result: _logger.debug( - "Condition %s not met:\n" - "* putaway sequence: %s\n" - "* putaway location: %s\n" - "* quants: %s\n" - "* product: %s\n" - % ( - self.name, - storage_location_sequence.id, - putaway_location.name, - quant.ids, - product.display_name, - ) + f"Condition {self.name} not met:\n" + f"* putaway sequence: {storage_location_sequence.id}\n" + f"* putaway location: {putaway_location.name}\n" + f"* quants: {quant.ids}\n" + f"* product: {product.display_name}\n" ) return result diff --git a/stock_storage_type/tests/common.py b/stock_storage_type/tests/common.py index 5083cb3cb4..36b156358f 100644 --- a/stock_storage_type/tests/common.py +++ b/stock_storage_type/tests/common.py @@ -106,8 +106,8 @@ def setUpClass(cls): cls.internal_picking_type.write({"show_entire_packs": True}) # show_reserved must be set here because it changes the behaviour of # put_in_pack operation: - # if show_reserved: qty_done must be set on stock.picking.move_line_ids - # if not show_reserved: qty_done must be set on + # if show_reserved: quantity must be set on stock.picking.move_line_ids + # if not show_reserved: quantity must be set on # stock.picking.move_line_nosuggest_ids cls.receipts_picking_type.write( {"show_entire_packs": True, "show_reserved": True} diff --git a/stock_storage_type/tests/test_auto_assign_storage_type.py b/stock_storage_type/tests/test_auto_assign_storage_type.py index bd83034e14..efcf2c1c9b 100644 --- a/stock_storage_type/tests/test_auto_assign_storage_type.py +++ b/stock_storage_type/tests/test_auto_assign_storage_type.py @@ -50,7 +50,7 @@ def test_auto_assign_packaging(self): confirmed_move._action_assign() picking = confirmed_move.picking_id picking.action_confirm() - picking.move_line_ids.qty_done = 10.0 + picking.move_line_ids.quantity = 10.0 first_package = picking.action_put_in_pack() picking.button_validate() @@ -81,7 +81,7 @@ def test_auto_assign_no_packaging(self): confirmed_move._action_assign() picking = confirmed_move.picking_id picking.action_confirm() - picking.move_line_ids.qty_done = 10.0 + picking.move_line_ids.quantity = 10.0 first_package = picking.action_put_in_pack() picking.button_validate() diff --git a/stock_storage_type/tests/test_storage_type.py b/stock_storage_type/tests/test_storage_type.py index a7747c71ed..4b829750cd 100644 --- a/stock_storage_type/tests/test_storage_type.py +++ b/stock_storage_type/tests/test_storage_type.py @@ -189,5 +189,6 @@ def test_sequence_to_location_menu(self): def test_storage_capacity_display(self): self.assertEqual( self.cardboxes_stock.computed_storage_category_id.capacity_ids.display_name, - "Cardboxes x 1.0 (Package: Cardboxes - Allow New Product: Allow mixed products)", + "Cardboxes x 1.0 (Package: Cardboxes - " + "Allow New Product: Allow mixed products)", ) diff --git a/stock_storage_type/tests/test_storage_type_move.py b/stock_storage_type/tests/test_storage_type_move.py index 86e5d1aa7b..68042a5d69 100644 --- a/stock_storage_type/tests/test_storage_type_move.py +++ b/stock_storage_type/tests/test_storage_type_move.py @@ -96,7 +96,7 @@ def test_package_level_location_dest_domain_only_empty(self): # Mark as todo in_picking.action_confirm() # Put in pack - in_picking.move_line_ids.qty_done = 48.0 + in_picking.move_line_ids.quantity = 48.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_pallet_product_packaging @@ -104,7 +104,7 @@ def test_package_level_location_dest_domain_only_empty(self): ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id ) - ml_without_package.qty_done = 48.0 + ml_without_package.quantity = 48.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_pallet_product_packaging @@ -145,7 +145,7 @@ def test_package_level_location_dest_domain_only_empty(self): ] ) only_empty_possible_locations = possible_locations.filtered( - lambda l: not l.quant_ids + lambda location: not location.quant_ids ) for level in int_picking.package_level_ids: @@ -164,7 +164,7 @@ def test_package_level_location_dest_domain_only_empty(self): self.product, self.pallets_bin_3_location, 1.0 ) only_empty_possible_locations_2 = possible_locations.filtered( - lambda l: not l.quant_ids + lambda location: not location.quant_ids ) self.assertEqual( only_empty_possible_locations, @@ -242,7 +242,7 @@ def test_package_level_location_dest_domain_mixed(self): # Put in pack in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product - ).qty_done = 48.0 + ).quantity = 48.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_pallet_product_packaging @@ -250,7 +250,7 @@ def test_package_level_location_dest_domain_mixed(self): product_ml_without_package = in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product and not ml.result_package_id ) - product_ml_without_package.qty_done = 4.0 + product_ml_without_package.quantity = 4.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_cardbox_product_packaging @@ -272,7 +272,7 @@ def test_package_level_location_dest_domain_mixed(self): # Put in pack lot product in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product_lot - ).write({"qty_done": 5.0, "lot_id": lot_a0001.id}) + ).write({"quantity": 5.0, "lot_id": lot_a0001.id}) third_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack third_pack.product_packaging_id = self.product_lot_cardbox_product_packaging @@ -280,7 +280,7 @@ def test_package_level_location_dest_domain_mixed(self): product_lot_ml_without_package = in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product_lot and not ml.result_package_id ) - product_lot_ml_without_package.write({"qty_done": 5.0, "lot_id": lot_a0002.id}) + product_lot_ml_without_package.write({"quantity": 5.0, "lot_id": lot_a0002.id}) fourth_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack fourth_pack.product_packaging_id = self.product_lot_cardbox_product_packaging @@ -288,7 +288,7 @@ def test_package_level_location_dest_domain_mixed(self): product_lot_ml_without_package = in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product_lot and not ml.result_package_id ) - product_lot_ml_without_package.write({"qty_done": 5.0, "lot_id": lot_a0002.id}) + product_lot_ml_without_package.write({"quantity": 5.0, "lot_id": lot_a0002.id}) fifth_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack fifth_pack.product_packaging_id = self.product_lot_cardbox_product_packaging @@ -368,7 +368,7 @@ def _levels_for(packages): # Set the quantities done in order to avoid immediate transfer wizard for move_line in pack_level.move_line_ids: - move_line.qty_done = move_line.reserved_qty + move_line.quantity = move_line.reserved_qty second_level.location_dest_id = third_level.location_dest_id with self.assertRaises(ValidationError): @@ -437,14 +437,14 @@ def test_stock_move_no_package(self): product_lot_ml = in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product_lot ) - product_lot_ml.write({"qty_done": 5.0, "lot_name": "A0001"}) - product_lot_ml.copy({"qty_done": 3.0, "lot_name": "A0002"}) + product_lot_ml.write({"quantity": 5.0, "lot_name": "A0001"}) + product_lot_ml.copy({"quantity": 3.0, "lot_name": "A0002"}) product_ml = in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product ) - product_ml.write({"qty_done": 8.0}) + product_ml.write({"quantity": 8.0}) in_picking._action_done() diff --git a/stock_storage_type/tests/test_storage_type_putaway_strategy.py b/stock_storage_type/tests/test_storage_type_putaway_strategy.py index 3f2956576c..78a4271cb6 100644 --- a/stock_storage_type/tests/test_storage_type_putaway_strategy.py +++ b/stock_storage_type/tests/test_storage_type_putaway_strategy.py @@ -35,7 +35,7 @@ def test_storage_strategy_ordered_locations_cardboxes(self): # Mark as todo in_picking.action_confirm() # Put in pack - in_picking.move_line_ids.qty_done = 4.0 + in_picking.move_line_ids.quantity = 4.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_cardbox_product_packaging @@ -43,7 +43,7 @@ def test_storage_strategy_ordered_locations_cardboxes(self): ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id ) - ml_without_package.qty_done = 4.0 + ml_without_package.quantity = 4.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_cardbox_product_packaging @@ -111,7 +111,7 @@ def test_storage_strategy_only_empty_ordered_locations_pallets(self): # Mark as todo in_picking.action_confirm() # Put in pack - in_picking.move_line_ids.qty_done = 48.0 + in_picking.move_line_ids.quantity = 48.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_pallet_product_packaging @@ -119,7 +119,7 @@ def test_storage_strategy_only_empty_ordered_locations_pallets(self): ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id ) - ml_without_package.qty_done = 48.0 + ml_without_package.quantity = 48.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_pallet_product_packaging @@ -181,7 +181,7 @@ def test_storage_strategy_max_weight_ordered_locations_pallets(self): # Mark as todo in_picking.action_confirm() # Put in pack - in_picking.move_line_ids.qty_done = 48.0 + in_picking.move_line_ids.quantity = 48.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_pallet_product_packaging @@ -191,7 +191,7 @@ def test_storage_strategy_max_weight_ordered_locations_pallets(self): ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id ) - ml_without_package.qty_done = 48.0 + ml_without_package.quantity = 48.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_pallet_product_packaging @@ -263,7 +263,7 @@ def test_storage_strategy_no_products_lots_mix_ordered_locations_cardboxes(self) # Put in pack product in_picking.move_line_ids.filtered( lambda ml: ml.product_id == self.product - ).qty_done = 4.0 + ).quantity = 4.0 product_first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack product_first_package.product_packaging_id = ( @@ -273,7 +273,7 @@ def test_storage_strategy_no_products_lots_mix_ordered_locations_cardboxes(self) product_ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id and ml.product_id == self.product ) - product_ml_without_package.qty_done = 4.0 + product_ml_without_package.quantity = 4.0 product_second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack product_second_pack.product_packaging_id = ( @@ -284,7 +284,7 @@ def test_storage_strategy_no_products_lots_mix_ordered_locations_cardboxes(self) product_lot_ml = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id and ml.product_id == self.product_lot ) - product_lot_ml.write({"qty_done": 5.0, "lot_name": "A0001"}) + product_lot_ml.write({"quantity": 5.0, "lot_name": "A0001"}) product_lot_first_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack product_lot_first_pack.product_packaging_id = ( @@ -294,7 +294,7 @@ def test_storage_strategy_no_products_lots_mix_ordered_locations_cardboxes(self) product_lot_ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id and ml.product_id == self.product_lot ) - product_lot_ml_without_package.write({"qty_done": 5.0, "lot_name": "A0002"}) + product_lot_ml_without_package.write({"quantity": 5.0, "lot_name": "A0002"}) product_lot_second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack product_lot_second_pack.product_packaging_id = ( @@ -674,7 +674,7 @@ def test_storage_strategy_ordered_locations_cardboxes_with_new_leaf_putaway(self # Mark as todo in_picking.action_confirm() # Put in pack - in_picking.move_line_ids.qty_done = 4.0 + in_picking.move_line_ids.quantity = 4.0 first_package = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack first_package.product_packaging_id = self.product_cardbox_product_packaging @@ -682,7 +682,7 @@ def test_storage_strategy_ordered_locations_cardboxes_with_new_leaf_putaway(self ml_without_package = in_picking.move_line_ids.filtered( lambda ml: not ml.result_package_id ) - ml_without_package.qty_done = 4.0 + ml_without_package.quantity = 4.0 second_pack = in_picking.action_put_in_pack() # Ensure packaging is set properly on pack second_pack.product_packaging_id = self.product_cardbox_product_packaging diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000000..211e5c19a3 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +odoo-addon-stock-move-line-reserved-quant @ git+https://github.com/OCA/stock-logistics-workflow.git@refs/pull/1691/head#subdirectory=stock_move_line_reserved_quant +odoo-addon-stock-putaway-hook @ git+https://github.com/OCA/stock-logistics-workflow.git@refs/pull/1842/head#subdirectory=stock_putaway_hook +odoo-addon-stock-storage-category-capacity-name @ git+https://github.com/OCA/stock-logistics-warehouse.git@refs/pull/2240/head#subdirectory=stock_storage_category_capacity_name