Browse Source

[ADD] Improve Shift management

après avoir généré les shifts pour une semaine, rediriger vers les shifts générés : ok
Ajouter un supercoopérateur au niveau du template de shift. Pas de champs related car il faut pouvoir gérer les remplacements entre supercoopérateurs. : Rajouter un boolean sur res.users pour dire qu'ils sont super coopérateur du coup on peut choisir qu'un utilisateur super coopérateur : Ok
Sur la vue des shifts, permettre de sélectionner un ensemble de shifts pour pouvoir changer son supercoopérateur en une action : Ok
Avoir une vue des shifts par défaut plus lisible que le calendrier : KANBAN avec TODAY par défaut et les colonnes selon le type de shift : ok
Dans la vue KANBAN du planning des semaines, faire un tri sur la start date pour que ça ressemble à une vue calendrier :ok
Droits d'accès : 3 groupes :
modifier un shift existant et confirmer son statut : absence/présence
générer et supprimer des shifts à partir du template
modifier le template des semaines et gérer la config
En réfléchissant à ceux qui vont gérer les présences : il faudrait avoir une vue facile sur les shifts du jour et une manière simple de dire présent/absent/remplacé pour l'ensemble des coopérateurs présents (éviter de devoir chaque fois sélectionner le shift, cliquer sur le statut, aller au shift suivant, cliquer sur le statut...).
J'ai fait un nouveau point de menu avec une vue Kanban grouper par status, il suffit de faire du drag and drop pour changer le status, les shifts sont aussi filtré sur aujourd'hui et seulement ceux ayant un worker assigné.
pull/105/head
Thibault Francois 8 years ago
committed by Elouan
parent
commit
9fde3dc0be
  1. 6
      beesdoo_shift/__openerp__.py
  2. 37
      beesdoo_shift/data/stage.xml
  3. 1
      beesdoo_shift/models/__init__.py
  4. 7
      beesdoo_shift/models/planning.py
  5. 7
      beesdoo_shift/models/res_users.py
  6. 38
      beesdoo_shift/models/task.py
  7. 18
      beesdoo_shift/security/group.xml
  8. 18
      beesdoo_shift/security/ir.model.access.csv
  9. 6
      beesdoo_shift/views/planning.xml
  10. 13
      beesdoo_shift/views/res_users.xml
  11. 134
      beesdoo_shift/views/task.xml
  12. 27
      beesdoo_shift/views/task_template.xml
  13. 1
      beesdoo_shift/wizard/__init__.py
  14. 14
      beesdoo_shift/wizard/assign_super_coop.py
  15. 27
      beesdoo_shift/wizard/assign_super_coop.xml
  16. 9
      beesdoo_shift/wizard/batch_template.xml
  17. 14
      beesdoo_shift/wizard/instanciate_planning.py
  18. 4
      beesdoo_shift/wizard/instanciate_planning.xml

6
beesdoo_shift/__openerp__.py

@ -12,17 +12,21 @@
'author': "Thibault Francois", 'author': "Thibault Francois",
'website': "https://github.com/beescoop/Obeesdoo", 'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Coop',
'category': 'Cooperative management',
'version': '0.1', 'version': '0.1',
'depends': ['beesdoo_base'], 'depends': ['beesdoo_base'],
'data': [ 'data': [
"data/stage.xml",
"security/group.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",
"views/task_template.xml", "views/task_template.xml",
"views/task.xml", "views/task.xml",
"views/planning.xml", "views/planning.xml",
"views/res_users.xml",
"wizard/instanciate_planning.xml", "wizard/instanciate_planning.xml",
"wizard/batch_template.xml", "wizard/batch_template.xml",
"wizard/assign_super_coop.xml",
], ],
} }

37
beesdoo_shift/data/stage.xml

@ -0,0 +1,37 @@
<odoo>
<record model="beesdoo.shift.stage" id="draft">
<field name="name">Unconfirmed</field>
<field name="sequence">1</field>
<field name="color">0</field>
</record>
<record model="beesdoo.shift.stage" id="open">
<field name="name">Confirmed</field>
<field name="sequence">2</field>
<field name="color">5</field>
</record>
<record model="beesdoo.shift.stage" id="done">
<field name="name">Attended</field>
<field name="sequence">3</field>
<field name="color">1</field>
</record>
<record model="beesdoo.shift.stage" id="replaced">
<field name="name">Replaced</field>
<field name="sequence">4</field>
<field name="color">5</field>
</record>
<record model="beesdoo.shift.stage" id="absent">
<field name="name">Absent</field>
<field name="sequence">5</field>
<field name="color">2</field>
</record>
<record model="beesdoo.shift.stage" id="excused">
<field name="name">Excused</field>
<field name="sequence">6</field>
<field name="color">4</field>
</record>
<record model="beesdoo.shift.stage" id="cancel">
<field name="name">Cancelled</field>
<field name="sequence">7</field>
<field name="color">8</field>
</record>
</odoo>

