From e89c818e5a8fb94bdfbd7c8146579b8ffc4ac68b Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 16 Oct 2019 15:01:09 +0000 Subject: [PATCH] [FIX] mrp: missing cast string to date Usecase to repdroduce: - Create a manufactured product with route manufacture and a RR - Run the scheduler. Orderpoint will prepare procurement values's date as string. Other module could possibly also use string as date and a call to from_string will not break anything if the value is already a date or a datetime. closes odoo/odoo#38900 X-original-commit: e4c654f8e5e768288226c725a1018ae31e8f5606 Signed-off-by: Simon Lejeune (sle) --- addons/mrp/models/stock_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_rule.py b/addons/mrp/models/stock_rule.py index cb8966f263a..8ab0657df99 100644 --- a/addons/mrp/models/stock_rule.py +++ b/addons/mrp/models/stock_rule.py @@ -84,7 +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), + 'date_planned_start': fields.Datetime.from_string(values['date_planned']) - relativedelta(hours=1), 'procurement_group_id': False, 'propagate_cancel': self.propagate_cancel, 'propagate_date': self.propagate_date,