Skip to content

Commit

Permalink
[16.0][IMP] delivery date propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kev-Roche committed Nov 19, 2024
1 parent efef39e commit 411e7e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions purchase_sale_inter_company/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ def action_confirm(self):
if line.auto_purchase_line_id:
line.auto_purchase_line_id.price_unit = line.price_unit
return super().action_confirm()

def write(self, vals):
res = super().write(vals)
purchase_id = self.auto_purchase_order_id
if "commitment_date" in vals and purchase_id:
purchase_id.sudo().write({"date_planned": vals["commitment_date"]})
return res
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,11 @@ def test_bypass_check_when_update_locked_sale_order_with_ctx(self):
purchase.order_line[0].with_context(allow_update_locked_sales=True).write(
{"product_qty": 99}
)

def test_change_delivery_date_sale(self):
from dateutil.relativedelta import relativedelta

sale = self._approve_po()
self.assertEqual(self.purchase_company_a.date_planned, sale.commitment_date)
sale.commitment_date = sale.commitment_date + relativedelta(days=3)
self.assertEqual(self.purchase_company_a.date_planned, sale.commitment_date)

0 comments on commit 411e7e0

Please sign in to comment.