1
beesdoo_shift/models/__init__.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import planning import planning
import task import task
import res_users

7
beesdoo_shift/models/planning.py

@ -44,12 +44,15 @@ class Planning(models.Model):
class TaskTemplate(models.Model): class TaskTemplate(models.Model):
_name = 'beesdoo.shift.template' _name = 'beesdoo.shift.template'
_order = 'start_time'
name = fields.Char(required=True) name = fields.Char(required=True)
planning_id = fields.Many2one('beesdoo.shift.planning', required=True) planning_id = fields.Many2one('beesdoo.shift.planning', required=True)
day_nb_id = fields.Many2one('beesdoo.shift.daynumber', string='Day', required=True) day_nb_id = fields.Many2one('beesdoo.shift.daynumber', string='Day', required=True)
task_type_id = fields.Many2one('beesdoo.shift.type', string="Type") task_type_id = fields.Many2one('beesdoo.shift.type', string="Type")
start_time = fields.Float(required=True) start_time = fields.Float(required=True)
end_time = fields.Float(required=True) end_time = fields.Float(required=True)
super_coop_id = fields.Many2one('res.users', string="Super Cooperative", domain=[('super', '=', True)])
duration = fields.Float(help="Duration in Hour") duration = fields.Float(help="Duration in Hour")
worker_nb = fields.Integer(string="Number of worker", help="Max number of worker for this task", default=1) worker_nb = fields.Integer(string="Number of worker", help="Max number of worker for this task", default=1)
@ -108,11 +111,13 @@ class TaskTemplate(models.Model):
for rec in self: for rec in self:
for i in xrange(0, rec.worker_nb): for i in xrange(0, rec.worker_nb):
tasks |= tasks.create({ tasks |= tasks.create({
'name' : "%s (%s) - (%s) [%s]" % (rec.name, float_to_time(rec.start_time), float_to_time(rec.end_time), i),
'name' : "%s %s (%s - %s) [%s]" % (rec.name, rec.day_nb_id.name, float_to_time(rec.start_time), float_to_time(rec.end_time), i),
'task_template_id' : rec.id, 'task_template_id' : rec.id,
'task_type_id' : rec.task_type_id.id, 'task_type_id' : rec.task_type_id.id,
'super_coop_id': rec.super_coop_id.id,
'worker_id' : rec.worker_ids[i].id if len(rec.worker_ids) > i else False, 'worker_id' : rec.worker_ids[i].id if len(rec.worker_ids) > i else False,
'start_time' : rec.start_date, 'start_time' : rec.start_date,
'end_time' : rec.end_date, 'end_time' : rec.end_date,
'stage_id': self.env.ref('beesdoo_shift.draft').id,
}) })
return tasks return tasks

7
beesdoo_shift/models/res_users.py

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import models, fields
class ResUsers(models.Model):
_inherit = 'res.users'
super = fields.Boolean("Super Cooperative")

38
beesdoo_shift/models/task.py

@ -1,22 +1,22 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields
STATES = [
('draft', 'Unconfirmed'),
('open', 'Confirmed'),
('done', 'Attended'),
('absent', 'Absent'),
('excused', 'Excused'),
('replaced', 'Replaced'),
('cancel', 'Cancelled'),
]
from openerp import models, fields, api
class TaskStage(models.Model):
_name = 'beesdoo.shift.stage'
_order = 'sequence asc'
name = fields.Char()
sequence = fields.Integer()
color = fields.Integer()
class Task(models.Model): class Task(models.Model):
_name = 'beesdoo.shift.shift' _name = 'beesdoo.shift.shift'
#EX01 ADD inheritance
_inherit = ['mail.thread'] _inherit = ['mail.thread']
_order = "start_time asc"
name = fields.Char(track_visibility='always') name = fields.Char(track_visibility='always')
task_template_id = fields.Many2one('beesdoo.shift.template') task_template_id = fields.Many2one('beesdoo.shift.template')
planning_id = fields.Many2one(related='task_template_id.planning_id', store=True) planning_id = fields.Many2one(related='task_template_id.planning_id', store=True)
@ -24,7 +24,9 @@ class Task(models.Model):
worker_id = fields.Many2one('res.partner', track_visibility='onchange', domain=[('eater', '=', 'worker_eater')]) worker_id = fields.Many2one('res.partner', track_visibility='onchange', domain=[('eater', '=', 'worker_eater')])
start_time = fields.Datetime(track_visibility='always') start_time = fields.Datetime(track_visibility='always')
end_time = fields.Datetime(track_visibility='always') end_time = fields.Datetime(track_visibility='always')
state = fields.Selection(STATES, default='draft', track_visibility='onchange')
stage_id = fields.Many2one('beesdoo.shift.stage', required=True, track_visibility='onchange')
super_coop_id = fields.Many2one('res.users', string="Super Cooperative", domain=[('super', '=', True)], track_visibility='onchange')
color = fields.Integer(related="stage_id.color", readonly=True)
def message_auto_subscribe(self, updated_fields, values=None): def message_auto_subscribe(self, updated_fields, values=None):
self._add_follower(values) self._add_follower(values)
@ -34,3 +36,13 @@ class Task(models.Model):
if vals.get('worker_id'): if vals.get('worker_id'):
worker = self.env['res.partner'].browse(vals['worker_id']) worker = self.env['res.partner'].browse(vals['worker_id'])
self.message_subscribe(partner_ids=worker.ids) self.message_subscribe(partner_ids=worker.ids)
@api.model
def _read_group_stage_id(self, ids, domain, read_group_order=None, access_rights_uid=None):
res = self.env['beesdoo.shift.stage'].search([]).name_get()
fold = dict.fromkeys([r[0] for r in res], False)
return res, fold
_group_by_full = {
'stage_id': _read_group_stage_id,
}

18
beesdoo_shift/security/group.xml

@ -0,0 +1,18 @@
<odoo>
<data noupdate="0">
<record id="group_shift_attendance" model="res.groups">
<field name="name">Shift Attendance</field>
<field name="category_id" ref="base.module_category_cooperative_management"/>
</record>
<record id="group_shift_management" model="res.groups">
<field name="name">Shift Management</field>
<field name="category_id" ref="base.module_category_cooperative_management"/>
<field name="implied_ids" eval="[(4, ref('group_shift_attendance'))]"/>
</record>
<record id="group_planning_management" model="res.groups">
<field name="name">Planning Management</field>
<field name="category_id" ref="base.module_category_cooperative_management"/>
<field name="implied_ids" eval="[(4, ref('group_shift_management'))]"/>
</record>
</data>
</odoo>

18
beesdoo_shift/security/ir.model.access.csv

@ -1,6 +1,14 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_coopplanning_task_type,access_coopplanning_task_type,model_beesdoo_shift_type,,1,1,1,1
access_coopplanning_daynumber,access_coopplanning_daynumber,model_beesdoo_shift_daynumber,,1,1,1,1
access_coopplanning_planning,access_coopplanning_planning,model_beesdoo_shift_planning,,1,1,1,1
access_coopplanning_task_template,access_coopplanning_task_template,model_beesdoo_shift_template,,1,1,1,1
access_coopplanning_task,access_coopplanning_task,model_beesdoo_shift_shift,,1,1,1,1
access_coopplanning_task_stage,Attendance Read Stage,model_beesdoo_shift_stage,group_shift_attendance,1,0,0,0
access_coopplanning_task_type,Attendance Read Type,model_beesdoo_shift_type,group_shift_attendance,1,0,0,0
access_coopplanning_daynumber,Attendance Read Daynumber,model_beesdoo_shift_daynumber,group_shift_attendance,1,0,0,0
access_coopplanning_planning,Attendance Read Planning,model_beesdoo_shift_planning,group_shift_attendance,1,0,0,0
access_coopplanning_task_template,Attendance Read Template,model_beesdoo_shift_template,group_shift_attendance,1,0,0,0
access_coopplanning_task,Attendance Edit Shift,model_beesdoo_shift_shift,group_shift_attendance,1,1,0,0
access_coopplanning_task_full,Shift Management all Shift,model_beesdoo_shift_shift,group_shift_management,1,1,1,1
all_config_coopplanning_task_stage,Attendance Read Stage,model_beesdoo_shift_stage,group_planning_management,1,1,1,1
all_config_coopplanning_task_type,Attendance Read Type,model_beesdoo_shift_type,group_planning_management,1,1,1,1
all_config_coopplanning_daynumber,Attendance Read Daynumber,model_beesdoo_shift_daynumber,group_planning_management,1,1,1,1
all_config_coopplanning_planning,Attendance Read Planning,model_beesdoo_shift_planning,group_planning_management,1,1,1,1
all_config_coopplanning_task_template,Attendance Read Template,model_beesdoo_shift_template,group_planning_management,1,1,1,1
all_config_coopplanning_task,Attendance Edit Shift,model_beesdoo_shift_shift,group_planning_management,1,1,1,1

