[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
This commit is contained in:
Pedro M. Baeza
2022-03-24 15:40:44 +01:00
parent 6db03a83c2
commit 424ac791dd
2 changed files with 3 additions and 3 deletions

View File

@@ -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"],

View File

@@ -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):