Improved OnChange Method
bzr revid: bde@tiny2-desktop-20110517131518-44788w3et6470w6t
This commit is contained in:
parent
0f3aa047a8
commit
adce9420f8
|
@ -43,15 +43,11 @@ class account_asset_category(osv.osv):
|
|||
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.asset.category', context=context),
|
||||
}
|
||||
|
||||
def onchange_account_depreciation_id(self, cr, uid, ids, account_asset_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
account_depreciation_id = self.pool.get('account.account').browse(cr, uid, account_asset_id,
|
||||
context=context).id
|
||||
return {'value': {
|
||||
'account_depreciation_id': account_depreciation_id,
|
||||
}
|
||||
}
|
||||
def onchange_account_asset(self, cr, uid, ids, account_asset_id, context=None):
|
||||
res = {'value':{}}
|
||||
if account_asset:
|
||||
res['value'] = {'account_depreciation_id': account_asset_id}
|
||||
return res
|
||||
|
||||
account_asset_category()
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<separator string="Accounting information" colspan="4" />
|
||||
<field name="journal_id"/>
|
||||
<field name="account_asset_id" on_change="onchange_account_depreciation_id(account_asset_id)"/>
|
||||
<field name="account_asset_id" on_change="onchange_account_asset(account_asset_id)"/>
|
||||
<field name="account_depreciation_id"/>
|
||||
<field name="account_expense_depreciation_id"/>
|
||||
<group col="4" colspan="4" groups="analytic.group_analytic_accounting">
|
||||
|
|
Loading…
Reference in New Issue