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

@@ -5,9 +5,32 @@ class RepairMaterial(models.Model):
_name = "repair.material"
_description = "Repair Material"
_order = "name"
_inherit = ["mail.thread", "mail.activity.mixin"]
name = fields.Char(required=True)
default_code = fields.Char(string="Code")
uom_name = fields.Char(string="UoM", default="pcs")
standard_cost = fields.Float(string="Cost")
active = fields.Boolean(default=True)
name = fields.Char(required=True, tracking=True)
default_code = fields.Char(string="Code", tracking=True)
uom_name = fields.Char(string="UoM", default="pcs", tracking=True)
standard_cost = fields.Float(string="Cost", 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)
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})