[IMP] move fields view get method to common for balance and generl ledger report
bzr revid: mra@mra-laptop-20100715104015-5cwh0cwqcdl9fq7h
This commit is contained in:
@@ -18,7 +18,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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':
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
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
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user