[MERGE] fix of lp bug 1076509
lp bug: https://launchpad.net/bugs/1076509 fixed bzr revid: qdp-launchpad@openerp.com-20130213164157-6ojykbl1w1on8ng8
This commit is contained in:
commit
57ac1b0f04
|
@ -151,12 +151,12 @@ class account_config_settings(osv.osv_memory):
|
|||
self.write(cr, uid, [id], vals, context)
|
||||
return id
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company_id):
|
||||
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
|
||||
# update related fields
|
||||
values = {}
|
||||
values['currency_id'] = False
|
||||
if company_id:
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id)
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
has_chart_of_accounts = company_id not in self.pool.get('account.installer').get_unconfigured_cmp(cr, uid)
|
||||
fiscalyear_count = self.pool.get('account.fiscalyear').search_count(cr, uid,
|
||||
[('date_start', '<=', time.strftime('%Y-%m-%d')), ('date_stop', '>=', time.strftime('%Y-%m-%d')),
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<label for="company_id" string="Select Company"/>
|
||||
<field name="company_id"
|
||||
widget="selection"
|
||||
on_change="onchange_company_id(company_id)"
|
||||
on_change="onchange_company_id(company_id, context)"
|
||||
class="oe_inline"/>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
@ -50,13 +50,25 @@ class account_config_settings(osv.osv_memory):
|
|||
'company_id', 'income_currency_exchange_account_id',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Gain Exchange Rate Account"),
|
||||
string="Gain Exchange Rate Account",
|
||||
domain="[('type', '=', 'other')]"),
|
||||
'expense_currency_exchange_account_id': fields.related(
|
||||
'company_id', 'expense_currency_exchange_account_id',
|
||||
type="many2one",
|
||||
relation='account.account',
|
||||
string="Loss Exchange Rate Account"),
|
||||
string="Loss Exchange Rate Account",
|
||||
domain="[('type', '=', 'other')]"),
|
||||
}
|
||||
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
|
||||
res = super(account_config_settings, self).onchange_company_id(cr, uid, ids, company_id, context=context)
|
||||
if company_id:
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
res['value'].update({'income_currency_exchange_account_id': company.income_currency_exchange_account_id and company.income_currency_exchange_account_id.id or False,
|
||||
'expense_currency_exchange_account_id': company.expense_currency_exchange_account_id and company.expense_currency_exchange_account_id.id or False})
|
||||
else:
|
||||
res['value'].update({'income_currency_exchange_account_id': False,
|
||||
'expense_currency_exchange_account_id': False})
|
||||
return res
|
||||
|
||||
class account_voucher(osv.osv):
|
||||
def _check_paid(self, cr, uid, ids, name, args, context=None):
|
||||
|
|
Loading…
Reference in New Issue