From d29db57d0f9368b7ed556d5fc5953685f2f2b6f8 Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Thu, 11 Apr 2013 07:55:55 +0200 Subject: [PATCH] [FIX] Wizard layout cleaning + translation --- account_export_csv/__openerp__.py | 8 +- account_export_csv/i18n/account_export_csv.po | 111 ++++++++++++++++++ account_export_csv/i18n/fr.po | 74 ++++++++++++ account_export_csv/menu.xml | 2 +- .../wizard/account_export_csv.py | 99 +++++++--------- .../wizard/account_export_csv_view.xml | 13 +- 6 files changed, 241 insertions(+), 66 deletions(-) create mode 100644 account_export_csv/i18n/account_export_csv.po create mode 100644 account_export_csv/i18n/fr.po diff --git a/account_export_csv/__openerp__.py b/account_export_csv/__openerp__.py index e6fec155..aaa14f9e 100644 --- a/account_export_csv/__openerp__.py +++ b/account_export_csv/__openerp__.py @@ -27,7 +27,13 @@ 'author' : 'Camptocamp', 'description': """ - Add a wizard that allow you to export a csv file of all the accounting entries. + Add a wizard that allow you to export a csv file based on accounting journal entries + + - Trial Balance + - Analytic Balance (with accounts) + + You can filter by period + """, 'website': 'http://www.camptocamp.com', diff --git a/account_export_csv/i18n/account_export_csv.po b/account_export_csv/i18n/account_export_csv.po new file mode 100644 index 00000000..790827a5 --- /dev/null +++ b/account_export_csv/i18n/account_export_csv.po @@ -0,0 +1,111 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_export_csv +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-04-10 15:11+0000\n" +"PO-Revision-Date: 2013-04-10 15:11+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_export_csv +#: model:ir.model,name:account_export_csv.model_account_csv_export +msgid "Export Accounting" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,export_filename:0 +msgid "Export CSV Filename" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Trial Balance" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,company_id:0 +msgid "Company" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Analytic Balance (with accounts)" +msgstr "" + +#. module: account_export_csv +#: help:account.csv.export,periods:0 +msgid "All periods in the fiscal year if empty" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,periods:0 +msgid "Periods" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Close" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +#: model:ir.actions.act_window,name:account_export_csv.action_account_csv_export +#: model:ir.ui.menu,name:account_export_csv.menu_account_csv_export +msgid "Accounting CSV Export" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,data:0 +msgid "CSV" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,fiscalyear_id:0 +msgid "Fiscalyear" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Analytic Balance (with accounts)" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,stop_period_id:0 +msgid "End period" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Close" +msgstr "" + +#. module: account_export_csv +#: view:account.csv.export:0 +#: model:ir.actions.act_window,name:account_export_csv.action_account_csv_export +#: model:ir.ui.menu,name:account_export_csv.menu_account_csv_export +msgid "Accounting CSV Export" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,data:0 +msgid "CSV" +msgstr "" + +#. module: account_export_csv +#: model:ir.model,name:account_export_csv.model_account_csv_export +msgid "Export Accounting Entries" +msgstr "" + +#. module: account_export_csv +#: field:account.csv.export,fiscalyear_id:0 +msgid "Fiscalyear" +msgstr "" + diff --git a/account_export_csv/i18n/fr.po b/account_export_csv/i18n/fr.po new file mode 100644 index 00000000..c6aaa766 --- /dev/null +++ b/account_export_csv/i18n/fr.po @@ -0,0 +1,74 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_export_csv +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-04-10 15:11+0000\n" +"PO-Revision-Date: 2013-04-10 15:11+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_export_csv +#: model:ir.model,name:account_export_csv.model_account_csv_export +msgid "Export Accounting" +msgstr "Export comptable" + +#. module: account_export_csv +#: field:account.csv.export,export_filename:0 +msgid "Export CSV Filename" +msgstr "Nom du fichier CSV d'export" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Trial Balance" +msgstr "Balance générale" + +#. module: account_export_csv +#: field:account.csv.export,company_id:0 +msgid "Company" +msgstr "Société" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Analytic Balance (with accounts)" +msgstr "Balance analytique (avec comptes)" + +#. module: account_export_csv +#: help:account.csv.export,periods:0 +msgid "All periods in the fiscal year if empty" +msgstr "Toutes les périodes de l'année fiscale si vide" + +#. module: account_export_csv +#: field:account.csv.export,periods:0 +msgid "Periods" +msgstr "Périodes" + +#. module: account_export_csv +#: view:account.csv.export:0 +msgid "Close" +msgstr "Fermer" + +#. module: account_export_csv +#: view:account.csv.export:0 +#: model:ir.actions.act_window,name:account_export_csv.action_account_csv_export +#: model:ir.ui.menu,name:account_export_csv.menu_account_csv_export +msgid "Accounting CSV Export" +msgstr "Export comptable CSV" + +#. module: account_export_csv +#: field:account.csv.export,data:0 +msgid "CSV" +msgstr "CSV" + +#. module: account_export_csv +#: field:account.csv.export,fiscalyear_id:0 +msgid "Fiscalyear" +msgstr "Année fiscale" + diff --git a/account_export_csv/menu.xml b/account_export_csv/menu.xml index 19232542..5dcb4339 100644 --- a/account_export_csv/menu.xml +++ b/account_export_csv/menu.xml @@ -4,7 +4,7 @@ =', date_start), - ('company_id', '=', company_id)] - ) - stop_period_ids = period_obj.search(cr, uid, - [('date_stop', '<=', date_stop), - ('company_id', '=', company_id)] - ) - ## Get only period present in start_period_ids and stop_period_ids - matching_period = list(set(start_period_ids).intersection(set(stop_period_ids))) - return matching_period def get_data(self, cr, uid, ids, context=None): - context = context or {} - context['lang'] = 'fr_FR' - form = self.browse(cr, uid, ids[0], context=context) - - start_period_id = form.start_period_id.id - stop_period_id = form.stop_period_id.id fiscalyear_id = form.fiscalyear_id.id user_obj = self.pool.get('res.users') company_id = user_obj.browse(cr, uid, uid).company_id.id - period_range_ids = self.get_period_range(cr, uid, start_period_id, stop_period_id,company_id,context) + # Get periods + p_obj = self.pool.get("account.period") + # + if form.periods: + period_range_ids = [x.id for x in form.periods] + else: + p_obj = self.pool.get("account.period") + period_range_ids = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear_id)],context=context) rows = [] rows.append(self._get_header(cr, uid, ids, context=context)) rows.extend(self._get_rows(cr, uid, ids, fiscalyear_id,period_range_ids,company_id, context=context)) @@ -210,15 +197,13 @@ class AccountCSVExport(orm.TransientModel): def _get_header_analytic(self, cr, uid, ids, context=None): - return [u'account_id', - u'analytic_account_id', - u'code', - u'name', - u'analytic_code', - u'analytic_name', - u'sum_debit', - u'sum_credit', - u'balance', + return [_(u'ANALYTIC CODE'), + _(u'ANALYTIC NAME'), + _(u'CODE'), + _(u'ACCOUNT NAME'), + _(u'DEBIT'), + _(u'CREDIT'), + _(u'BALANCE'), ] @@ -229,14 +214,14 @@ class AccountCSVExport(orm.TransientModel): Return list to generate rows of the CSV file """ cr.execute(""" - select ac.id,ac.code,ac.name,aac.id,aac.code as analytic_code,aac.name as analytic_name, + select aac.code as analytic_code,aac.name as analytic_name,ac.code,ac.name, sum(debit) as sum_debit,sum(credit) as sum_credit,sum(debit) - sum(credit) as balance from account_move_line as aml,account_account as ac,account_analytic_account as aac where aml.account_id = ac.id and aml.analytic_account_id = aac.id and period_id in %(period_ids)s - group by ac.id,ac.code,aac.id,aac.code - order by ac.code + group by aac.id,aac.code,ac.id,ac.code + order by aac.code """, {'fiscalyear_id': fiscalyear_id,'company_id':company_id,'period_ids':tuple(period_range_ids)} ) @@ -249,17 +234,17 @@ class AccountCSVExport(orm.TransientModel): def get_data_analytic(self, cr, uid, ids, context=None): - context = context or {} - context['lang'] = 'fr_FR' - form = self.browse(cr, uid, ids[0], context=context) - - start_period_id = form.start_period_id.id - stop_period_id = form.stop_period_id.id fiscalyear_id = form.fiscalyear_id.id user_obj = self.pool.get('res.users') company_id = user_obj.browse(cr, uid, uid).company_id.id - period_range_ids = self.get_period_range(cr, uid, start_period_id, stop_period_id,company_id,context) + # Get periods + # + if form.periods: + period_range_ids = [x.id for x in form.periods] + else: + p_obj = self.pool.get("account.period") + period_range_ids = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear_id)],context=context) rows = [] rows.append(self._get_header_analytic(cr, uid, ids, context=context)) rows.extend(self._get_rows_analytic(cr, uid, ids, fiscalyear_id,period_range_ids,company_id, context=context)) diff --git a/account_export_csv/wizard/account_export_csv_view.xml b/account_export_csv/wizard/account_export_csv_view.xml index b3805383..ff57e07b 100644 --- a/account_export_csv/wizard/account_export_csv_view.xml +++ b/account_export_csv/wizard/account_export_csv_view.xml @@ -7,24 +7,23 @@ account.csv.export form -
+ - - +