summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_asset.py
blob: 211ab229d214f973f46b5bb3ef4ae09f454d0a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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'