You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019-2020 Elouan Le Bars <elouan@coopiteasy.be>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import fields, models, api
  5. class ShiftConfigSettings(models.TransientModel):
  6. _name = "beesdoo.shift.config.settings"
  7. _inherit = "res.config.settings"
  8. default_task_type_id = fields.Many2one(
  9. "beesdoo.shift.type",
  10. string="Default Task Type",
  11. help="Default task type for attendance sheet pre-filling.",
  12. )
  13. attendance_sheet_generation_interval = fields.Integer(
  14. string="Time interval for attendance sheet generation",
  15. help="Time interval expressed in minutes",
  16. )
  17. @api.multi
  18. def set_params(self):
  19. self.ensure_one()
  20. parameters = self.env["ir.config_parameter"]
  21. parameters.set_param(
  22. "beesdoo_shift.default_task_type_id",
  23. str(self.default_task_type_id.id),
  24. )
  25. parameters.set_param(
  26. "beesdoo_shift.attendance_sheet_generation_interval",
  27. str(self.attendance_sheet_generation_interval),
  28. )
  29. @api.multi
  30. def get_default_task_type_id(self):
  31. return {
  32. "default_task_type_id": int(
  33. self.env["ir.config_parameter"].get_param(
  34. "beesdoo_shift.default_task_type_id"
  35. )
  36. )
  37. }
  38. @api.multi
  39. def get_default_attendance_sheet_generation_interval(self):
  40. return {
  41. "attendance_sheet_generation_interval": int(
  42. self.env["ir.config_parameter"].get_param(
  43. "beesdoo_shift.attendance_sheet_generation_interval"
  44. )
  45. )
  46. }