@ -49,8 +49,8 @@ class AccountingFileWizard(models.TransientModel):
#car traité avec les retraites
if d . invoice_id : continue
d . date_compta = date_compta
if not d . payment_mode_id : raise UserError ( _ ( " no payment mode found for donation %r " , donation . number ) )
if not d . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found for payment mode %r " , d . payment_mode_id . name ) )
#if not d.payment_mode_id: raise UserError(_("no payment mode found for donation %r ",donation.number) )
#if not d.payment_mode_id.fixed_journal_id: raise UserError(_("no account found for payment mode %r",d.payment_mode_id.name) )
account_debit_number = self . _file_format ( str ( d . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
firstname = d . partner_id . firstname
name = d . partner_id . name
@ -69,7 +69,7 @@ class AccountingFileWizard(models.TransientModel):
for line in d . line_ids :
affectation = line . product_id . name
amount = str ( line . amount )
if not line . product_id . property_account_income_id : raise UserError ( _ ( " no credit account found for product %r " , line . product_id ) )
#if not line.product_id.property_account_income_id: raise UserError(_("no credit account found for product %r",line.product_id.name) )
account_credit_number = self . _file_format ( line . product_id . property_account_income_id . code , 6 )
break
@ -100,7 +100,7 @@ class AccountingFileWizard(models.TransientModel):
#si l'adhésion est liée à une facture, alors on récupère la facture pour trouver le mode de paiement
if m . invoice_id :
if not m . invoice_id . payment_id . fixed_journal_id : raise UserError ( _ ( " no account found for payment mode %r " , m . invoice_id . payment_id . name ) )
#if not m.invoice_id.payment_id.fixed_journal_id: raise UserError(_("no account found for payment mode %r",m.invoice_id.payment_id.name) )
account_debit_number = self . _file_format ( str ( m . invoice_id . payment_id . fixed_journal_id . default_account_id . code ) , 6 )
#si l'adhésion est liée à une transaction,le mode de paiement est CB
elif m . transaction_id :
@ -113,7 +113,7 @@ class AccountingFileWizard(models.TransientModel):
#sinon on prend le mode de paiement au niveau de la fiche d'adhésion
else :
if m . payment_mode_id :
if not m . payment_mode_id : raise UserError ( _ ( " no payment mode found for membership %r " , m . partner_id . name ) )
#if not m.payment_mode_id: raise UserError(_("no payment mode found for membership %r",m.partner_id.name) )
account_debit_number = self . _file_format ( str ( m . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
firstname = m . partner_id . firstname
@ -123,7 +123,7 @@ class AccountingFileWizard(models.TransientModel):
lib1 = self . _file_format ( lib1 , 12 )
date_line = self . _date_format ( str ( m . start_date ) )
amount = str ( m . amount )
if not m . product_id . property_account_income_id : raise UserError ( _ ( " no credit account found for product %r " , m . product_id . name ) )
#if not m.product_id.property_account_income_id: raise UserError(_("no credit account found for product %r",m.product_id.name))
account_credit_number = self . _file_format ( m . product_id . property_account_income_id . code , 6 )
affectation = m . product_id . name
@ -159,7 +159,7 @@ class AccountingFileWizard(models.TransientModel):
if registration :
for reg in registration :
reg . date_compta = date_compta
if not reg . invoice_id . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found for payment mode %r " , reg . invoice_id . payment_mode_id ) )
#if not reg.invoice_id.payment_mode_id.fixed_journal_id: raise UserError(_("no account found for payment mode %r",reg.invoice_id.payment_mode_id) )
account_debit_number = self . _file_format ( str ( reg . invoice_id . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
firstname = m . partner_id . firstname
name = m . partner_id . name
@ -167,11 +167,11 @@ class AccountingFileWizard(models.TransientModel):
lib1 = firstname [ 0 ] + ' ' + name
lib1 = self . _file_format ( lib1 , 12 )
#date du paiement
date_line = m . write_date . year + ' - ' + m . write_date . month + ' - ' + m . write_date . day
date_line = str ( m . write_date . year ) + ' - ' + str ( m . write_date . month ) + ' - ' + str ( m . write_date . day )
date_line = self . _date_format ( date_line )
amount = str ( m . amount )
if not reg . event_id . participation_product_id : raise UserError ( _ ( " no credit account found for product %r " , reg . event_id . participation_product_id . name ) )
#if not reg.event_id.participation_product_id: raise UserError(_("no credit account found for product %r",reg.event_id.participation_product_id.name) )
account_credit_number = self . _file_format ( reg . event_id . participation_product_id . property_account_income_id . code , 6 )
affectation = reg . event_id . participation_product_id . name
@ -207,7 +207,7 @@ class AccountingFileWizard(models.TransientModel):
membership_credit_line = False
donation_credit_line = False
reg . date_compta = date_compta
if not reg . event_id . participation_product_id . property_account_income_id : raise UserError ( _ ( " no credit account found for product %r " , reg . event_id . participation_product_id . name ) )
#if not reg.event_id.participation_product_id.property_account_income_id: raise UserError(_("no credit account found for product %r",reg.event_id.participation_product_id.name) )
account_credit_number = self . _file_format ( reg . event_id . participation_product_id . property_account_income_id . code , 6 )
firstname = reg . firstname
@ -223,7 +223,7 @@ class AccountingFileWizard(models.TransientModel):
down_payment = False
balance_payment = False
if not reg . invoice_id . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found payment mode %r " , reg . invoice_id . payment_mode_id . name ) )
#if not reg.invoice_id.payment_mode_id.fixed_journal_id: raise UserError(_("no account found payment mode %r",reg.invoice_id.payment_mode_id.name) )
account_debit_number = self . _file_format ( str ( reg . invoice_id . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
amount = reg . invoice_id . amount_total
#recherche de l'adhésion
@ -250,7 +250,7 @@ class AccountingFileWizard(models.TransientModel):
donation_amount = 0
membership_credit_line = False
donation_credit_line = False
if not reg . down_payment_invoice_id . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found payment mode %r " , reg . down_payment_invoice_id . payment_mode_id . name ) )
#if not reg.down_payment_invoice_id.payment_mode_id.fixed_journal_id: raise UserError(_("no account found payment mode %r",reg.down_payment_invoice_id.payment_mode_id.name) )
account_debit_number = self . _file_format ( str ( reg . down_payment_invoice_id . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
amount = reg . down_payment_invoice_id . amount_total + reg . balance_invoice_id . amount_total
date_line = self . _date_format ( str ( reg . balance_invoice_id . write_date ) )
@ -279,7 +279,7 @@ class AccountingFileWizard(models.TransientModel):
balance_payment = False
donation_credit_line = False
membership_credit_line = False
if not reg . down_payment_invoice_id . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found payment mode %r " , reg . down_payment_invoice_id . payment_mode_id . name ) )
#if not reg.down_payment_invoice_id.payment_mode_id.fixed_journal_id: raise UserError(_("no account found payment mode %r",reg.down_payment_invoice_id.payment_mode_id.name) )
account_debit_number = self . _file_format ( str ( reg . down_payment_invoice_id . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
amount = reg . down_payment_invoice_id . amount_total
date_line = self . _date_format ( str ( reg . down_payment_invoice_id . write_date ) )
@ -289,7 +289,7 @@ class AccountingFileWizard(models.TransientModel):
reg . date_compta = date_compta
down_payment = False
balance_payment = True
if not reg . balance_invoice_id . payment_mode_id . fixed_journal_id : raise UserError ( _ ( " no account found payment mode %r " , reg . balance_invoice_id . payment_mode_id . name ) )
#if not reg.balance_invoice_id.payment_mode_id.fixed_journal_id: raise UserError(_("no account found payment mode %r",reg.balance_invoice_id.payment_mode_id.name) )
account_debit_number = self . _file_format ( str ( reg . down_payment_invoice_id . payment_mode_id . fixed_journal_id . default_account_id . code ) , 6 )
date_line = self . _date_format ( str ( reg . balance_invoice_id . write_date ) )
#recherche de l'adhésion
@ -420,7 +420,7 @@ class AccountingFileWizard(models.TransientModel):
def _file_format ( self , data , nbcars ) :
if data :
if len ( data ) > nbcars :
return data [ nbcars ]
return data [ 0 : nbcars ]
else :
return data
else :