2014-09-26 92 views
0

我爲資產負債表創建了一份碧玉報告,我看到以下文件: 「addons \ account \ report \ account_financial_report.py」有一個方法可以獲取我的報告所需的全部信息,所以我想創建一個可以獲取該方法的模塊(get_lines),並可以從該值生成新的報告。openerp繼承自report_account_common

可能嗎?該文件具有以下內容:

class report_account_common(report_sxw.rml_parse, common_report_header): 
    def __init__(self, cr, uid, name, context=None): 
     super(report_account_common, self).__init__(cr, uid, name, context=context) 
     self.localcontext.update({ 
      'get_lines': self.get_lines, 
      'time': time, 
      'get_fiscalyear': self._get_fiscalyear, 
      'get_account': self._get_account, 
      'get_start_period': self.get_start_period, 
      'get_end_period': self.get_end_period, 
      'get_filter': self._get_filter, 
      'get_start_date':self._get_start_date, 
      'get_end_date':self._get_end_date, 
      'get_target_move': self._get_target_move, 
     }) 
     self.context = context 

    def set_context(self, objects, data, ids, report_type=None): 
     new_ids = ids 
     if (data['model'] == 'ir.ui.menu'): 
      new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or [] 
      objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) 
     return super(report_account_common, self).set_context(objects, data, new_ids, report_type=report_type) 

    def get_lines(self, data): 
     lines = [] 
     account_obj = self.pool.get('account.account') 
     ..... more code ...... 

所以我想調用get_lines方法並使用返回的值進行操作。

在此先感謝。

回答

0

您可以從account_financial_report繼承,然後調用函數:

def yourFunction(data): 

--- your code---- 

return super(account_financial_report, self).get_lines(data) 

調用函數來獲得在你需要它的值。