6
beesdoo_shift/views/planning.xml

@ -15,7 +15,8 @@
<field name="view_mode">kanban,tree,form,calendar,pivot</field> <field name="view_mode">kanban,tree,form,calendar,pivot</field>
<field name="context">{'group_by': 'day_nb_id', <field name="context">{'group_by': 'day_nb_id',
'search_default_planning_id': active_id, 'search_default_planning_id': active_id,
'default_planning_id': active_id}</field>
'default_planning_id': active_id}
</field>
</record> </record>
<record model="ir.actions.act_window" id="action_generate_shift_wizard"> <record model="ir.actions.act_window" id="action_generate_shift_wizard">
@ -49,7 +50,8 @@
</div> </div>
<group> <group>
<button type="action" <button type="action"
name="%(action_generate_shift_wizard)d" string="Generate shifts" colspan="2"/>
name="%(action_generate_shift_wizard)d"
string="Generate shifts" colspan="2" />
</group> </group>
</sheet> </sheet>
</form> </form>

13
beesdoo_shift/views/res_users.xml

@ -0,0 +1,13 @@
<odoo>
<record model="ir.ui.view" id="super_coop_users_inherited_view_form">
<field name="name">Users Super Coop</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="super" />
</field>
</field>
</record>
</odoo>

134
beesdoo_shift/views/task.xml

