From 424ac791dddc27a0ea161c45dc8977356f353c3c Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 24 Mar 2022 15:40:44 +0100 Subject: [PATCH] [FIX] account_asset_management: Don't empty profile Steps to reproduce the problem - Create an asset profile with any asset account - Don't set the asset profile in such account - Create a vendor bill - Add a line, and select the asset profile Current behavior: - The account is set, but the profile is emptied Expected behavior: - Both account and profile are set This is because there's a condition on the computed writeable field that empty the value if no asset of the account doesn't have a linked profile, but that's not correct and different from the previous behavior before #1336 If CacheMiss exceptions arise, the proper solution is to reassign the value. TT35354 --- account_asset_management/__manifest__.py | 2 +- account_asset_management/models/account_move.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_asset_management/__manifest__.py b/account_asset_management/__manifest__.py index ca8a61103..b2dedf322 100644 --- a/account_asset_management/__manifest__.py +++ b/account_asset_management/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Assets Management", - "version": "13.0.3.7.2", + "version": "13.0.3.7.3", "license": "AGPL-3", "depends": ["account", "report_xlsx_helper"], "excludes": ["account_asset"], diff --git a/account_asset_management/models/account_move.py b/account_asset_management/models/account_move.py index 626d24aaa..03d0cf808 100644 --- a/account_asset_management/models/account_move.py +++ b/account_asset_management/models/account_move.py @@ -181,8 +181,8 @@ class AccountMoveLine(models.Model): rec.asset_profile_id = rec.account_id.asset_profile_id elif rec.asset_id: rec.asset_profile_id = rec.asset_id.profile_id - else: - rec.asset_profile_id = False + else: # don't touch it - Needed for avoiding CacheMiss exceptions + rec.asset_profile_id = rec.asset_profile_id @api.onchange("asset_profile_id") def _onchange_asset_profile_id(self):