[MERGE] various changes

report_webkit: show labels on form view
account: correctly choose fiscal year on aged partner balance report

bzr revid: mat@openerp.com-20130726113408-c8biwoivuqvkh06m
This commit is contained in:
Martin Trigaux 2013-07-26 13:34:08 +02:00
commit d5edec2e51
3 changed files with 17 additions and 9 deletions

View File

@ -11,7 +11,8 @@
<separator string="Aged Partner Balance"/>
<label string="Aged Partner Balance is a more detailed report of your receivables by intervals. When opening that report, OpenERP asks for the name of the company, the fiscal period and the size of the interval to be analyzed (in days). OpenERP then calculates a table of credit balance by period. So if you request an interval of 30 days OpenERP generates an analysis of creditors for the past month, past two months, and so on. "/>
<group col="4">
<field name="chart_account_id" widget='selection'/>
<field name="chart_account_id" widget='selection' on_change="onchange_chart_id(chart_account_id, context)"/>
<field name="fiscalyear_id" invisible="1"/>
<newline/>
<field name="date_from"/>
<field name="period_length"/>

View File

@ -34,7 +34,10 @@ class account_common_report(osv.osv_memory):
res = {}
if chart_account_id:
company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
res['value'] = {'company_id': company_id}
now = time.strftime('%Y-%m-%d')
domain = [('company_id', '=', company_id), ('date_start', '<', now), ('date_stop', '>', now)]
fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, domain, limit=1)
res['value'] = {'company_id': company_id, 'fiscalyear_id': fiscalyears and fiscalyears[0] or False}
return res
_columns = {
@ -124,10 +127,11 @@ class account_common_report(osv.osv_memory):
now = time.strftime('%Y-%m-%d')
company_id = False
ids = context.get('active_ids', [])
domain = [('date_start', '<', now), ('date_stop', '>', now)]
if ids and context.get('active_model') == 'account.account':
company_id = self.pool.get('account.account').browse(cr, uid, ids[0], context=context).company_id.id
domain += [('company_id', '=', company_id)]
else: # use current company id
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
domain = [('company_id', '=', company_id), ('date_start', '<', now), ('date_stop', '>', now)]
fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, domain, limit=1)
return fiscalyears and fiscalyears[0] or False

View File

@ -7,11 +7,14 @@
<field name="arch" type="xml">
<xpath expr="//page[@string='Security']" position="before" >
<page string="Webkit" attrs="{'invisible':[('report_type','!=','webkit')]}">
<field name="webkit_header"/>
<field name="webkit_debug"/>
<field name="precise_mode"/>
<separator string="Webkit Template (used if Report File is not found)" colspan="4"/>
<field name="report_webkit_data" colspan="4" nolabel="1"/>
<group>
<field name="webkit_header"/>
<field name="webkit_debug"/>
<field name="precise_mode"/>
</group>
<group string="Webkit Template (used if Report File is not found)">
<field name="report_webkit_data" nolabel="1"/>
</group>
</page>
</xpath>
</field>