Browse Source

[REF] b_shift : task_type_default -> pre_filled_task_type

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
52c18bcc52
  1. 4
      beesdoo_shift/data/system_parameter.xml
  2. 4
      beesdoo_shift/i18n/fr.po
  3. 4
      beesdoo_shift/i18n/fr_BE.po
  4. 4
      beesdoo_shift/i18n/nl_BE.po
  5. 8
      beesdoo_shift/models/attendance_sheet.py
  6. 10
      beesdoo_shift/models/res_config_settings.py
  7. 8
      beesdoo_shift/tests/test_beesdoo_shift.py
  8. 4
      beesdoo_shift/views/res_config_settings_view.xml

4
beesdoo_shift/data/system_parameter.xml

@ -39,8 +39,8 @@
<field name="key">beesdoo_shift.attendance_sheet_generation_interval</field> <field name="key">beesdoo_shift.attendance_sheet_generation_interval</field>
<field name="value">15</field> <field name="value">15</field>
</record> </record>
<record id="beesdoo_shift.task_type_default_id" model="ir.config_parameter">
<field name="key">beesdoo_shift.task_type_default_id</field>
<record id="beesdoo_shift.pre_filled_task_type_id" model="ir.config_parameter">
<field name="key">beesdoo_shift.pre_filled_task_type_id</field>
<field name="value">1</field> <field name="value">1</field>
</record> </record>
</odoo> </odoo>

4
beesdoo_shift/i18n/fr.po

@ -852,12 +852,12 @@ msgid "Day ids"
msgstr "Ids des jours" msgstr "Ids des jours"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default Task Type" msgid "Default Task Type"
msgstr "Type de tâche par défaut" msgstr "Type de tâche par défaut"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default task type for attendance sheet pre-filling" msgid "Default task type for attendance sheet pre-filling"
msgstr "Type de shift par défaut pour le remplissage automatique des feuilles de présence" msgstr "Type de shift par défaut pour le remplissage automatique des feuilles de présence"

4
beesdoo_shift/i18n/fr_BE.po

@ -852,12 +852,12 @@ msgid "Day ids"
msgstr "Ids des jours" msgstr "Ids des jours"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default Task Type" msgid "Default Task Type"
msgstr "Type de tâche par défaut" msgstr "Type de tâche par défaut"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default task type for attendance sheet pre-filling" msgid "Default task type for attendance sheet pre-filling"
msgstr "Type de shift par défaut pour le remplissage automatique des feuilles de présence" msgstr "Type de shift par défaut pour le remplissage automatique des feuilles de présence"

4
beesdoo_shift/i18n/nl_BE.po

@ -838,12 +838,12 @@ msgid "Day ids"
msgstr "Day ids" msgstr "Day ids"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,field_description:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default Task Type" msgid "Default Task Type"
msgstr "Standaard Soort taak" msgstr "Standaard Soort taak"
#. module: beesdoo_shift #. module: beesdoo_shift
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_task_type_default_id
#: model:ir.model.fields,help:beesdoo_shift.field_beesdoo_shift_config_settings_pre_filled_task_type_id
msgid "Default task type for attendance sheet pre-filling" msgid "Default task type for attendance sheet pre-filling"
msgstr "Standaard soort taak toe te kennen bij voor-invullen van aanwezigheidslijst" msgstr "Standaard soort taak toe te kennen bij voor-invullen van aanwezigheidslijst"

8
beesdoo_shift/models/attendance_sheet.py

