diff options
| author | Arnold Moyaux <arm@odoo.com> | 2019-06-14 14:23:22 +0000 |
|---|---|---|
| committer | svs-odoo <svs@odoo.com> | 2019-07-31 12:37:38 +0000 |
| commit | 3d4c0f92af86e534bc44ed48eb0ebf2ade3f7a92 (patch) | |
| tree | f7c9317f23e8643600b5a4d8a58d44fab9857853 /addons | |
| parent | c76fcd87c513b74cebea3a318c33f06fb03cafa9 (diff) | |
[FIX] mrp: log activity on parent MO
Usecase:
- Set table top as manufacture and MTO
- Create a MO for table(MTO)
- Confirm the MO
- Cancel the MO
The activity with the exception is not logged on the child MO
It happens because the _get_upstream_documents_and_responsible for move
linked to a MO is based on the created_production_id field. However it
is only set on the move that created the move_finished_ids for the new
MO. In the case of a MO that directly create a child MO the chain is:
MO -> move_raw_ids -> move_finished_ids -> MO2
The log_activity on cancel is based on the move_raw_ids and their
move_orig_ids in the previous case it's the move_finished_ids for MO2.
However the move_finished_ids for MO2 is directly link to the child MO
and the created_production_id is set on the move_raw_ids for MO parent.
Compare to PO, we could directly base the parent document on production_id
since the move_finished_ids are directly created.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mrp/models/stock_move.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 5c0de7462d4..df0452c0539 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -216,8 +216,8 @@ class StockMove(models.Model): return self.env['stock.move'] def _get_upstream_documents_and_responsibles(self, visited): - 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, visited)] + if self.production_id and self.production_id.state not in ('done', 'cancel'): + return [(self.production_id, self.production_id.user_id, visited)] else: return super(StockMove, self)._get_upstream_documents_and_responsibles(visited) |
