Onchange on asset account => fill the depreciation account

bzr revid: bde@tiny2-desktop-20110517064117-zz46iisjceas9hrd
This commit is contained in:
bde 2011-05-17 12:11:17 +05:30
parent a2ffcb5888
commit 0f3aa047a8
2 changed files with 11 additions and 1 deletions

View File

@ -43,6 +43,16 @@ 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,
}
}
account_asset_category()
#class one2many_mod_asset(fields.one2many):

View File

@ -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"/>
<field name="account_asset_id" on_change="onchange_account_depreciation_id(account_asset_id)"/>
<field name="account_depreciation_id"/>
<field name="account_expense_depreciation_id"/>
<group col="4" colspan="4" groups="analytic.group_analytic_accounting">