[FIX] stock: apply push rule after transparent rule

Usecase to reproduce:
- Rule from WH/A -> WH/B as automatique no step added
- Rule from WH/B -> WH/C as transfer created

Do a move that goes to WH/A and confirm it. It's destination location
is correctly set to WH/B but the internal transfer from WH/B to WH/C
is not created.

It's due to the avoid loop location that returns always true due to
code removed in commit 1d36fb428f

closes odoo/odoo#61488

X-original-commit: b2a07e4d08beff360ac1e6c95d240a15b1081855
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Arnold Moyaux
2020-11-06 15:14:53 +00:00
parent bd6749e750
commit b2017fd366
+2 -1
View File
@@ -166,9 +166,10 @@ class StockRule(models.Model):
"""
new_date = fields.Datetime.to_string(move.date + relativedelta(days=self.delay))
if self.auto == 'transparent':
old_dest_location = move.location_dest_id
move.write({'date': new_date, 'location_dest_id': self.location_id.id})
# avoid looping if a push rule is not well configured; otherwise call again push_apply to see if a next step is defined
if self.location_id != move.location_dest_id:
if self.location_id != old_dest_location:
# TDE FIXME: should probably be done in the move model IMO
move._push_apply()
else: