summaryrefslogtreecommitdiff
path: root/addons/mrp/tests
diff options
context:
space:
mode:
authorNicolas Galler <ngl@odoo.com>2020-12-21 14:32:55 +0000
committerNicolas Galler <ngl@odoo.com>2020-12-31 10:56:10 +0000
commit04bbeb79ca6a04dd44f834bfee30af3a36aa497f (patch)
tree828162795242a6887683dbe846fa72df2ad81b8e /addons/mrp/tests
parentbe5f3bdfe5f593e2f3998f93b98b9f43e1658ee6 (diff)
[FIX] mrp: update date on move when editing date after planning WO
Behavior prior to this commit: - normally when editing the Scheduled Date on a MO, the date on the related stock moves is updated. However this does not happen once the MO is planned - if the date is edited and the MO is planned, the MO is automatically unplanned, but the date on the stock moves is not automatically updated Behavior after this commit: - when the date is updated on the MO and it is planned, the dates on the stock moves will automatically update, so that the behavior is consistent with how it would work if you clicked Unplan first then updated the date. opw-2417108 closes odoo/odoo#63652 Signed-off-by: Nicolas Galler <ngaller@users.noreply.github.com>
Diffstat (limited to 'addons/mrp/tests')
-rw-r--r--addons/mrp/tests/test_order.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/mrp/tests/test_order.py b/addons/mrp/tests/test_order.py
index 65a4da48486..e42eb695af8 100644
--- a/addons/mrp/tests/test_order.py
+++ b/addons/mrp/tests/test_order.py
@@ -316,6 +316,22 @@ class TestMrpOrder(TestMrpCommon):
production = mo_form.save()
self.assertEqual(production.workorder_ids.duration_expected, 90)
+ def test_update_plan_date(self):
+ """Editing the scheduled date after planning the MO should unplan the MO, and adjust the date on the stock moves"""
+ planned_date = datetime(2023, 5, 15, 9, 0)
+ mo_form = Form(self.env['mrp.production'])
+ mo_form.product_id = self.product_4
+ mo_form.bom_id = self.bom_1
+ mo_form.product_qty = 1
+ mo_form.date_planned_start = planned_date
+ mo = mo_form.save()
+ self.assertEqual(mo.move_finished_ids[0].date, datetime(2023, 5, 15, 10, 0))
+ mo.action_confirm()
+ mo.button_plan()
+ with Form(mo) as frm:
+ frm.date_planned_start = datetime(2024, 5, 15, 9, 0)
+ self.assertEqual(mo.move_finished_ids[0].date, datetime(2024, 5, 15, 10, 0))
+
def test_rounding(self):
""" Checks we round up when bringing goods to produce and round half-up when producing.
This implementation allows to implement an efficiency notion (see rev 347f140fe63612ee05e).