@ -1,6 +1,6 @@
<odoo> <odoo>
<record model="ir.ui.view" id="task_view_tree"> <record model="ir.ui.view" id="task_view_tree">
<field name="name">Task Template List</field>
<field name="name">Shift List</field>
<field name="model">beesdoo.shift.shift</field> <field name="model">beesdoo.shift.shift</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
@ -8,12 +8,55 @@
<field name="planning_id" /> <field name="planning_id" />
<field name="task_type_id" /> <field name="task_type_id" />
<field name="name" /> <field name="name" />
<field name="super_coop_id" />
<field name="worker_id" /> <field name="worker_id" />
<field name="end_time" /> <field name="end_time" />
<field name="stage_id" />
</tree> </tree>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="task_view_search">
<field name="name">Shift Search</field>
<field name="model">beesdoo.shift.shift</field>
<field name="arch" type="xml">
<search>
<field name="planning_id" />
<field name="task_type_id" />
<field name="name" />
<field name="super_coop_id" />
<field name="worker_id" />
<group>
<filter string="My Team Shift"
domain="[('super_coop_id', '=', uid)]" />
<filter string="My Shift"
domain="[('worker_id.user_ids', 'in', uid)]" />
</group>
<group>
<filter string="Assigned" name="assigned"
domain="[('worker_id', '!=', False)]" />
<filter string="Unassigned" name="unassigned"
domain="[('worker_id', '=', False)]" />
</group>
<group>
<filter string="Today" name="today"
domain="[('end_time','&gt;', context_today().strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', context_today().strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="Attendance" name="attendance"
domain="[('end_time','&gt;', context_today().strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', context_today().strftime('%%Y-%%m-%%d 23:59:59')), ('worker_id', '!=', False)]" />
</group>
<filter string="Shift Template"
context="{'group_by' : 'task_template_id'}" />
<filter string="Type" name="gb_type"
context="{'group_by' : 'task_type_id'}" />
<filter string="Status" name="gb_status"
context="{'group_by' : 'stage_id'}" />
<filter string="Day" name="gb_day"
context="{'group_by' : 'start_time:day'}" />
</search>
</field>
</record>
<record model="ir.ui.view" id="task_view_calendar"> <record model="ir.ui.view" id="task_view_calendar">
<field name="name">Task Template List</field> <field name="name">Task Template List</field>
<field name="model">beesdoo.shift.shift</field> <field name="model">beesdoo.shift.shift</field>
@ -21,6 +64,7 @@
<calendar string="Calendar View" date_start="start_time" <calendar string="Calendar View" date_start="start_time"
date_stop="end_time" color="task_type_id"> date_stop="end_time" color="task_type_id">
<field name="name" /> <field name="name" />
<field name="super_coop_id" />
<field name="worker_id" /> <field name="worker_id" />
</calendar> </calendar>
</field> </field>
@ -32,7 +76,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<header> <header>
<field name="state" widget="statusbar" clickable="1" />
<field name="stage_id" widget="statusbar"
clickable="1" />
</header> </header>
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
@ -44,6 +89,7 @@
<group> <group>
<field name="task_template_id" /> <field name="task_template_id" />
<field name="task_type_id" /> <field name="task_type_id" />
<field name="super_coop_id" />
<field name="worker_id" /> <field name="worker_id" />
</group> </group>
<group> <group>
@ -61,17 +107,97 @@
</field> </field>
</record> </record>
<record model="ir.ui.view" id="task_shift_view_kanban">
<field name="name">Shift Kanban</field>
<field name="model">beesdoo.shift.shift</field>
<field name="arch" type="xml">
<kanban>
<field name="color" />
<field name="task_type_id" />
<field name="name" />
<field name="stage_id" />
<field name="worker_id" />
<field name="super_coop_id" />
<templates>
<t t-name="kanban-box">
<div
t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
<div class="o_dropdown_kanban dropdown"
groups="base.group_user">
<a class="dropdown-toggle btn"
data-toggle="dropdown" href="#">
<span class="fa fa-bars fa-lg" />
</a>
<ul class="dropdown-menu" role="menu"
aria-labelledby="dLabel">
<t t-if="widget.editable">
<li>
<a type="edit">Edit Shift</a>
</li>
</t>
</ul>
</div>
<div class="oe_kanban_content">
<strong>
<field name="name" />
</strong>
<div>
<field name="start_time"
widget="datetime" />
-
<field name="end_time" widget="datetime" />
</div>
<div>
Status:
<field name="stage_id" />
</div>
<div t-if="record.task_type_id.raw_value">
Type:
<field name="task_type_id" />
</div>
<div>
Worker:
<field name="worker_id" />
</div>
<div t-if="record.super_coop_id.raw_value">
Super Coop:
<field name="super_coop_id" />
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- Actions --> <!-- Actions -->
<record model="ir.actions.act_window" id="action_task"> <record model="ir.actions.act_window" id="action_task">
<field name="name">Task Action</field> <field name="name">Task Action</field>
<field name="res_model">beesdoo.shift.shift</field> <field name="res_model">beesdoo.shift.shift</field>
<field name="view_mode">calendar,tree,form,pivot</field>
<field name="view_mode">kanban,calendar,tree,form,pivot</field>
<field name="context">{'search_default_today': 1,
'search_default_gb_type':1}</field>
</record>
<record model="ir.actions.act_window" id="action_task_attendance">
<field name="name">Shift Attendance</field>
<field name="res_model">beesdoo.shift.shift</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_attendance': 1,
'search_default_gb_status':1}</field>
</record> </record>
<!-- Top menu item --> <!-- Top menu item -->
<menuitem name="Planning" id="menu_task_top" parent="menu_root" <menuitem name="Planning" id="menu_task_top" parent="menu_root"
sequence="1" /> sequence="1" />
<!-- actions --> <!-- actions -->
<menuitem name="Shift" id="menu_task" parent="menu_task_top" <menuitem name="Shift" id="menu_task" parent="menu_task_top"
action="action_task" />
action="action_task" groups="beesdoo_shift.group_shift_management" />
<menuitem name="Shift Attendance" id="menu_task_attendance"
parent="menu_task_top" action="action_task_attendance" />
</odoo> </odoo>

27
beesdoo_shift/views/task_template.xml

