[FIX]hr_expense :put an onchange in the currency field that fill the force journal field with a purhcase journal that has the same currency
bzr revid: mma@tinyerp.com-20120814065201-57472t4o0wma1232
This commit is contained in:
parent
25367f13bb
commit
48f2640283
|
@ -100,6 +100,14 @@ class hr_expense_expense(osv.osv):
|
|||
'currency_id': _get_currency,
|
||||
}
|
||||
|
||||
def onchange_currency_id(self, cr, uid, ids, currency_id, context=None):
|
||||
res = {'value': {'journal_id': False}}
|
||||
company_id = self.browse(cr, uid, ids[0], context=context).company_id.id
|
||||
journal_id = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)])
|
||||
if journal_id:
|
||||
res['value']['journal_id'] = journal_id
|
||||
return res
|
||||
|
||||
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
department_id = False
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<group>
|
||||
<field name="name"/>
|
||||
<field name="user_valid"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency" on_change="onchange_currency_id(currency_id)"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
|
Loading…
Reference in New Issue