summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Vandevenne (anv) <anv@odoo.com>2025-01-28 13:44:21 +0100
committerAnita (anko) <anko@odoo.com>2025-02-06 19:56:51 +0000
commit66c5d10833af8946ab5d3f887086f9ba08d36ab3 (patch)
tree3685e678515a61a1fe88a08817e99934c5aac059
parentd57b0323b7e1d7ab50f36cba4ff09afa26c60c38 (diff)
[FIX] repair, sale_stock: pass `previous_product_uom_qty` as kwarg
The `previous_product_uom_qty` keyword argument was passed as a positional parameter to `_action_launch_stock_rule`, preventing that method's overrides from passing it back with its key name when other overrides pack the kwarg with the `**` operator. This commit ensures that the argument is now passed correctly with its key name. It also makes the overrides kwargs-agnostic by packing and unpacking them with `**`, thus preventing future issues related to signature changes in the parent method. closes odoo/odoo#193457 Related: odoo/enterprise#77839 Related: odoo/documentation#11823 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
-rw-r--r--addons/repair/models/sale_order.py4
-rw-r--r--addons/sale_stock/models/sale_order_line.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/repair/models/sale_order.py b/addons/repair/models/sale_order.py
index 6c567d2e939..7af4ce8a8d9 100644
--- a/addons/repair/models/sale_order.py
+++ b/addons/repair/models/sale_order.py
@@ -79,10 +79,10 @@ class SaleOrderLine(models.Model):
return res
return super().write(vals)
- def _action_launch_stock_rule(self, previous_product_uom_qty=False):
+ def _action_launch_stock_rule(self, **kwargs):
# Picking must be generated for products created from the SO but not for parts added from the RO, as they're already handled there
lines_without_repair_move = self.filtered(lambda line: not line.move_ids.sudo().repair_id)
- return super(SaleOrderLine, lines_without_repair_move)._action_launch_stock_rule(previous_product_uom_qty)
+ return super(SaleOrderLine, lines_without_repair_move)._action_launch_stock_rule(**kwargs)
def _create_repair_order(self):
new_repair_vals = []
diff --git a/addons/sale_stock/models/sale_order_line.py b/addons/sale_stock/models/sale_order_line.py
index 0540d7efbb0..0909a4f2a38 100644
--- a/addons/sale_stock/models/sale_order_line.py
+++ b/addons/sale_stock/models/sale_order_line.py
@@ -227,7 +227,7 @@ class SaleOrderLine(models.Model):
previous_product_uom_qty = {line.id: line.product_uom_qty for line in lines}
res = super(SaleOrderLine, self).write(values)
if lines:
- lines._action_launch_stock_rule(previous_product_uom_qty)
+ lines._action_launch_stock_rule(previous_product_uom_qty=previous_product_uom_qty)
return res
@api.depends('move_ids')