diff --git a/addons/account/wizard/account_common_report.py b/addons/account/wizard/account_common_report.py index 56c13eb5e75..45f9111cb83 100644 --- a/addons/account/wizard/account_common_report.py +++ b/addons/account/wizard/account_common_report.py @@ -18,7 +18,9 @@ # along with this program. If not, see . # ############################################################################## + import time +from lxml import etree from osv import fields, osv from tools.translate import _ @@ -55,6 +57,18 @@ class account_common_report(osv.osv_memory): # else: # return company_obj.search(cr, uid, [('parent_id', '=', False)])[0] + 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_common_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) + if context.get('active_model', False) == 'account.account' and view_id: + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='chart_account_id']") + for node in nodes: + node.set('readonly', '1') + node.set('help', 'If you print the report from Account list/form view it will not consider Charts of account') + res['arch'] = etree.tostring(doc) + return res + def onchange_filter(self, cr, uid, ids, filter='filter_no', context=None): res = {} if filter == 'filter_no': diff --git a/addons/account/wizard/account_report_balance.py b/addons/account/wizard/account_report_balance.py index 960679f7fb7..8c1209f8143 100644 --- a/addons/account/wizard/account_report_balance.py +++ b/addons/account/wizard/account_report_balance.py @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## -from lxml import etree from osv import osv, fields from tools.translate import _ @@ -37,18 +36,6 @@ class account_balance_report(osv.osv_memory): 'display_account': 'bal_all' } - 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) - if context.get('active_model', False) == 'account.account' and view_id: - doc = etree.XML(res['arch']) - nodes = doc.xpath("//field[@name='chart_account_id']") - for node in nodes: - node.set('readonly', '1') - node.set('help', 'If you print the report from Account list/form view it will not consider Charts of account') - res['arch'] = etree.tostring(doc) - return res - def _print_report(self, cr, uid, ids, data, query_line, context=None): data['form'].update(self.read(cr, uid, ids, ['display_account'])[0]) data['form']['query_line'] = query_line diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py index 18650a7e64c..c75e076e560 100644 --- a/addons/account/wizard/account_report_general_ledger.py +++ b/addons/account/wizard/account_report_general_ledger.py @@ -19,8 +19,6 @@ # ############################################################################## -from lxml import etree - from osv import fields, osv from tools.translate import _ @@ -43,18 +41,6 @@ class account_report_general_ledger(osv.osv_memory): 'sortby': 'sort_date', } - 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_report_general_ledger, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) - if context.get('active_model', False) == 'account.account' and view_id: - doc = etree.XML(res['arch']) - nodes = doc.xpath("//field[@name='chart_account_id']") - for node in nodes: - node.set('readonly', '1') - node.set('help', 'If you print the report from Account list/form view it will not consider Charts of account') - res['arch'] = etree.tostring(doc) - return res - def _print_report(self, cr, uid, ids, data, query_line, context=None): if context is None: context = {}