[FIX] account_asset: Fixed problem of category onchange when assets are created using supplier invoice.

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

bzr revid: uco@tinyerp.com-20111018070303-iohtamc0x19wxmcu
This commit is contained in:
Ujjvala Collins (OpenERP) 2011-10-18 12:33:03 +05:30
parent 787d33eb36
commit a1dcde1af6
1 changed files with 3 additions and 0 deletions

View File

@ -296,6 +296,9 @@ class account_asset_asset(osv.osv):
return depreciation_obj.create_move(cr, uid, depreciation_ids, context=context)
def create(self, cr, uid, vals, context=None):
if vals.get('category_id'):
res = self.onchange_category_id(cr, uid, [], vals['category_id'], context=context)
vals.update(res['value'])
asset_id = super(account_asset_asset, self).create(cr, uid, vals, context=context)
self.compute_depreciation_board(cr, uid, [asset_id], context=context)
return asset_id