Browse Source

Revert "[ADD] b_shift : attendance sheet default super cooperator"

This reverts commit 605ac1853f.
pull/125/head
Elouan Le Bars 5 years ago
parent
commit
9a7a7249e5
  1. 27
      beesdoo_shift/models/attendance_sheet.py
  2. 13
      beesdoo_shift/views/attendance_sheet.xml

27
beesdoo_shift/models/attendance_sheet.py

@ -165,14 +165,6 @@ class AttendanceSheet(models.Model):
end_time = fields.Datetime(string="End Time", required=True, readonly=True)
day = fields.Date(string="Day", compute="_compute_day", store=True)
default_super_coop_id = fields.Many2one(
"res.users",
string="Default Super Cooperative",
help="Super Cooperative for default Task Type",
domain=[("partner_id.super", "=", True)],
compute="_compute_default_super_coop_id",
store=True,
)
expected_shift_ids = fields.One2many(
"beesdoo.shift.sheet.expected",
"attendance_sheet_id",
@ -218,6 +210,7 @@ class AttendanceSheet(models.Model):
string="Validated by",
domain=[
("eater", "=", "worker_eater"),
("super", "=", True),
("working_mode", "=", "regular"),
("state", "not in", ("unsubscribed", "resigning")),
],
@ -266,23 +259,12 @@ class AttendanceSheet(models.Model):
rec.day = fields.Date.from_string(rec.start_time)
@api.depends("expected_shift_ids")
def _compute_default_super_coop_id(self):
def _compute_week(self):
"""
Look for the super cooperator of a shift
with default Task Type
Compute Week Name from Planning Name of first expected shift
"""
for rec in self:
default_task_type = rec.env[
"beesdoo.shift.sheet.expected"
].default_task_type_id()
shift = rec.expected_shift_ids.search(
[
("task_type_id", "=", default_task_type.id),
("super_coop_id", "!=", False),
],
limit=1,
)
rec.default_super_coop_id = shift.super_coop_id
rec.week = rec.expected_shift_ids.task_id.planning_id.name
@api.depends("annotation")
def _compute_is_annotated(self):
@ -407,7 +389,6 @@ class AttendanceSheet(models.Model):
"worker_id": task.worker_id.id,
"replacement_worker_id": task.replaced_id.id,
"task_type_id": task.task_type_id.id,
"super_coop_id": task.super_coop_id.id,
"stage": stage,
"working_mode": task.working_mode,
}

13
beesdoo_shift/views/attendance_sheet.xml

@ -8,7 +8,6 @@
<field name="arch" type="xml">
<search>
<field name="day" />
<field name="default_super_coop_id" />
<field name="validated_by" />
<filter string="Annotated (unread)"
domain="[('is_annotated', '=', True),
@ -35,7 +34,6 @@
decoration-danger="stage == 'absent_0' or stage == 'absent_1' or stage == 'absent_2'"
decoration-success="stage == 'present'">
<field name="task_type_id" readonly="True" options="{'no_open': True}"/>
<field name="super_coop_id" readonly="True" options="{'no_open': True}"/>
<field name="worker_id" readonly="True" options="{'no_open': True}"/>
<field name="working_mode" />
<field name="replacement_worker_id"
@ -107,12 +105,10 @@
<field name="name">Attendance Sheet List</field>
<field name="model">beesdoo.shift.sheet</field>
<field name="arch" type="xml">
<tree create="false" delete="false" default_order="start_time desc"
decoration-danger="state == 'not_validated'">
<field name="day" />
<field name="time_slot" />
<!-- <tree create="false" delete="false" decoration-danger="stage == 'absent'"> -->
<tree create="false" decoration-danger="state == 'not_validated'">
<field name="name"/>
<field name="max_worker_no" type="char"/>
<field name="default_super_coop_id" />
<field name="state" />
<field name="validated_by" />
<field name="is_annotated" />
@ -164,9 +160,6 @@
<field name="added_shift_ids"/>
<separator string="Expected workers" />
<field name="expected_shift_ids" />
<group string="Informations">
<field name="default_super_coop_id" />
</group>
<br/>
<group col="1" string="Feedback"
groups="beesdoo_shift.group_cooperative_admin">

Loading…
Cancel
Save