parent
d30fcabd9e
commit
49ef2165cd
|
@ -33,6 +33,10 @@ class res_company(osv.osv):
|
|||
'credit_account_ids':fields.many2many('account.account',
|
||||
'credit_account_company_rel',
|
||||
'company_id', 'account_id',
|
||||
'Accounts'),
|
||||
'Creditable Accounts'),
|
||||
'debit_account_ids':fields.many2many('account.account',
|
||||
'debit_account_company_rel',
|
||||
'company_id', 'account_id',
|
||||
'Debitable Accounts'),
|
||||
}
|
||||
res_company()
|
||||
|
|
|
@ -150,9 +150,12 @@ class account_balance(report_sxw.rml_parse):
|
|||
rc_obj = self.pool.get('res.company')
|
||||
return rc_obj.browse(self.cr, self.uid, company_id).currency_id.id
|
||||
|
||||
def get_company_credit_accounts(self, company_id):
|
||||
def get_company_accounts(self, company_id, acc='credit'):
|
||||
rc_obj = self.pool.get('res.company')
|
||||
return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).credit_account_ids]
|
||||
if acc=='credit':
|
||||
return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).credit_account_ids]
|
||||
else:
|
||||
return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).debit_account_ids]
|
||||
|
||||
def lines(self, form, level=0):
|
||||
"""
|
||||
|
@ -257,9 +260,14 @@ class account_balance(report_sxw.rml_parse):
|
|||
account_ids = form['account_list']
|
||||
del form['account_list']
|
||||
|
||||
credit_account_ids = self.get_company_credit_accounts(form['company_id'] and type(form['company_id']) in (list,tuple) and form['company_id'][0] or form['company_id'])
|
||||
|
||||
credit_account_ids = self.get_company_accounts(form['company_id'] and type(form['company_id']) in (list,tuple) and form['company_id'][0] or form['company_id'],'credit')
|
||||
|
||||
print 'Primer print de credit_account_ids ', credit_account_ids
|
||||
|
||||
|
||||
debit_account_ids = self.get_company_accounts(form['company_id'] and type(form['company_id']) in (list,tuple) and form['company_id'][0] or form['company_id'],'debit')
|
||||
|
||||
print 'Primer print de debit_account_ids ', debit_account_ids
|
||||
|
||||
if form.get('fiscalyear'):
|
||||
if type(form.get('fiscalyear')) in (list,tuple):
|
||||
|
@ -278,6 +286,16 @@ class account_balance(report_sxw.rml_parse):
|
|||
|
||||
print 'credit_account_ids ', credit_account_ids
|
||||
|
||||
debit_account_ids = _get_children_and_consol(self.cr, self.uid, debit_account_ids, 100,self.context,change_sign=True)
|
||||
|
||||
print 'debit_account_ids ', debit_account_ids
|
||||
|
||||
|
||||
credit_account_ids = list(set(credit_account_ids) - set(debit_account_ids))
|
||||
|
||||
print 'Segundo print de credit_account_ids ', credit_account_ids
|
||||
|
||||
|
||||
#
|
||||
# Generate the report lines (checking each account)
|
||||
#
|
||||
|
|
|
@ -8,15 +8,36 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Credit Accounts" position="inside">
|
||||
<separator string="Reverse sign on Reports for these accounts and children accounts" colspan="4"/>
|
||||
<field name="credit_account_ids" nolabel="1" colspan ="4" domain="[('company_id.name','=',name),('company_id.partner_id','=',partner_id),]">
|
||||
<tree>
|
||||
<field name='code'/>
|
||||
<field name='name'/>
|
||||
<field name='type'/>
|
||||
</tree>
|
||||
</field>
|
||||
<page string="Account's Sign on Reports" position="inside">
|
||||
<group>
|
||||
<group>
|
||||
<separator string="Debitable Accounts" colspan="4"/>
|
||||
<label string="A debitable account is one which grows in the debit and diminishes in the credit" colspan="4"/>
|
||||
<label string="Keep sign on Reports for these accounts and children accounts that are within Accreditable Accounts" colspan="4"/>
|
||||
<field name="debit_account_ids" nolabel="1" colspan ="4" domain="[('company_id.name','=',name),('company_id.partner_id','=',partner_id),]">
|
||||
<tree>
|
||||
<field name='code'/>
|
||||
<field name='name'/>
|
||||
<field name='type'/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group>
|
||||
<separator string="Accreditable Accounts" colspan="4"/>
|
||||
<label string="An accreditable account is one which grows in the credit and diminishes in the debit" colspan="4"/>
|
||||
<label string="Reverse sign on Reports for these accounts and children accounts that are within Debitable Accounts" colspan="4"/>
|
||||
<field name="credit_account_ids" nolabel="1" colspan ="4" domain="[('company_id.name','=',name),('company_id.partner_id','=',partner_id),]">
|
||||
<tree>
|
||||
<field name='code'/>
|
||||
<field name='name'/>
|
||||
<field name='type'/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue