diff --git a/wizard/ranch_purchase_data_invoice_wizard.py b/wizard/ranch_purchase_data_invoice_wizard.py index fe98f9ae9e42907ab07d13b23888c126908d2f2b..ce3273d32697151f222e31d190113dc62005fa01 100644 --- a/wizard/ranch_purchase_data_invoice_wizard.py +++ b/wizard/ranch_purchase_data_invoice_wizard.py @@ -272,14 +272,8 @@ class PurchaseDataInvoiceWizard(models.TransientModel): final_lines = self.final_rel_line_ids product = config_id.product_id - if final_lines: - total_kilos = sum(final_lines.mapped('invoiced_kilos')) - total_price = sum(final_lines.mapped('price_unit')) -# else: -# total_kilos = sum(summary_lines.mapped('invoiced_kilos')) -# total_price = sum(summary_lines.mapped('price_unit')) - - total_amount = total_kilos * total_price + total_amount = sum(final_lines.mapped( + lambda x: x.price_unit * x.invoiced_kilos)) price_unit = total_amount * (self.auction_commision / 100)