[FIX][IMP] account_asset: method_time / prorata thingy
- on account.asset.asset form view, field method_time, in 'Depreciation Information' page: use radio widget instead (without it, you couldn't change the field) - on account.asset.category form view: prorata field hidden when required, and set to false when method_time is on 'Ending Date'. (It was previously possible for the prorata to be true while the method_time was 'Ending Date', which is invalid)
This commit is contained in:
committed by
Yannick Tivisse
parent
62a1c97d37
commit
5a859b8d38
@@ -50,6 +50,11 @@ class AccountAssetCategory(models.Model):
|
||||
else:
|
||||
self.method_period = 12
|
||||
|
||||
@api.onchange('method_time')
|
||||
def _onchange_method_time(self):
|
||||
if self.method_time != 'number':
|
||||
self.prorata = False
|
||||
|
||||
|
||||
class AccountAssetAsset(models.Model):
|
||||
_name = 'account.asset.asset'
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<group attrs="{'invisible': [('type','=','sale')]}" string="Depreciation Method">
|
||||
<field name="method" widget="radio"/>
|
||||
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
|
||||
<field name="prorata"/>
|
||||
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
@@ -177,10 +177,7 @@
|
||||
<group>
|
||||
<field name="method" widget="radio" attrs="{'invisible': [('type','=','sale')]}"/>
|
||||
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
|
||||
<label for="method_time"/>
|
||||
<div>
|
||||
<field name="method_time"/>
|
||||
</div>
|
||||
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user