[IMP] Account: added selection to dispaly all the partners or only partners with non-zero balance on partner balance report wizard
bzr revid: pap@tinyerp.co.in-20100901050420-7jyu1o7nh0qyrjbv
This commit is contained in:
@@ -100,10 +100,11 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
||||
## Compute Code
|
||||
#
|
||||
self.initial_balance = data['form'].get('initial_balance', True)
|
||||
self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
|
||||
self.query = data['form'].get('query_line', '')
|
||||
self.init_query = data['form'].get('initial_bal_query', '')
|
||||
self.result_selection = data['form'].get('result_selection')
|
||||
|
||||
|
||||
if (self.result_selection == 'customer' ):
|
||||
self.ACCOUNT_TYPE = ('receivable',)
|
||||
elif (self.result_selection == 'supplier'):
|
||||
@@ -205,9 +206,12 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
||||
res_init['enlitige'] = 0.0 # fix me
|
||||
res_init['account_id'] = r['account_id']
|
||||
final_init[r['account_id']] = res_init
|
||||
for r in res:
|
||||
full_account.append(r)
|
||||
|
||||
|
||||
if self.display_partner == 'non-zero_balance':
|
||||
full_account = [r for r in res if r['sdebit'] > 0 or r['scredit'] > 0]
|
||||
else:
|
||||
full_account = [r for r in res]
|
||||
|
||||
## We will now compute Total
|
||||
subtotal_row = self._add_subtotal(full_account)
|
||||
if not self.initial_balance:
|
||||
|
||||
@@ -31,16 +31,19 @@ class account_partner_balance(osv.osv_memory):
|
||||
_columns = {
|
||||
'initial_balance': fields.boolean('Include Initial Balances'
|
||||
,help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
|
||||
'display_partner': fields.selection([('non-zero_balance', 'With balance is not equal to 0'), ('all', 'All Partners')]
|
||||
,'Display Partners')
|
||||
}
|
||||
_defaults = {
|
||||
'initial_balance': True,
|
||||
'display_partner': 'non-zero_balance'
|
||||
}
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
|
||||
data['form'].update(self.read(cr, uid, ids, ['initial_balance'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'display_partner'])[0])
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<field name="fiscalyear_id" position="after">
|
||||
<field name="result_selection"/>
|
||||
<field name="initial_balance"/>
|
||||
<field name="display_partner"/>
|
||||
<newline/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user