[REF] account :Improve fields_view_get
bzr revid: ara@tinyerp.com-20101227124530-pnzjbkknemkt2ppy
This commit is contained in:
parent
d0cddcdea2
commit
fc81ca6a69
|
@ -32,17 +32,6 @@ class account_balance_report(osv.osv_memory):
|
|||
'journal_ids': [],
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
res = super(account_balance_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
<field name="inherit_id" ref="account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='journal_ids']" position="replace">
|
||||
<field name="journal_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Trial Balance" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your trial balance allowing you to quickly check the balance of each of your accounts in a single report"/>
|
||||
|
|
|
@ -44,16 +44,6 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
'direction_selection': 'past',
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_aged_trial_balance, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('invisible', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<field name="direction_selection"/>
|
||||
<field name="journal_ids"/>
|
||||
<field name="journal_ids" invisible="1"/>
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
|
|
|
@ -40,21 +40,6 @@ class account_pl_report(osv.osv_memory):
|
|||
'target_move': False
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
res = super(account_pl_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
nodes = doc.xpath("//field[@name='target_move']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
<field name="inherit_id" ref="account.account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='target_move']" position="replace">
|
||||
<field name="target_move" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='journal_ids']" position="replace">
|
||||
<field name="journal_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Profit And Loss" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="The Profit and Loss report gives you an overview of your company profit and loss in a single document"/>
|
||||
|
|
Loading…
Reference in New Issue