X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=wizard%2Faccount_export_csv.py;fp=wizard%2Faccount_export_csv.py;h=2cab3bd3c376e09661408172ce861057a18d345e;hb=1249406b0e1676d027a6fa6d4efce39f0abb772e;hp=161bcf7b116fbbaf922c6bfece1e3b4f53c27166;hpb=ab75af5bd69a5bb64d8d87e567625260ba1551eb;p=burette%2Fetudesetchantiersidf.git diff --git a/wizard/account_export_csv.py b/wizard/account_export_csv.py index 161bcf7..2cab3bd 100644 --- a/wizard/account_export_csv.py +++ b/wizard/account_export_csv.py @@ -32,7 +32,6 @@ import calendar import datetime import string -import openerp.exceptions from openerp.osv import osv from openerp.tools.translate import _ from openerp.addons.account_export_csv.wizard.account_export_csv import AccountUnicodeWriter @@ -118,10 +117,6 @@ class AccountCSVExport(osv.osv_memory): journal_ids, account_ids=None, context=None): - fiscalyear_obj = self.pool.get('account.fiscalyear') - fiscalyear_code = fiscalyear_obj.browse(cr, uid, fiscalyear_id, context=context) - fiscalyear_code = fiscalyear_obj.browse(cr, uid, fiscalyear_id, context=context).code - period_obj = self.pool.get('account.period') journal_obj = self.pool.get('account.journal') account_obj = self.pool.get('account.account') @@ -156,7 +151,7 @@ class AccountCSVExport(osv.osv_memory): 'journal_ids': tuple(journal_ids), 'account_ids': tuple(account_ids), } - ) + ) res = cr.fetchall() rows = [] for line in res: @@ -169,12 +164,14 @@ class AccountCSVExport(osv.osv_memory): year = int(period.code[3:7]) month = int(period.code[0:2]) day = calendar.monthrange(year, month)[1] - dico['date'] = datetime.datetime(year, month, day).strftime("%d/%m/%Y") + dico['date'] = datetime.datetime(year, month, day).strftime( + "%d/%m/%Y") account = account_obj.browse(cr, uid, line[2], context=context) dico['account_code'] = account.code - preformatted_client_name = journal.name.split(" - ", 1)[1].upper().replace(' ','') + preformatted_client_name = journal.name.split(" - ", 1)[1].upper().replace(' ', '') for char in string.punctuation: - preformatted_client_name = preformatted_client_name.replace(char,'') + preformatted_client_name = preformatted_client_name.replace( + char, '') dico['client_name'] = preformatted_client_name if account.type in ("receivable", "payable"): dico['compte_tiers'] = dico['client_name'] @@ -191,9 +188,8 @@ class AccountCSVExport(osv.osv_memory): row = self.format_row_sage(dico, numero_piece, "C") rows.append(row) account_type = account_type_obj.browse( - cr, uid, account.user_type.id, context=context - ) - if account_type.code in ("expense","income"): + cr, uid, account.user_type.id, context=context) + if account_type.code in ("expense", "income"): dico['general_analytic'] = "A" dico['analytic_account'] = journal.code[3:] if dico['debit']: