Skip to content

Commit

Permalink
fixup! fixup! [ADD] purchase_sale_inter_company: Support returns
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulb committed Sep 25, 2024
1 parent 82b7aac commit 67e665e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions purchase_sale_inter_company/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def _action_done(self):
)
po_move_lines = (
ic_picking.with_user(intercompany_user)
.with_company(dest_company)
.move_lines.filtered(lambda x, prod=product: x.product_id == prod)
.mapped("move_line_ids")
)
Expand Down Expand Up @@ -230,10 +231,10 @@ def _sync_receipt_with_delivery(self, dest_company, sale_order):
moves = [(m, m.quantity_done) for m in self.move_ids_without_package]
dest_picking = self.intercompany_return_picking_id.with_user(
intercompany_user
)
).with_company(dest_company)
all_dest_moves = self.intercompany_return_picking_id.with_user(
intercompany_user
).move_lines
).with_company(dest_company).move_lines
for move, qty in moves:
dest_moves = all_dest_moves.filtered(
lambda x, prod=move.product_id: x.product_id == prod
Expand Down Expand Up @@ -266,7 +267,7 @@ def _sync_receipt_with_delivery(self, dest_company, sale_order):
purchase_order = sale_order.auto_purchase_order_id.sudo()
if not (purchase_order and purchase_order.picking_ids):
raise UserError(_("PO does not exist or has no receipts"))
dest_picking = self.intercompany_picking_id.with_user(intercompany_user.id)
dest_picking = self.intercompany_picking_id.with_user(intercompany_user.id).with_company(dest_company)
dest_move_qty_update_dict = {}
for move in self.move_ids_without_package.sudo():
# To identify the correct move to write to,
Expand Down
1 change: 1 addition & 0 deletions purchase_sale_inter_company/wizard/stock_return_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def create_returns(self):
self.env["stock.return.picking"]
.with_context(active_id=ic_pick.id)
.with_user(intercompany_user)
.with_company(dest_company)
.create(vals)
)
return_wizard._onchange_picking_id()
Expand Down

0 comments on commit 67e665e

Please sign in to comment.