diff --git a/account_asset_management/__manifest__.py b/account_asset_management/__manifest__.py index 080336d41..ee5f70bf3 100644 --- a/account_asset_management/__manifest__.py +++ b/account_asset_management/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Assets Management', - 'version': '11.0.1.0.0', + 'version': '11.0.1.0.1', 'license': 'AGPL-3', 'depends': [ 'account_fiscal_year', diff --git a/account_asset_management/i18n/account_asset_management.pot b/account_asset_management/i18n/account_asset_management.pot index 70d52d8c4..452a492c9 100644 --- a/account_asset_management/i18n/account_asset_management.pot +++ b/account_asset_management/i18n/account_asset_management.pot @@ -1005,7 +1005,7 @@ msgid "This amount represent the initial value of the asset.\n" msgstr "" #. module: account_asset_management -#: code:addons/account_asset_management/models/account_move.py:135 +#: code:addons/account_asset_management/models/account_move.py:139 #, python-format msgid "This option should only be used for a single id at a time." msgstr "" @@ -1070,7 +1070,7 @@ msgstr "" #. module: account_asset_management #: code:addons/account_asset_management/models/account_move.py:69 -#: code:addons/account_asset_management/models/account_move.py:130 +#: code:addons/account_asset_management/models/account_move.py:134 #, python-format msgid "You are not allowed to link an accounting entry to an asset.\n" "You should generate such entries from the asset." @@ -1109,7 +1109,7 @@ msgid "You cannot change an accounting entry linked to an asset depreciation lin msgstr "" #. module: account_asset_management -#: code:addons/account_asset_management/models/account_move.py:126 +#: code:addons/account_asset_management/models/account_move.py:130 #, python-format msgid "You cannot change an accounting item linked to an asset depreciation line." msgstr "" diff --git a/account_asset_management/models/account_move.py b/account_asset_management/models/account_move.py index 6731af86a..e9cb04b1b 100644 --- a/account_asset_management/models/account_move.py +++ b/account_asset_management/models/account_move.py @@ -116,15 +116,19 @@ class AccountMoveLine(models.Model): @api.multi def write(self, vals): if ( - self.mapped('asset_id') and set(vals).intersection(FIELDS_AFFECTS_ASSET_MOVE_LINE) and not ( self.env.context.get('allow_asset_removal') and list(vals.keys()) == ['asset_id']) ): - raise UserError( - _("You cannot change an accounting item " - "linked to an asset depreciation line.")) + # Check if at least one asset is linked to a move + linked_asset = False + for move in self: + linked_asset = move.asset_id + if linked_asset: + raise UserError( + _("You cannot change an accounting item " + "linked to an asset depreciation line.")) if vals.get('asset_id'): raise UserError( _("You are not allowed to link "