Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] stock_intercompany_bidirectional: Fix incorrect move warehouse #732

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stock_intercompany_bidirectional/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
23 changes: 15 additions & 8 deletions stock_intercompany_bidirectional/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading