[IMP] account_asset: Improved default values. Improved view.

bzr revid: uco@tinyerp.com-20110517131803-vuakdgz6p8kkfk03
This commit is contained in:
Ujjvala Collins (OpenERP) 2011-05-17 18:48:03 +05:30
parent 262b898671
commit 26b3ffdf1d
2 changed files with 24 additions and 16 deletions

View File

@ -47,11 +47,11 @@ class account_asset_category(osv.osv):
_defaults = {
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.asset.category', context=context),
'method': lambda obj, cr, uid, context: 'linear',
'method_delay': lambda obj, cr, uid, context: 5,
'method_time': lambda obj, cr, uid, context: 'delay',
'method_period': lambda obj, cr, uid, context: 12,
'method_progress_factor': lambda obj, cr, uid, context: 0.3,
'method': 'linear',
'method_delay': 5,
'method_time': 'delay',
'method_period': 12,
'method_progress_factor': 0.3,
}
account_asset_category()
@ -211,15 +211,17 @@ class account_asset_asset(osv.osv):
def onchange_category_id(self, cr, uid, ids, category_id, context=None):
res = {'value':{}}
asset_categ_obj = self.pool.get('account.asset.category')
if category_id:
category_obj = self.pool.get('account.asset.category').browse(cr, uid, category_id, context=context)
res['value'] = {'method': category_obj.method,
category_obj = asset_categ_obj.browse(cr, uid, category_id, context=context)
res['value'] = {
'method': category_obj.method,
'method_delay': category_obj.method_delay,
'method_time': category_obj.method_time,
'method_period': category_obj.method_period,
'method_progress_factor': category_obj.method_progress_factor,
'prorata': category_obj.prorata,
}
}
return res
def _compute_period(self, cr, uid, property, context={}):

View File

@ -15,14 +15,20 @@
<field name="account_asset_id"/>
<field name="account_depreciation_id"/>
<field name="account_expense_depreciation_id"/>
<separator string="Depreciation duration" colspan="4"/>
<field name="method"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')]}"/>
<newline/>
<field name="method_time"/>
<field name="method_period" attrs="{'invisible':[('method_time','=','end')]}"/>
<field name="prorata" colspan="1"/>
<field name="method_delay"/>
<group colspan="2" col="2">
<separator string="Depreciation Dates" colspan="2" />
<field name="method_time"/>
<field name="method_delay"/>
<field name="method_period" attrs="{'invisible':[('method_time','=','end')]}"/>
</group>
<group colspan="2" col="3">
<separator string="Depreciation Method" colspan="4" />
<field name="method"/>
<newline/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')]}"/>
<newline/>
<field name="prorata" colspan="1"/>
</group>
<group col="4" colspan="4" groups="analytic.group_analytic_accounting">
<separator string="Analytic information" colspan="4" />
<newline/>