from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError class AccountAsset(models.Model): _inherit = 'account.asset.asset' asset_type = fields.Selection(string='Tipe Aset', selection=[ ('aset_gudang', ' Aset Gudang'), ('aset_kantor', 'Aset Kantor'), ], tracking=True ) def action_close_asset(self): for asset in self: if asset.value > 0: raise UserError("Asset masih mempunyai Value") asset.state = 'close'