[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.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user