Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion product_catalog_tree/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ def _inverse_catalog_values(self, product_catalog_qty):
return

order = self.env[res_model].browse(order_id)

for rec in self:
existing_lines = order.order_line.filtered(lambda line: line.product_id.id == rec.id)
if res_model == "account.move":
existing_lines = order.invoice_line_ids.filtered(lambda line: line.product_id.id == rec.id)
else:
existing_lines = order.order_line.filtered(lambda line: line.product_id.id == rec.id)
if len(existing_lines) > 1 and product_catalog_qty > 0:
total_current_qty = sum(existing_lines.mapped("product_uom_qty"))
qty_difference = product_catalog_qty - total_current_qty
Expand Down
Loading