Skip to content
Extraits de code Groupes Projets
Valider c8c10a2f rédigé par jordan's avatar jordan
Parcourir les fichiers

[update] add journal and account in config cotiz cg

parent ab38d2a3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -70,7 +70,8 @@ class ScopCotisation(models.AbstractModel): ...@@ -70,7 +70,8 @@ class ScopCotisation(models.AbstractModel):
# Global functions # Global functions
# ------------------------------------------------------ # ------------------------------------------------------
def create_contribution(self, product, partner, type_contribution, def create_contribution(self, product, partner, type_contribution,
liasse=None, amount=0, date=False): liasse=None, amount=0, date=False,
journal_id=False, account_id=False):
Invoice = self.env['account.invoice'] Invoice = self.env['account.invoice']
InvoiceLine = self.env['account.invoice.line'] InvoiceLine = self.env['account.invoice.line']
...@@ -79,8 +80,12 @@ class ScopCotisation(models.AbstractModel): ...@@ -79,8 +80,12 @@ class ScopCotisation(models.AbstractModel):
('year', '=', self.year), ('year', '=', self.year),
('type_contribution_id', '=', type_contribution) ('type_contribution_id', '=', type_contribution)
]) ])
date_invoice = date if date else self.date_cotisation
if not exisiting_invoice: if not exisiting_invoice:
date_invoice = date if date else self.date_cotisation
journal_id = self.company_id.contribution_journal_id \
if not journal_id else journal_id
account_id = partner.property_account_receivable_id \
if not account_id else account_id
member_invoice = Invoice.create({ member_invoice = Invoice.create({
'partner_id': partner.id, 'partner_id': partner.id,
'liasse_fiscale_id': liasse.id, 'liasse_fiscale_id': liasse.id,
...@@ -88,9 +93,9 @@ class ScopCotisation(models.AbstractModel): ...@@ -88,9 +93,9 @@ class ScopCotisation(models.AbstractModel):
'year': self.year, 'year': self.year,
'is_contribution': True, 'is_contribution': True,
'type_contribution_id': type_contribution, 'type_contribution_id': type_contribution,
'journal_id': self.company_id.contribution_journal_id.id, 'journal_id': journal_id.id,
'state': 'draft', 'state': 'draft',
'account_id': partner.property_account_receivable_id.id, 'account_id': account_id.id,
'payment_term_id': self.payment_term_id.id, 'payment_term_id': self.payment_term_id.id,
'payment_mode_id': partner.customer_payment_mode_id.id, 'payment_mode_id': partner.customer_payment_mode_id.id,
'date_invoice': date_invoice, 'date_invoice': date_invoice,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter