diff --git a/base_accounting_kit/doc/changelog.md b/base_accounting_kit/doc/changelog.md index 5eaa6e285..01bb8a861 100644 --- a/base_accounting_kit/doc/changelog.md +++ b/base_accounting_kit/doc/changelog.md @@ -104,4 +104,9 @@ #### 14.01.2022 #### Version 14.0.3.13.14 #### FIX -- Dashboard cash and bank balance issue fix \ No newline at end of file +- Dashboard cash and bank balance issue fix + +#### 23.04.2024 +#### Version 14.0.3.13.15 +#### FIX +- Residual value and Archive issue Fix \ No newline at end of file diff --git a/base_accounting_kit/models/account_asset.py b/base_accounting_kit/models/account_asset.py index 91f4212c6..35bb101ca 100644 --- a/base_accounting_kit/models/account_asset.py +++ b/base_accounting_kit/models/account_asset.py @@ -436,6 +436,8 @@ class AccountAssetAsset(models.Model): fields)) asset.message_post(subject=_('Asset created'), tracking_value_ids=tracking_value_ids) + if self.value_residual == 0.0: + self.write({'state': 'close'}) def _get_disposal_moves(self): move_ids = [] @@ -533,6 +535,13 @@ class AccountAssetAsset(models.Model): raise ValidationError(_( 'Prorata temporis can be applied only for time method "number of depreciations".')) + @api.constrains('active', 'state') + def _check_active(self): + for record in self: + if record.active == False and record.state != 'close': + raise UserError("You Cannot Archive a record in Running State") + + @api.onchange('category_id') def onchange_category_id(self): vals = self.onchange_category_id_values(self.category_id.id) diff --git a/base_accounting_kit/security/security.xml b/base_accounting_kit/security/security.xml index 01fdbc9a7..08ea2170f 100644 --- a/base_accounting_kit/security/security.xml +++ b/base_accounting_kit/security/security.xml @@ -5,27 +5,35 @@ Account Asset Category multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + Account Asset multi-company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + Accountant - - + + Chief Accountant - - + +