|
|
@ -20,6 +20,13 @@ class AccountingFileWizard(models.TransientModel): |
|
|
|
|
|
|
|
start_date=fields.Datetime('start date',required=True,default=lambda self: self._compute_start_date()) |
|
|
|
debug_mode=fields.Boolean('debug mode',default=True) |
|
|
|
export_donation_lines=fields.Boolean('export donation lines',default=True) |
|
|
|
export_membership_lines=fields.Boolean('export_membership_lines',default=True) |
|
|
|
export_event_lines=fields.Boolean('export_event_lines',default=True) |
|
|
|
export_booking_event_lines=fields.Boolean('export_booking_event_lines',default=True) |
|
|
|
export_out_refund_lines=fields.Boolean('export_out_refund_lines',default=True) |
|
|
|
export_end_of_stay_lines=fields.Boolean('export_end_of_stay_lines',default=True) |
|
|
|
|
|
|
|
def _compute_start_date(self): |
|
|
|
date_max=[] |
|
|
|
#recherche de la date d'export d'écriture la plus récente |
|
|
@ -95,12 +102,12 @@ class AccountingFileWizard(models.TransientModel): |
|
|
|
f.write(fic_line) |
|
|
|
|
|
|
|
|
|
|
|
self.donation_lines(f) |
|
|
|
self.membership_lines(f) |
|
|
|
self.event_lines(f) |
|
|
|
self.booking_event_lines(f) |
|
|
|
self.out_refund_lines(f) |
|
|
|
self.end_of_stay_lines(f) |
|
|
|
if self.export_donation_lines:self.donation_lines(f) |
|
|
|
if self.export_membership_lines:self.membership_lines(f) |
|
|
|
if self.export_event_lines:self.event_lines(f) |
|
|
|
if self.export_booking_event_lines:self.booking_event_lines(f) |
|
|
|
if self.export_out_refund_lines:self.out_refund_lines(f) |
|
|
|
if self.export_end_of_stay_lines:self.end_of_stay_lines(f) |
|
|
|
fic_line="TOTAL_DEBIT="+str(total_debit)+ " TOTAL CREDIT="+str(total_credit) |
|
|
|
f.write(fic_line) |
|
|
|
|
|
|
@ -775,11 +782,16 @@ class AccountingFileWizard(models.TransientModel): |
|
|
|
reg=self.env['event.registration'].search(['|',('invoice_id','=',int(invoice.out_invoice_id)),('balance_invoice_id','=',int(invoice.out_invoice_id))]) |
|
|
|
if reg: |
|
|
|
lib2=self._file_format(reg.event_id.name,13) |
|
|
|
|
|
|
|
else: |
|
|
|
lib2=self._file_format(invoice.payment_reference,13) |
|
|
|
|
|
|
|
|
|
|
|
lib=lib1+' '+lib2 |
|
|
|
|
|
|
|
lib_piece=self._file_format(invoice.out_invoice_id.name,20) |
|
|
|
if reg: |
|
|
|
lib_piece=self._file_format(invoice.out_invoice_id.name,20) |
|
|
|
else : |
|
|
|
lib_piece=self._file_format(invoice.name,20) |
|
|
|
|
|
|
|
|
|
|
|
#écriture de débit |
|
|
|
amount=invoice.amount_total |
|
|
@ -802,7 +814,12 @@ class AccountingFileWizard(models.TransientModel): |
|
|
|
#écriture de crédit |
|
|
|
debit='' |
|
|
|
credit=str(amount) |
|
|
|
account_credit_number='170000' |
|
|
|
if reg: |
|
|
|
account_credit_number='170000' |
|
|
|
else: |
|
|
|
|
|
|
|
account_credit_number=self._payment_account_number(invoice) |
|
|
|
|
|
|
|
fic_line=str(no_mvt)+';'+'IN'+';'+date_line+';'+account_credit_number+';'+lib+';'+debit+';'+credit+';'+lib_piece+'\n' |
|
|
|
f.write(fic_line) |
|
|
|
no_mvt+=1 |
|
|
@ -855,6 +872,25 @@ class AccountingFileWizard(models.TransientModel): |
|
|
|
else: |
|
|
|
return 'False' |
|
|
|
else:return 'False' |
|
|
|
|
|
|
|
def _payment_account_number(self,move_id): |
|
|
|
if move_id.invoice_payments_widget: |
|
|
|
payment_info=json.loads(move_id.invoice_payments_widget) |
|
|
|
|
|
|
|
|
|
|
|
if payment_info: |
|
|
|
|
|
|
|
account_payment_id=payment_info['content'][0]['account_payment_id'] |
|
|
|
|
|
|
|
#payment_mode_id.fixed_journal_id.default_account_id.code |
|
|
|
account_number=self.env['account.payment'].search([('id','=',int(account_payment_id))]).journal_id.default_account_id.code |
|
|
|
|
|
|
|
return account_number |
|
|
|
|
|
|
|
else: |
|
|
|
return '' |
|
|
|
else:return '' |
|
|
|
|
|
|
|
def _date_format(self,data): |
|
|
|
#_logger.error('date='+str(data)) |
|
|
|
if data: |
|
|
|