@ -6,8 +6,9 @@
<tree> <tree>
<field name="planning_id" /> <field name="planning_id" />
<field name="task_type_id" /> <field name="task_type_id" />
<field name="name" />
<field name="day_nb_id" /> <field name="day_nb_id" />
<field name="name" />
<field name="super_coop_id" />
<field name="start_time" /> <field name="start_time" />
<field name="end_time" /> <field name="end_time" />
<field name="duration" /> <field name="duration" />
@ -25,8 +26,10 @@
<field name="name" /> <field name="name" />
<field name="planning_id" /> <field name="planning_id" />
<field name="task_type_id" /> <field name="task_type_id" />
<field name="super_coop_id" />
<field name="day_nb_id" /> <field name="day_nb_id" />
<field name="worker_ids" /> <field name="worker_ids" />
<filter string="My Team Shift" domain="[('super_coop_id', '=', uid)]" />
<filter string="Planning" context="{'group_by':'planning_id'}" /> <filter string="Planning" context="{'group_by':'planning_id'}" />
<filter string="Week Day" context="{'group_by':'day_nb_id'}" /> <filter string="Week Day" context="{'group_by':'day_nb_id'}" />
<filter string="Place Available" name="available" <filter string="Place Available" name="available"
@ -59,6 +62,7 @@
<field name="start_time" widget="float_time" /> <field name="start_time" widget="float_time" />
<field name="duration" widget="float_time" /> <field name="duration" widget="float_time" />
<field name="end_time" widget="float_time" /> <field name="end_time" widget="float_time" />
<field name="super_coop_id" />
</group> </group>
</group> </group>
<separator string="Recurring Workers" /> <separator string="Recurring Workers" />
@ -75,6 +79,7 @@
<calendar string="Calendar View" date_start="start_date" <calendar string="Calendar View" date_start="start_date"
date_stop="end_date" color="task_type_id"> date_stop="end_date" color="task_type_id">
<field name="name" /> <field name="name" />
<field name="super_coop_id" />
<field name="worker_ids" /> <field name="worker_ids" />
</calendar> </calendar>
</field> </field>
@ -93,10 +98,12 @@
<field name="worker_nb" /> <field name="worker_nb" />
<field name="worker_ids" /> <field name="worker_ids" />
<field name="worker_name" /> <field name="worker_name" />
<field name="super_coop_id" />
<templates> <templates>
<t t-name="kanban-box"> <t t-name="kanban-box">
<div <div
t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"> t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
<t t-if="widget.editable">
<div class="o_dropdown_kanban dropdown" <div class="o_dropdown_kanban dropdown"
groups="base.group_user"> groups="base.group_user">
<a class="dropdown-toggle btn" <a class="dropdown-toggle btn"
@ -108,7 +115,8 @@
<t t-if="widget.editable"> <t t-if="widget.editable">
<li> <li>
<a type="edit">Edit Shift <a type="edit">Edit Shift
Template</a>
Template
</a>
</li> </li>
</t> </t>
<t t-if="widget.deletable"> <t t-if="widget.deletable">
@ -116,12 +124,14 @@
<a type="delete">Delete</a> <a type="delete">Delete</a>
</li> </li>
</t> </t>
<li> <li>
<ul class="oe_kanban_colorpicker" <ul class="oe_kanban_colorpicker"
data-field="color" /> data-field="color" />
</li> </li>
</ul> </ul>
</div> </div>
</t>
<div class="oe_kanban_content"> <div class="oe_kanban_content">
<strong> <strong>
<field name="name" /> <field name="name" />
@ -133,6 +143,11 @@
Type: Type:
<field name="task_type_id" /> <field name="task_type_id" />
</div> </div>
<div t-if="record.super_coop_id.raw_value">
Super Coop:
<field name="super_coop_id" />
</div>
<div> <div>
Worker Number: Worker Number:
<field name="worker_nb" /> <field name="worker_nb" />
@ -162,8 +177,10 @@
</field> </field>
</record> </record>
<menuitem name="Shift Management" id="menu_root" />
<menuitem name="Templates" id="menu_template_top" parent="menu_root" />
<menuitem name="Shift Management" id="menu_root"
groups="beesdoo_shift.group_shift_attendance" />
<menuitem name="Templates" id="menu_template_top" parent="menu_root"
groups="beesdoo_shift.group_shift_management" />
<!-- Configuration --> <!-- Configuration -->
@ -224,7 +241,7 @@
</field> </field>
</record> </record>
<menuitem name="Configuration" id="menu_configuration_top" <menuitem name="Configuration" id="menu_configuration_top"
parent="menu_root" />
parent="menu_root" groups="beesdoo_shift.group_planning_management" />
<record model="ir.actions.act_window" id="action_day_number"> <record model="ir.actions.act_window" id="action_day_number">
<field name="name">Day Number</field> <field name="name">Day Number</field>

1
beesdoo_shift/wizard/__init__.py

@ -1,2 +1,3 @@
import instanciate_planning import instanciate_planning
import batch_template import batch_template
import assign_super_coop

14
beesdoo_shift/wizard/assign_super_coop.py

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class AssignSuperCoop(models.TransientModel):
_name = 'beesddoo.shift.assign_super_coop'
super_coop_id = fields.Many2one('res.users', 'New Super Cooperative', required=True, domain=[('super', '=', True)])
shift_ids = fields.Many2many('beesdoo.shift.shift', readonly=True, default=lambda self: self._context.get('active_ids'))
@api.multi
def write_super_coop(self):
self.ensure_one()
self.shift_ids.write({'super_coop_id' : self.super_coop_id.id})

27
beesdoo_shift/wizard/assign_super_coop.xml

@ -0,0 +1,27 @@
<odoo>
<record model="ir.ui.view" id="assign_super_coop_view_form">
<field name="name">Assign Super Coop</field>
<field name="model">beesddoo.shift.assign_super_coop</field>
<field name="arch" type="xml">
<form>
<group>
<field name="super_coop_id" />
<field name="shift_ids" invisible="1" />
</group>
<footer>
<button type="object" name="write_super_coop"
string="Confirm" class="oe_highlight" />
or
<button special="cancel" string="Cancel" />
</footer>
</form>
</field>
</record>
<act_window id="act_assign_new_super_coop" name="Change Super Coop"
src_model="beesdoo.shift.shift" res_model="beesddoo.shift.assign_super_coop"
view_mode="form" target="new" key2="client_action_multi" />
</odoo>

9
beesdoo_shift/wizard/batch_template.xml

@ -10,7 +10,8 @@
</group> </group>
<group> <group>
<group> <group>
<separator string="Daily Schedule" colspan="2"/>
<separator string="Daily Schedule"
colspan="2" />
<field name="line_ids" nolabel="1"> <field name="line_ids" nolabel="1">
<tree editable="bottom"> <tree editable="bottom">
<field name="start_time" widget="float_time" /> <field name="start_time" widget="float_time" />
@ -20,7 +21,8 @@
</field> </field>
</group> </group>
<group> <group>
<separator string="Apply for Days" colspan="2"/>
<separator string="Apply for Days"
colspan="2" />
<field name="day_ids" nolabel="1"> <field name="day_ids" nolabel="1">
<tree> <tree>
<field name="name" /> <field name="name" />
@ -30,7 +32,8 @@
</group> </group>
</group> </group>
<footer> <footer>
<button type="object" name="generate" string="Confirm" class="oe_highlight"/>
<button type="object" name="generate" string="Confirm"
class="oe_highlight" />
or or
<button special="cancel" string="Cancel" /> <button special="cancel" string="Cancel" />
</footer> </footer>

14
beesdoo_shift/wizard/instanciate_planning.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp import models, fields, api, _
class InstanciatePlanning(models.TransientModel): class InstanciatePlanning(models.TransientModel):
@ -15,4 +15,14 @@ class InstanciatePlanning(models.TransientModel):
def generate_task(self): def generate_task(self):
self.ensure_one() self.ensure_one()
self = self.with_context(visualize_date=self.date_start) self = self.with_context(visualize_date=self.date_start)
self.planning_id.task_template_ids._generate_task_day()
shifts = self.planning_id.task_template_ids._generate_task_day()
return {
'name': _('Generated Shift'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'kanban,calendar,tree,form,pivot',
'res_model': 'beesdoo.shift.shift',
'target': 'current',
'domain': [('id', 'in', shifts.ids)],
'context' : {'search_default_gb_day': 1}
}

4
beesdoo_shift/wizard/instanciate_planning.xml

@ -9,12 +9,12 @@
<field name="planning_id" invisible="1" /> <field name="planning_id" invisible="1" />
</group> </group>
<footer> <footer>
<button type="object" name="generate_task" string="Confirm" class="oe_highlight"/>
<button type="object" name="generate_task"
string="Confirm" class="oe_highlight" />
or or
<button special="cancel" string="Cancel" /> <button special="cancel" string="Cancel" />
</footer> </footer>
</form> </form>
</field> </field>
</record> </record>
</odoo> </odoo>
Loading…
Cancel
Save