# -*- coding: utf-8 -*-
# Odoo, Open Source Custom Asset.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).#
from odoo import fields, models,api,_

class Assetclassification(models.Model):
    _name = 'asset.classification'
    
    name = fields.Char(string='Name')

class AssetMake(models.Model):
    _name = 'asset.make'
    
    name = fields.Char(string='Name')

class AssetModel(models.Model):
    _name = 'asset.model'
    
    name = fields.Char(string='Name')
    model_number  = fields.Char(string='Model Number')

class AssetStatus(models.Model):
    _name = 'asset.status'
    
    name = fields.Char(string='Name')

# Asset  Model
class AccountAssetAsset(models.Model):
    _inherit = 'account.asset.asset'
    
    image = fields.Binary('Image')
    location_id = fields.Many2one('stock.location',string='Location')
    date = fields.Date(string='Date', required=False, readonly=True, states={'draft': [('readonly', False)]}, default=fields.Date.context_today, oldname="purchase_date")
    employee_id = fields.Many2one('hr.employee', string='Employee')
    vendor_id  = fields.Many2one('res.partner', string='Vendor')
    status_id  = fields.Many2one('asset.status', string='Asset Status')
    make_id  = fields.Many2one('asset.make', string='Make')
    model_id  = fields.Many2one('asset.model', string='Model')
    model_number  = fields.Char(realted="model_id.model_number", string='Model Number')
    serial_number =  fields.Char(string='Serial Number')
    classification_id = fields.Many2one('asset.classification',string='Classification')
    inventory_date = fields.Date(string='Inventory Date')
    inventory_by = fields.Many2one('res.partner',string='Inventory By')
    barcode =  fields.Char(string='Barcode')

