from odoo import fields, models


class DirectiveWorkType(models.Model):
    _name = "directive.work.type"
    _description = "Directive Work Type"
    _order = "name asc, id desc"

    name = fields.Char(string="Название вида работ", required=True)
    code = fields.Char(string="Технический код", index=True)

    active = fields.Boolean(string="Активен", default=True)
    description = fields.Text(string="Описание")

    _sql_constraints = [
        ("directive_work_type_code_uniq", "unique(code)", "Work type code must be unique."),
    ]
