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.

51 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. import ast
  4. from odoo import api, fields, models
  5. class ResConfigSettings(models.TransientModel):
  6. _inherit = "res.config.settings"
  7. card_support = fields.Boolean(
  8. string="Scan cooperators cards instead of login for sheets validation",
  9. config_parameter="beesdoo_shift_attendance.card_support",
  10. )
  11. pre_filled_task_type_id = fields.Many2one(
  12. "beesdoo.shift.type",
  13. string="Default Task Type",
  14. help="Default task type for attendance sheet pre-filling",
  15. required=True,
  16. default=False,
  17. )
  18. attendance_sheet_generation_interval = fields.Integer(
  19. string="Time interval for attendance sheet generation",
  20. help="Time interval expressed in minutes",
  21. required=True,
  22. config_parameter=(
  23. "beesdoo_shift_attendance.attendance_sheet_generation_interval"
  24. ),
  25. )
  26. @api.multi
  27. def set_values(self):
  28. super(ResConfigSettings, self).set_values()
  29. parameters = self.env["ir.config_parameter"].sudo()
  30. parameters.set_param(
  31. "beesdoo_shift_attendance.pre_filled_task_type_id",
  32. str(self.pre_filled_task_type_id.id),
  33. )
  34. @api.multi
  35. def get_values(self):
  36. res = super(ResConfigSettings, self).get_values()
  37. res.update(
  38. pre_filled_task_type_id=int(
  39. self.env["ir.config_parameter"].get_param(
  40. "beesdoo_shift_attendance.pre_filled_task_type_id"
  41. )
  42. )
  43. )
  44. return res