1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/planning/populate/planning_slot_template.py
2024-12-10 09:04:09 +07:00

22 lines
762 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.tools import populate
class PlanningTemplate(models.Model):
_inherit = "planning.slot.template"
_populate_sizes = {"small": 10, "medium": 50, "large": 1000}
_populate_dependencies = ["planning.role"]
def _populate_factories(self):
role_ids = self.env.registry.populated_models["planning.role"]
return [
("name", populate.constant('shift_template_{counter}')),
("sequence", populate.randomize([False] + [i for i in range(1, 101)])),
("active", populate.randomize([True, False], [0.8, 0.2])),
('role_id', populate.randomize(role_ids)),
]