From 61284e5c27902c1f63ef77347a7105dfa933cbfc Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 17 Jan 2018 15:25:17 +0100 Subject: [PATCH] [IMP] mrp: activity on MO if the linked SO is modified return the production_id and the responsible if it exist on the move instead of returning the origin moves. We can deduce that if a production is linked to a move and this MO still ongoing then it should be the upperstream document. --- addons/mrp/models/stock_move.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 6a67b2107de..fde92085713 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -249,6 +249,12 @@ class StockMove(models.Model): vals.update({'lot_id': lot.id}) self.env['stock.move.line'].create(vals) + def _get_upstream_documents_and_responsibles(self): + if self.created_production_id and self.created_production_id.state not in ('done', 'cancel'): + return [(self.created_production_id, self.created_production_id.user_id)] + else: + return super(StockMove, self)._get_upstream_documents_and_responsibles() + class PushedFlow(models.Model): _inherit = "stock.location.path"