From 5a859b8d389c6911bcb37db0b95668b6bad1a55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 4 Aug 2016 12:59:26 +0200 Subject: [PATCH] [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) --- addons/account_asset/models/account_asset.py | 5 +++++ addons/account_asset/views/account_asset_views.xml | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/account_asset/models/account_asset.py b/addons/account_asset/models/account_asset.py index e681f5ac37d..a1606eecef8 100644 --- a/addons/account_asset/models/account_asset.py +++ b/addons/account_asset/models/account_asset.py @@ -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' diff --git a/addons/account_asset/views/account_asset_views.xml b/addons/account_asset/views/account_asset_views.xml index 5dbfb2b9f1b..9fc6b426868 100644 --- a/addons/account_asset/views/account_asset_views.xml +++ b/addons/account_asset/views/account_asset_views.xml @@ -58,7 +58,7 @@ - + @@ -177,10 +177,7 @@ -