[FIX] recurring line's model form view

properly set a company id when a journal is selected and, therefore, correctly display available accounts

bzr revid: abo@openerp.com-20120913122312-v2zz8m4r8wcxovtx
This commit is contained in:
Antonin Bourguignon 2012-09-13 14:23:12 +02:00
parent 5de520e4da
commit 0986f13047
2 changed files with 14 additions and 4 deletions

View File

@ -2338,6 +2338,16 @@ class account_model(osv.osv):
return move_ids
def onchange_journal_id(self, cr, uid, ids, journal_id=None, context=None):
company_id = False
if journal_id:
company = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context).company_id
if company:
company_id = company.id
return {'value': {'company_id': company_id}}
account_model()
class account_model_line(osv.osv):
@ -3013,9 +3023,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'purchase_tax_rate': fields.float('Purchase Tax(%)'),
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
}
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
currency_id = False
currency_id = False
if company_id:
currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id
return {'value': {'currency_id': currency_id}}

View File

@ -1651,8 +1651,8 @@
<form string="Journal Entry Model" version="7.0">
<group col="4">
<field name="name"/>
<field name="journal_id"/>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<field name="lines_id" widget="one2many_list"/>