From 681727c6a70979bd966dabf6d617c6eee9e89227 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Mon, 1 Mar 2021 16:03:59 +0100
Subject: [PATCH] [update] calculate amount_cotiz with extern param and create
 invoices in extern function

---
 models/scop_cotisation.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/models/scop_cotisation.py b/models/scop_cotisation.py
index efe93dc..2232df7 100644
--- a/models/scop_cotisation.py
+++ b/models/scop_cotisation.py
@@ -65,7 +65,8 @@ class ScopCotisation(models.AbstractModel):
     # ------------------------------------------------------
     # Global functions
     # ------------------------------------------------------
-    def create_contribution(self, product, partner, liasse=None, amount=0):
+    def create_contribution(self, product, partner, type_contribution,
+                            liasse=None, amount=0):
         Invoice = self.env['account.invoice']
         InvoiceLine = self.env['account.invoice.line']
         member_invoice = Invoice.create({
@@ -74,6 +75,7 @@ class ScopCotisation(models.AbstractModel):
             'type': 'out_invoice',
             'year': self.year,
             'is_contribution': True,
+            'type_contribution_id': type_contribution,
             'journal_id': self.company_id.contribution_journal_id.id,
             'state': 'draft',
             'account_id': partner.property_account_receivable_id.id,
-- 
GitLab