[FIX] Added onchange_company for gain and loss accounts in config settings

lp bug: https://launchpad.net/bugs/1076509 fixed

bzr revid: jco@openerp.com-20121219092235-wci6jo81q2ihgpgd
This commit is contained in:
Josse Colpaert 2012-12-19 10:22:35 +01:00
parent 70e0d2860c
commit dc47ad6c73
1 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,13 @@ class account_config_settings(osv.osv_memory):
relation='account.account',
string="Loss Exchange Rate Account"),
}
def onchange_company_id(self, cr, uid, ids, company_id):
res = super(account_config_settings, self).onchange_company_id(cr, uid, ids, company_id)
if company_id:
company = self.pool.get('res.company').browse(cr, uid, company_id)
res['value'].update({'income_currency_exchange_account_id': company.income_currency_exchange_account_id and company.income_currency_exchange_account_id.id,
'expense_currency_exchange_account_id': company.expense_currency_exchange_account_id and company.expense_currency_exchange_account_id.id})
return res
class account_voucher(osv.osv):
def _check_paid(self, cr, uid, ids, name, args, context=None):