Browse Source

[FIX] b_shift_attendance: Bug on update

pull/153/head
Rémy Taymans 5 years ago
parent
commit
830223c319
  1. 21
      beesdoo_shift_attendance/data/system_parameter.xml
  2. 12
      beesdoo_shift_attendance/models/res_config_settings.py

21
beesdoo_shift_attendance/data/system_parameter.xml

@ -1,10 +1,13 @@
<odoo noupdate="1">
<record id="card_support" model="ir.config_parameter">
<field name="key">beesdoo_shift_attendance.card_support</field>
<field name="value">False</field>
</record>
<record id="attendance_sheet_generation_interval" model="ir.config_parameter">
<field name="key">beesdoo_shift_attendance.attendance_sheet_generation_interval</field>
<field name="value">15</field>
</record>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="card_support" model="ir.config_parameter">
<field name="key">beesdoo_shift_attendance.card_support</field>
<field name="value">False</field>
</record>
<record id="attendance_sheet_generation_interval" model="ir.config_parameter">
<field name="key">beesdoo_shift_attendance.attendance_sheet_generation_interval</field>
<field name="value">15</field>
</record>
</data>
</odoo> </odoo>

12
beesdoo_shift_attendance/models/res_config_settings.py

@ -33,27 +33,15 @@ class ResConfigSettings(models.TransientModel):
def set_values(self): def set_values(self):
super(ResConfigSettings, self).set_values() super(ResConfigSettings, self).set_values()
parameters = self.env["ir.config_parameter"].sudo() parameters = self.env["ir.config_parameter"].sudo()
parameters.set_param(
"beesdoo_shift_attendance.card_support", str(self.card_support),
)
parameters.set_param( parameters.set_param(
"beesdoo_shift_attendance.pre_filled_task_type_id", "beesdoo_shift_attendance.pre_filled_task_type_id",
str(self.pre_filled_task_type_id.id), str(self.pre_filled_task_type_id.id),
) )
parameters.set_param(
"beesdoo_shift_attendance.attendance_sheet_generation_interval",
str(self.attendance_sheet_generation_interval),
)
@api.multi @api.multi
def get_values(self): def get_values(self):
res = super(ResConfigSettings, self).get_values() res = super(ResConfigSettings, self).get_values()
res.update( res.update(
card_support=ast.literal_eval(
self.env["ir.config_parameter"].get_param(
"beesdoo_shift_attendance.card_support"
),
),
pre_filled_task_type_id=int( pre_filled_task_type_id=int(
self.env["ir.config_parameter"].get_param( self.env["ir.config_parameter"].get_param(
"beesdoo_shift_attendance.pre_filled_task_type_id" "beesdoo_shift_attendance.pre_filled_task_type_id"

Loading…
Cancel
Save