[FIX] Wizard layout cleaning + translation
parent
185e444aaa
commit
ddc60f1de7
|
@ -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',
|
||||
|
|
|
@ -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 ""
|
||||
|
|
@ -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"
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<menuitem
|
||||
icon="STOCK_EXECUTE"
|
||||
name="Accounting Entries CSV Export"
|
||||
name="Accounting CSV Export"
|
||||
action="action_account_csv_export"
|
||||
id="menu_account_csv_export"
|
||||
parent="account.menu_finance_reports"
|
||||
|
|
|
@ -27,6 +27,7 @@ import csv
|
|||
import codecs
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
class AccountUnicodeWriter(object):
|
||||
|
@ -71,26 +72,30 @@ class AccountUnicodeWriter(object):
|
|||
self.writerow(row)
|
||||
|
||||
|
||||
# TODO / Improve: Choose a fiscal year !
|
||||
class AccountCSVExport(orm.TransientModel):
|
||||
_name = 'account.csv.export'
|
||||
_description = 'Export Accounting Entries'
|
||||
_description = 'Export Accounting'
|
||||
|
||||
_columns = {
|
||||
'data': fields.binary('CSV',readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', invisible=True),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscalyear', required=True),
|
||||
'start_period_id': fields.many2one('account.period', 'Starting period', required=True),
|
||||
'stop_period_id': fields.many2one('account.period', 'End period', required=True),
|
||||
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
|
||||
'export_filename': fields.char('Export CSV Filename', size=128),
|
||||
}
|
||||
|
||||
def _get_company_default(self, cr, uid, context=None):
|
||||
comp_obj = self.pool['res.company']
|
||||
fiscalyear_obj = self.pool['account.fiscalyear']
|
||||
return comp_obj._company_default_get(cr, uid, 'account.fiscalyear', context=context)
|
||||
|
||||
def _get_fiscalyear_default(self, cr, uid, context=None):
|
||||
fiscalyear_obj = self.pool['account.fiscalyear']
|
||||
context['company_id'] = self._get_company_default(cr, uid, context)
|
||||
return fiscalyear_obj.find(cr,uid,dt=None,exception=True, context=context)
|
||||
|
||||
_defaults = {'company_id': _get_company_default}
|
||||
_defaults = {'company_id': _get_company_default,
|
||||
'fiscalyear_id' : _get_fiscalyear_default,
|
||||
'export_filename' : 'account_export.csv'}
|
||||
|
||||
|
||||
def action_manual_export(self, cr, uid, ids, context=None):
|
||||
|
@ -118,13 +123,11 @@ class AccountCSVExport(orm.TransientModel):
|
|||
|
||||
|
||||
def _get_header(self, cr, uid, ids, context=None):
|
||||
return [u'account_id',
|
||||
u'code',
|
||||
u'name'
|
||||
u'si',
|
||||
u'sum_debit',
|
||||
u'sum_credit',
|
||||
u'balance',
|
||||
return [_(u'CODE'),
|
||||
_(u'NAME'),
|
||||
_(u'DEBIT'),
|
||||
_(u'CREDIT'),
|
||||
_(u'BALANCE'),
|
||||
]
|
||||
|
||||
def _get_rows(self, cr, uid, ids, fiscalyear_id,period_range_ids,company_id,context=None):
|
||||
|
@ -132,7 +135,7 @@ class AccountCSVExport(orm.TransientModel):
|
|||
Return list to generate rows of the CSV file
|
||||
"""
|
||||
cr.execute("""
|
||||
select ac.id,ac.code,ac.name,
|
||||
select 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
|
||||
where aml.account_id = ac.id
|
||||
|
@ -149,36 +152,20 @@ class AccountCSVExport(orm.TransientModel):
|
|||
rows.append(list(line))
|
||||
return rows
|
||||
|
||||
def get_period_range(self,cr,uid,start_period_id,stop_period_id,company_id,context=None):
|
||||
context = context or {}
|
||||
## Get period for this company_id
|
||||
period_obj = self.pool.get('account.period')
|
||||
date_start = period_obj.browse(cr,uid,start_period_id).date_start
|
||||
date_stop = period_obj.browse(cr,uid,stop_period_id).date_stop
|
||||
start_period_ids = period_obj.search(cr, uid,
|
||||
[('date_start', '>=', 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))
|
||||
|
|
|
@ -7,24 +7,23 @@
|
|||
<field name="model">account.csv.export</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Accounting Entries CSV Export">
|
||||
<form string="Accounting CSV Export">
|
||||
<group colspan="4">
|
||||
<field name="company_id" />
|
||||
<field name="fiscalyear_id" domain="[('company_id', '=', company_id)]"/>
|
||||
</group>
|
||||
<group colspan="4" col="2">
|
||||
<field name="start_period_id" domain="[('state', '=', 'draft'),('special','=',False),('fiscalyear_id','=',fiscalyear_id)]"/>
|
||||
<field name="stop_period_id" domain="[('state', '=', 'draft'),('special','=',False),('fiscalyear_id','=',fiscalyear_id)]"/>
|
||||
<field name="periods" domain="[('state', '=', 'draft'),('fiscalyear_id','=',fiscalyear_id)]"/>
|
||||
</group>
|
||||
<separator string ="" colspan="4"/>
|
||||
<group colspan="4" col="3">
|
||||
<button special="cancel" string="Close" icon="gtk-cancel"/>
|
||||
<button name="action_manual_export" string="Create export : Trial Balance" type="object" icon="gtk-execute"/>
|
||||
<button name="action_manual_export_analytic" string="Create export : Analytic Balance" type="object" icon="gtk-execute"/>
|
||||
<button name="action_manual_export" string="Trial Balance" type="object" icon="gtk-execute"/>
|
||||
<button name="action_manual_export_analytic" string="Analytic Balance (with accounts)" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
<separator string ="" colspan="4"/>
|
||||
<group colspan="4">
|
||||
<field name="data"/>
|
||||
<field name="data" filename="export_filename"/>
|
||||
</group>
|
||||
|
||||
</form>
|
||||
|
@ -32,7 +31,7 @@
|
|||
</record>
|
||||
|
||||
<record id="action_account_csv_export" model="ir.actions.act_window">
|
||||
<field name="name">Accounting Entries CSV Export</field>
|
||||
<field name="name">Accounting CSV Export</field>
|
||||
<field name="res_model">account.csv.export</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
Loading…
Reference in New Issue