[IMP] Account: Add target moves (all entires or posted) on account balance report

bzr revid: mra@mra-laptop-20100914134831-x9f9bol41rdaz57d
This commit is contained in:
Mustufa Rangwala 2010-09-14 19:18:31 +05:30
parent 45e6a04014
commit 98006b583e
3 changed files with 15 additions and 6 deletions

View File

@ -69,19 +69,19 @@ class account_balance(report_sxw.rml_parse, common_report_header):
return super(account_balance ,self)._get_account(data)
def lines(self, form, ids=[], done=None):#, level=1):
def _process_child(accounts,disp_acc,parent):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
res = {
'id': account_rec['id'],
'type': account_rec['type'],
'type': account_rec['type'],
'code': account_rec['code'],
'name': account_rec['name'],
'level': account_rec['level'],
'debit': account_rec['debit'],
'credit': account_rec['credit'],
'balance': account_rec['balance'],
'parent_id':account_rec['parent_id'],
'bal_type':'',
'parent_id': account_rec['parent_id'],
'bal_type': '',
}
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
@ -96,7 +96,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
if account_rec['child_id']:
for child in account_rec['child_id']:
_process_child(accounts,disp_acc,child)
obj_account = self.pool.get('account.account')
if not ids:
ids = self.ids
@ -113,6 +113,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
elif form['filter'] == 'filter_date':
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
ctx['state'] = form['target_move']
parents = ids
child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
if child_ids:

View File

@ -21,15 +21,21 @@
from lxml import etree
from osv import osv
from osv import osv, fields
class account_balance_report(osv.osv_memory):
_inherit = "account.common.account.report"
_name = 'account.balance.report'
_description = 'Account Balance Report'
_columns = {
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'journal_ids': [],
'target_move': 'all'
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@ -45,6 +51,7 @@ class account_balance_report(osv.osv_memory):
def _print_report(self, cr, uid, ids, data, query_line, context=None):
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['target_move'])[0])
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
account_balance_report()

View File

@ -11,6 +11,7 @@
<field name="arch" type="xml">
<field name="fiscalyear_id" position="after">
<field name="display_account"/>
<field name="target_move"/>
<newline/>
</field>
</field>