Align FSM modules with Odoo instructions requirements

This commit is contained in:
Ruslan Bakiev
2026-02-13 16:44:40 +07:00
parent fa145350ca
commit 86f87ec1c9
38 changed files with 505 additions and 181 deletions

View File

@@ -6,14 +6,37 @@ class RepairTechnician(models.Model):
_name = "repair.technician"
_description = "Repair Technician"
_order = "name"
_inherit = ["mail.thread", "mail.activity.mixin"]
name = fields.Char(required=True)
user_id = fields.Many2one("res.users", string="User")
zone_ids = fields.Many2many("repair.fsm.zone", string="FSM Zones")
active = fields.Boolean(default=True)
name = fields.Char(required=True, tracking=True)
user_id = fields.Many2one("res.users", string="User", tracking=True)
zone_ids = fields.Many2many("repair.fsm.zone", string="FSM Zones", tracking=True)
state = fields.Selection(
selection=[
("draft", "Draft"),
("active", "Active"),
("archived", "Archived"),
],
default="draft",
tracking=True,
group_expand="_group_expand_states",
)
active = fields.Boolean(default=True, tracking=True)
schedule_ids = fields.One2many("repair.technician.schedule", "technician_id", string="Weekly Schedule")
exception_ids = fields.One2many("repair.technician.exception", "technician_id", string="Exceptions")
def _group_expand_states(self, states, domain, order):
return [key for key, _label in self._fields["state"].selection]
def action_set_active(self):
self.write({"state": "active", "active": True})
def action_archive(self):
self.write({"state": "archived", "active": False})
def action_reset_draft(self):
self.write({"state": "draft", "active": True})
class RepairTechnicianSchedule(models.Model):
_name = "repair.technician.schedule"