diff --git a/stock_intercompany_bidirectional/__manifest__.py b/stock_intercompany_bidirectional/__manifest__.py index 23a16ff8588..844fd1f85da 100644 --- a/stock_intercompany_bidirectional/__manifest__.py +++ b/stock_intercompany_bidirectional/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Intercompany Bidirectional", "summary": "Bidirectional operations for the Stock Intercomany module", - "version": "16.0.1.0.1", + "version": "16.0.1.0.2", "category": "Inventory/Inventory", "website": "https://github.com/OCA/multi-company", "author": "Cetmix, Odoo Community Association (OCA)", diff --git a/stock_intercompany_bidirectional/models/stock_picking.py b/stock_intercompany_bidirectional/models/stock_picking.py index 07dba1ab6b7..4f1fad09a76 100644 --- a/stock_intercompany_bidirectional/models/stock_picking.py +++ b/stock_intercompany_bidirectional/models/stock_picking.py @@ -38,29 +38,36 @@ def _check_company_consistency(self, company): """ move_ids, move_line_ids = super()._check_company_consistency(company) - warehouse = company.intercompany_in_type_id.warehouse_id - location_dest = company.intercompany_in_type_id.default_location_dest_id - stock_move_line_obj = self.env["stock.move.line"] + location_dest = ( + company.intercompany_in_type_id.default_location_dest_id + or company.intercompany_in_type_id.warehouse_id.lot_stock_id + ) + location_dest_id = location_dest.id + warehouse_id = location_dest.warehouse_id.id # Remove package-related data and update destination location # in move_ids and move_line_ids for move_data in move_ids: # Update destination location for each move - move_data[2]["location_dest_id"] = ( - location_dest.id or warehouse.lot_stock_id.id + move_data[2].update( + { + "location_dest_id": location_dest_id, + "rule_id": False, + "warehouse_id": warehouse_id, + } ) - # Set rule_id to False - move_data[2]["rule_id"] = False + for line_data in move_line_ids: # Prepare the move line ids line_data[2].update( { "package_level_id": False, "package_id": False, - "location_dest_id": location_dest.id or warehouse.lot_stock_id.id, + "location_dest_id": location_dest_id, } ) + stock_move_line_obj = self.env["stock.move.line"] if company.auto_update_qty_done: # Update move_line_ids to include 'qty_done' based on counterpart move lines for line_data in move_line_ids: