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.

49 lines
1.6 KiB

4 years ago
4 years ago
  1. # Copyright 2019-2020 Elouan Le Bars <elouan@coopiteasy.be>
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models
  4. class ResConfigSettings(models.TransientModel):
  5. _inherit = "res.config.settings"
  6. card_support = fields.Boolean(
  7. string="Scan cooperators cards instead of login for sheets validation",
  8. config_parameter="beesdoo_shift_attendance.card_support",
  9. )
  10. pre_filled_task_type_id = fields.Many2one(
  11. "beesdoo.shift.type",
  12. string="Default Task Type",
  13. help="Default task type for attendance sheet pre-filling",
  14. required=True,
  15. default=False,
  16. )
  17. attendance_sheet_generation_interval = fields.Integer(
  18. string="Time interval for attendance sheet generation",
  19. help="Time interval expressed in minutes",
  20. required=True,
  21. config_parameter=(
  22. "beesdoo_shift_attendance.attendance_sheet_generation_interval"
  23. ),
  24. )
  25. @api.multi
  26. def set_values(self):
  27. super(ResConfigSettings, self).set_values()
  28. parameters = self.env["ir.config_parameter"].sudo()
  29. parameters.set_param(
  30. "beesdoo_shift_attendance.pre_filled_task_type_id",
  31. str(self.pre_filled_task_type_id.id),
  32. )
  33. @api.multi
  34. def get_values(self):
  35. res = super(ResConfigSettings, self).get_values()
  36. res.update(
  37. pre_filled_task_type_id=int(
  38. self.env["ir.config_parameter"].get_param(
  39. "beesdoo_shift_attendance.pre_filled_task_type_id"
  40. )
  41. )
  42. )
  43. return res