[FIX] mrp: set planned date when creating order through procurement
If it isn't set manually, it defaults to now and the result is not consistent with planned date end. We make it an hour before totally subjectively. closes odoo/odoo#37173 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -84,6 +84,7 @@ class StockRule(models.Model):
|
||||
'bom_id': bom.id,
|
||||
'date_deadline': fields.Datetime.to_string(self._get_date_planned(product_id, company_id, values)),
|
||||
'date_planned_finished': values['date_planned'],
|
||||
'date_planned_start': values['date_planned'] - relativedelta(hours=1),
|
||||
'procurement_group_id': False,
|
||||
'propagate_cancel': self.propagate_cancel,
|
||||
'propagate_date': self.propagate_date,
|
||||
|
||||
@@ -194,5 +194,6 @@ class TestProcurement(TestMrpCommon):
|
||||
|
||||
move_dest_scheduled_date = move_dest.date_expected
|
||||
mo.date_planned_start += timedelta(days=5)
|
||||
|
||||
self.assertAlmostEqual(move_dest.date_expected, move_dest_scheduled_date + timedelta(days=5), delta=timedelta(seconds=1), msg='date is not propagated')
|
||||
# Adding 5 days to the date planned start makes the next move's date 4 days and 23 hours
|
||||
# later since the date planned start was set one hour before the date_planned_end.
|
||||
self.assertAlmostEqual(move_dest.date_expected, move_dest_scheduled_date + timedelta(days=4, hours=23), delta=timedelta(seconds=1), msg='date is not propagated')
|
||||
|
||||
Reference in New Issue
Block a user