[IMP] account_asset: Added parent_id field on asset form view and added constraint for the same to check recursion.
bzr revid: uco@tinyerp.com-20110627064252-n7pp50jf41hqr3ml
This commit is contained in:
parent
c9031ba730
commit
b7605a8862
|
@ -228,6 +228,9 @@ class account_asset_asset(osv.osv):
|
|||
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
|
||||
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.asset.asset',context=context),
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids, context=None, parent=None):
|
||||
return super(account_asset_asset, self)._check_recursion(cr, uid, ids, context=context, parent=parent)
|
||||
|
||||
def _check_prorata(self, cr, uid, ids, context=None):
|
||||
for asset in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -236,6 +239,7 @@ class account_asset_asset(osv.osv):
|
|||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_recursion, 'Error ! You can not create recursive assets.', ['parent_id']),
|
||||
(_check_prorata, '\nProrata temporis can be applied only for computation method linear and time method delay.', ['prorata']),
|
||||
]
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1" on_change="onchange_category_id(category_id)"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="purchase_value" select="1"/>
|
||||
<field name="salvage_value"/>
|
||||
<field name="value_residual"/>
|
||||
|
|
Loading…
Reference in New Issue