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

[16.0][IMP] purchase_sale_inter_company : delivery date propagation #718

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
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)
Loading