diff --git a/account_financial_report/model/res_company.py b/account_financial_report/model/res_company.py index 2bbb383d..e2b6d84f 100755 --- a/account_financial_report/model/res_company.py +++ b/account_financial_report/model/res_company.py @@ -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() diff --git a/account_financial_report/report/parser.py b/account_financial_report/report/parser.py index 005706e4..6d82db72 100644 --- a/account_financial_report/report/parser.py +++ b/account_financial_report/report/parser.py @@ -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) # diff --git a/account_financial_report/view/company_view.xml b/account_financial_report/view/company_view.xml index 08f830e0..bf8a5744 100644 --- a/account_financial_report/view/company_view.xml +++ b/account_financial_report/view/company_view.xml @@ -8,15 +8,36 @@ form - - - - - - - - - + + + + + + + + + + + +