Skip to content

Commit 98ed660

Browse files
committed
[IMP]product_catalog_tree:recompute line in PO
X-original-commit: 093f762
1 parent 7d92474 commit 98ed660

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

product_catalog_tree/models/product_product.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,18 @@ def _inverse_catalog_values(self, product_catalog_qty):
5656

5757
order = self.env[res_model].browse(order_id)
5858
for rec in self:
59+
# Actualizar la información de la línea de orden
5960
order.with_company(order.company_id)._update_order_line_info(rec.id, product_catalog_qty)
6061

62+
# Si la cantidad es mayor a 0, recalcular precios y descuentos
63+
if product_catalog_qty > 0:
64+
order_lines = order.order_line.filtered(lambda line: line.product_id.id == rec.id)
65+
if order_lines:
66+
# Tomamos la última línea en caso de que haya varias
67+
order_line = order_lines[-1]
68+
# Ejecutar el método que recalcula linea
69+
order_line._compute_price_unit_and_date_planned_and_name()
70+
6171
def increase_quantity(self):
6272
for rec in self:
6373
rec._inverse_catalog_values(rec.product_catalog_qty + 1)

0 commit comments

Comments
 (0)