@ -13,11 +13,11 @@ class AttendanceSheetShift(models.AbstractModel):
_order = "task_type_id, worker_name" _order = "task_type_id, worker_name"
@api.model @api.model
def task_type_default_id(self):
def pre_filled_task_type_id(self):
parameters = self.env["ir.config_parameter"].sudo() parameters = self.env["ir.config_parameter"].sudo()
id = int( id = int(
parameters.get_param( parameters.get_param(
"beesdoo_shift.default_task_type_id", default=1
"beesdoo_shift.pre_filled_task_type_id", default=1
) )
) )
task_types = self.env["beesdoo.shift.type"] task_types = self.env["beesdoo.shift.type"]
@ -53,7 +53,7 @@ class AttendanceSheetShift(models.AbstractModel):
) )
worker_name = fields.Char(related="worker_id.name", store=True) worker_name = fields.Char(related="worker_id.name", store=True)
task_type_id = fields.Many2one( task_type_id = fields.Many2one(
"beesdoo.shift.type", string="Task Type", default=task_type_default_id
"beesdoo.shift.type", string="Task Type", default=pre_filled_task_type_id
) )
working_mode = fields.Selection( working_mode = fields.Selection(
related="worker_id.working_mode", string="Working Mode" related="worker_id.working_mode", string="Working Mode"
@ -383,7 +383,7 @@ class AttendanceSheet(models.Model):
# Added shift creation # Added shift creation
self.added_shift_ids |= self.added_shift_ids.new( self.added_shift_ids |= self.added_shift_ids.new(
{ {
"task_type_id": self.added_shift_ids.task_type_default_id(),
"task_type_id": self.added_shift_ids.pre_filled_task_type_id(),
"state": "done", "state": "done",
"attendance_sheet_id": self._origin.id, "attendance_sheet_id": self._origin.id,
"worker_id": worker.id, "worker_id": worker.id,

10
beesdoo_shift/models/res_config_settings.py

@ -13,7 +13,7 @@ class ResConfigSettings(models.TransientModel):
string="Scan cooperators cards instead of login for sheets validation", string="Scan cooperators cards instead of login for sheets validation",
config_parameter="beesdoo_shift.card_support", config_parameter="beesdoo_shift.card_support",
) )
task_type_default_id = fields.Many2one(
pre_filled_task_type_id = fields.Many2one(
"beesdoo.shift.type", "beesdoo.shift.type",
string="Default Task Type", string="Default Task Type",
help="Default task type for attendance sheet pre-filling", help="Default task type for attendance sheet pre-filling",
@ -35,8 +35,8 @@ class ResConfigSettings(models.TransientModel):
"beesdoo_shift.card_support", str(self.card_support), "beesdoo_shift.card_support", str(self.card_support),
) )
parameters.set_param( parameters.set_param(
"beesdoo_shift.task_type_default_id",
str(self.task_type_default_id.id),
"beesdoo_shift.pre_filled_task_type_id",
str(self.pre_filled_task_type_id.id),
) )
parameters.set_param( parameters.set_param(
"beesdoo_shift.attendance_sheet_generation_interval", "beesdoo_shift.attendance_sheet_generation_interval",
@ -52,9 +52,9 @@ class ResConfigSettings(models.TransientModel):
"beesdoo_shift.card_support" "beesdoo_shift.card_support"
), ),
), ),
task_type_default_id=int(
pre_filled_task_type_id=int(
self.env["ir.config_parameter"].get_param( self.env["ir.config_parameter"].get_param(
"beesdoo_shift.task_type_default_id"
"beesdoo_shift.pre_filled_task_type_id"
) )
), ),
) )

8
beesdoo_shift/tests/test_beesdoo_shift.py

@ -20,8 +20,8 @@ class TestBeesdooShift(TransactionCase):
] ]
self.shift_expected_model = self.env["beesdoo.shift.sheet.expected"] self.shift_expected_model = self.env["beesdoo.shift.sheet.expected"]
self.shift_added_model = self.env["beesdoo.shift.sheet.added"] self.shift_added_model = self.env["beesdoo.shift.sheet.added"]
self.task_type_default_id = self.env["ir.config_parameter"].sudo().get_param(
"beesdoo_shift.task_type_default_id"
self.pre_filled_task_type_id = self.env["ir.config_parameter"].sudo().get_param(
"beesdoo_shift.pre_filled_task_type_id"
) )
self.current_time = datetime.now() self.current_time = datetime.now()
@ -165,7 +165,7 @@ class TestBeesdooShift(TransactionCase):
# Set generation interval setting # Set generation interval setting
setting_wizard_1 = self.setting_wizard.create( setting_wizard_1 = self.setting_wizard.create(
{ {
"task_type_default_id": self.task_type_1.id,
"pre_filled_task_type_id": self.task_type_1.id,
"attendance_sheet_generation_interval": 15, "attendance_sheet_generation_interval": 15,
} }
) )
@ -281,7 +281,7 @@ class TestBeesdooShift(TransactionCase):
self.assertEqual(shift.state, "done") self.assertEqual(shift.state, "done")
self.assertEqual( self.assertEqual(
shift.task_type_id, shift.task_type_id,
self.attendance_sheet_shift_model.task_type_default_id(),
self.attendance_sheet_shift_model.pre_filled_task_type_id(),
) )
if shift.working_mode == "regular": if shift.working_mode == "regular":
self.assertTrue(shift.is_compensation) self.assertTrue(shift.is_compensation)

4
beesdoo_shift/views/res_config_settings_view.xml

@ -77,8 +77,8 @@
</div> </div>
<div class="content-group"> <div class="content-group">
<div class="mt16 row"> <div class="mt16 row">
<label for="task_type_default_id" string="Default Task Type" class="col-3 col-lg-3 o_light_label"/>
<field name="task_type_default_id" class="oe_inline" required="1"/>
<label for="pre_filled_task_type_id" string="Default Task Type" class="col-3 col-lg-3 o_light_label"/>
<field name="pre_filled_task_type_id" class="oe_inline" required="1"/>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save