Files
account-financial-tools/account_asset_low_value/wizard/account_asset_remove.py
2022-10-19 10:34:28 +07:00

18 lines
560 B
Python

# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class AccountAssetRemove(models.TransientModel):
_inherit = "account.asset.remove"
def remove(self):
self.ensure_one()
asset_id = self.env.context.get("active_id")
asset = self.env["account.asset"].browse(asset_id)
if asset.low_value:
asset.write({"state": "removed", "date_remove": self.date_remove})
return True
return super().remove()