diff --git a/wizard/scop_bordereau_refund_wizard.py b/wizard/scop_bordereau_refund_wizard.py index 9c7a5182d6d0db4f3f98d3178efd48d035f46e6c..1fbd0fbd790104460f3a29d99fd940c07ffa94a4 100644 --- a/wizard/scop_bordereau_refund_wizard.py +++ b/wizard/scop_bordereau_refund_wizard.py @@ -177,7 +177,7 @@ class ScopBordereauRefundWizard(models.TransientModel): for quarter_id in self.quarter_ids: date_due = self.bordereau_id.invoice_ids.filtered( lambda i: i.cotiz_quarter == str(quarter_id.quarter) and i.move_type == "out_invoice")[0].invoice_date_due - refund = self.env["account.move"].create( + self.env["account.move"].create( { "partner_id": partner_id.id, "journal_id": cotiz_type.get(int(self.type_cotiz))[1].id, @@ -194,17 +194,19 @@ class ScopBordereauRefundWizard(models.TransientModel): "type_contribution_id": self.type_cotiz, "payment_mode_id": bordereau_id.payment_mode_id.id, "invoice_date_due": date_due, - } - ) - self.env["account.move.line"].create( - { - "name": self.comment, - "move_id": refund.id, - "product_id": product.id, - "account_id": product.property_account_income_id.id, - "quantity": 1, - "price_unit": self.amount_refund, - "price_subtotal": self.amount_refund, + "invoice_line_ids": [ + ( + 0, + None, + { + "product_id": product.id, + "account_id": product.property_account_income_id.id, + "name": self.comment, + "price_unit": self.amount_refund, + "price_subtotal": self.amount_refund, + }, + ), + ], } )