Browse Source

[IMP] Agregado Campo m2m a res.company para


			
			
				6.0
			
			
		
Humberto Arocha 13 years ago
parent
commit
49ef2165cd
  1. 6
      account_financial_report/model/res_company.py
  2. 24
      account_financial_report/report/parser.py
  3. 39
      account_financial_report/view/company_view.xml

6
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_ids':fields.many2many('account.account',
'credit_account_company_rel', 'credit_account_company_rel',
'company_id', 'account_id', '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() res_company()

24
account_financial_report/report/parser.py

@ -150,9 +150,12 @@ class account_balance(report_sxw.rml_parse):
rc_obj = self.pool.get('res.company') rc_obj = self.pool.get('res.company')
return rc_obj.browse(self.cr, self.uid, company_id).currency_id.id 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') 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): def lines(self, form, level=0):
""" """
@ -257,10 +260,15 @@ class account_balance(report_sxw.rml_parse):
account_ids = form['account_list'] account_ids = form['account_list']
del 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 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 form.get('fiscalyear'):
if type(form.get('fiscalyear')) in (list,tuple): if type(form.get('fiscalyear')) in (list,tuple):
fiscalyear = form['fiscalyear'] and form['fiscalyear'][0] fiscalyear = form['fiscalyear'] and form['fiscalyear'][0]
@ -278,6 +286,16 @@ class account_balance(report_sxw.rml_parse):
print 'credit_account_ids ', credit_account_ids 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) # Generate the report lines (checking each account)
# #

39
account_financial_report/view/company_view.xml

@ -8,15 +8,36 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<notebook position="inside"> <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> </page>
</notebook> </notebook>
</field> </field>

Loading…
Cancel
Save