mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] account_asset_management: Exception raised when changing asset profile in a move
This commit is contained in:
@@ -141,10 +141,6 @@ class AccountMoveLine(models.Model):
|
||||
"an accounting entry to an asset."
|
||||
"\nYou should generate such entries from the asset."))
|
||||
if vals.get('asset_profile_id'):
|
||||
if len(self) == 1:
|
||||
raise AssertionError(_(
|
||||
'This option should only be used for a single id at a '
|
||||
'time.'))
|
||||
asset_obj = self.env['account.asset']
|
||||
for aml in self:
|
||||
if vals['asset_profile_id'] == aml.asset_profile_id.id:
|
||||
@@ -157,6 +153,8 @@ class AccountMoveLine(models.Model):
|
||||
create_asset_from_move_line=True,
|
||||
move_id=aml.move_id.id).create(asset_vals)
|
||||
vals['asset_id'] = asset.id
|
||||
super(AccountMoveLine, aml).write(vals)
|
||||
return True
|
||||
return super().write(vals)
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user