Browse Source

accounting file

master
root 2 years ago
parent
commit
cdcf86e5d0
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      wizard/accounting_file_wizard.py

+ 7
- 7
wizard/accounting_file_wizard.py View File

@ -84,7 +84,7 @@ class AccountingFileWizard(models.TransientModel):
tmstp=secrets.token_hex(16)
filename='/tmp/accounting_file_'+tmstp+'.csv'
f = open(filename, "ab")
f = open(filename, "a",encoding="cp1252")
#N° mouvement 1-5
@ -98,7 +98,7 @@ class AccountingFileWizard(models.TransientModel):
fic_line='"N° mouvement;Code du journal;Date;N° de compte;Libellé;Débit;Crédit;N° de pièce'+'"'+"\n"
fic_line=fic_line.encode(encoding="utf-8",errors='ignore')
#fic_line=fic_line.encode(encoding="cp1252",errors='ignore')
f.write(fic_line)
@ -109,14 +109,14 @@ class AccountingFileWizard(models.TransientModel):
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)
fic_line=fic_line.encode(encoding="utf-8",errors='ignore')
#fic_line=fic_line.encode(encoding="cp1252",errors='ignore')
f.write(fic_line)
f.close
f = open(filename, "r")
data = str.encode(f.read(), 'utf-8')
f = open(filename, "rb")
data = f.read()
#raise UserError('gg'+f.read())
vals={}
vals={}
vals['accounting_file']=base64.encodebytes(data)
vals['document_fname']='export_comptable.csv'
vals['exported_date']=fields.Date.context_today(self)
@ -141,7 +141,7 @@ class AccountingFileWizard(models.TransientModel):
str_line='"'+str(no_mvt)+';'+'IN'+';'+date_line+';'+account_number+';'+lib+';'+debit+';'+credit+';'+lib_piece+'"'+'\n'
return str_line.encode(encoding="utf-8",errors='ignore')
return str_line
def donation_lines(self,f):
global total_debit


Loading…
Cancel
Save