-
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Module
stock_request
Describe the bug
stock-logistics-request/stock_request/models/stock_move.py
Lines 77 to 82 in 8e3aa1a
| def _action_done(self, cancel_backorder=False): | |
| """Apply sudo to prevent requests ACL errors if the user does not have | |
| permissions (example: productions).""" | |
| res = super()._action_done(cancel_backorder=cancel_backorder) | |
| self.mapped("allocation_ids.stock_request_id").sudo().check_done() | |
| return res |
the .mapped() there is applied to all moves, but in some cases _action_done() deletes moves (like when it expands Kits in a BOM for a MO).
To Reproduce
Affected versions:
18.0 (I haven't tested other versions)
Steps to reproduce the behavior:
- Create a BOM with a Kit inside
- Create and confirm a MO using that BOM
Expected behavior
Installing stock_request should not break those productions.
Additional context
The following patch seems to fix the issue:
diff --git a/stock_request/models/stock_move.py b/stock_request/models/stock_move.py
index 6019d26..9a803b2 100644
--- a/stock_request/models/stock_move.py
+++ b/stock_request/models/stock_move.py
@@ -78,5 +78,5 @@ class StockMove(models.Model):
"""Apply sudo to prevent requests ACL errors if the user does not have
permissions (example: productions)."""
res = super()._action_done(cancel_backorder=cancel_backorder)
- self.mapped("allocation_ids.stock_request_id").sudo().check_done()
+ self.filtered(lambda x: x.exists()).mapped("allocation_ids.stock_request_id").sudo().check_done()
return res
I can't really tell what's the impact on stock_request in general.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working