Browse Source

[MIG] beesdoo_website_shift: Migrate to 12.0

pull/133/head
Rémy Taymans 5 years ago
parent
commit
fd8d71a106
  1. 34
      beesdoo_website_shift/__manifest__.py
  2. 67
      beesdoo_website_shift/controllers/main.py
  3. 32
      beesdoo_website_shift/data/res_config_data.xml
  4. 11
      beesdoo_website_shift/migrations/9.0.2.1.1/post-migrate.py
  5. 1
      beesdoo_website_shift/models/__init__.py
  6. 125
      beesdoo_website_shift/models/res_config.py
  7. 47
      beesdoo_website_shift/models/website.py
  8. 1399
      beesdoo_website_shift/views/my_shift_website_templates.xml
  9. 180
      beesdoo_website_shift/views/res_config_views.xml
  10. 317
      beesdoo_website_shift/views/shift_website_templates.xml

34
beesdoo_website_shift/__manifest__.py

@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
# Copyright 2017-2020 Coop IT Easy (http://coopiteasy.be)
# Rémy Taymans <remy@coopiteasy.be>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'BEES coop Website Shift', 'name': 'BEES coop Website Shift',
'summary': """ 'summary': """
Show available shifts for regular and irregular workers on the Show available shifts for regular and irregular workers on the
website and let workers manage their shifts with an website and let workers manage their shifts with an
@ -13,20 +11,16 @@
""", """,
'description': """ 'description': """
""", """,
'author': 'Rémy Taymans',
'license': 'AGPL-3',
'version': '9.0.2.3.1',
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management',
'depends': ['website', 'beesdoo_shift'],
'data': [
'data/res_config_data.xml',
'views/shift_website_templates.xml',
'views/my_shift_website_templates.xml',
'views/res_config_views.xml',
]
"author": "Coop IT Easy SCRLfs",
"license": "AGPL-3",
"version": "12.0.1.0.0",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Cooperative management",
"depends": ["portal", "website", "beesdoo_shift"],
"data": [
"data/res_config_data.xml",
"views/shift_website_templates.xml",
"views/my_shift_website_templates.xml",
"views/res_config_views.xml",
],
} }

67
beesdoo_website_shift/controllers/main.py

@ -1,6 +1,5 @@
# -*- coding: utf8 -*-
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
# Copyright 2017-2020 Coop IT Easy (http://coopiteasy.be)
# Rémy Taymans <remy@coopiteasy.be>
# Copyright 2017-2018 Thibault François # Copyright 2017-2018 Thibault François
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@ -141,23 +140,18 @@ class WebsiteShiftController(http.Controller):
# Get the shift # Get the shift
shift = request.env['beesdoo.shift.shift'].sudo().browse(shift_id) shift = request.env['beesdoo.shift.shift'].sudo().browse(shift_id)
# Get config # Get config
irregular_enable_sign_up = literal_eval(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.irregular_enable_sign_up'))
irregular_enable_sign_up = request.website.irregular_enable_sign_up
# Set start time limit as defined in beesdoo_shift settings # Set start time limit as defined in beesdoo_shift settings
setting = int(
request.env["ir.config_parameter"].get_param(
"beesdoo_shift.attendance_sheet_generation_interval"
)
)
start_time_limit = datetime.now() + timedelta(minutes=setting)
shift_start_time = fields.Datetime.from_string(shift.start_time)
# TODO: Move this into the attendance_sheet module
# setting = request.website.attendance_sheet_generation_interval
start_time_limit = datetime.now() # + timedelta(minutes=setting)
request.session['success'] = False request.session['success'] = False
if (irregular_enable_sign_up if (irregular_enable_sign_up
and self.user_can_subscribe() and self.user_can_subscribe()
and shift and shift
and shift.state == "open" and shift.state == "open"
and shift_start_time > start_time_limit
and shift.start_time > start_time_limit
and not shift.worker_id): and not shift.worker_id):
shift.worker_id = cur_user.partner_id shift.worker_id = cur_user.partner_id
request.session['success'] = True request.session['success'] = True
@ -192,11 +186,7 @@ class WebsiteShiftController(http.Controller):
task_templates = template.sudo().search([], order="planning_id, day_nb_id, start_time") task_templates = template.sudo().search([], order="planning_id, day_nb_id, start_time")
# Get config # Get config
regular_highlight_rule = literal_eval(
request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.regular_highlight_rule'
)
)
regular_highlight_rule = request.website.regular_highlight_rule
task_tpls_data = [] task_tpls_data = []
for task_tpl in task_templates: for task_tpl in task_templates:
@ -220,8 +210,7 @@ class WebsiteShiftController(http.Controller):
Return template variables for 'beesdoo_website_shift.my_shift_irregular_worker' template Return template variables for 'beesdoo_website_shift.my_shift_irregular_worker' template
""" """
# Get config # Get config
irregular_enable_sign_up = literal_eval(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.irregular_enable_sign_up'))
irregular_enable_sign_up = request.website.irregular_enable_sign_up
# Create template context # Create template context
template_context = {} template_context = {}
@ -241,11 +230,11 @@ class WebsiteShiftController(http.Controller):
del request.session['success'] del request.session['success']
# Add setting for subscription allowed time # Add setting for subscription allowed time
subscription_time_limit = int(
request.env["ir.config_parameter"].get_param(
"beesdoo_shift.attendance_sheet_generation_interval"
)
)
# TODO: move this to the attendance_sheet module
# subscription_time_limit = (
# request.website.attendance_sheet_generation_interval
# )
subscription_time_limit = 0
template_context['subscription_time_limit'] = subscription_time_limit template_context['subscription_time_limit'] = subscription_time_limit
return template_context return template_context
@ -310,18 +299,9 @@ class WebsiteShiftController(http.Controller):
) )
# Get config # Get config
irregular_shift_limit = int(
request.env['ir.config_parameter']
.get_param('beesdoo_website_shift.irregular_shift_limit')
)
highlight_rule_pc = int(
request.env['ir.config_parameter']
.get_param('beesdoo_website_shift.highlight_rule_pc')
)
hide_rule = int(
request.env['ir.config_parameter']
.get_param('beesdoo_website_shift.hide_rule')
) / 100.0
irregular_shift_limit = request.website.irregular_shift_limit
highlight_rule_pc = request.website.highlight_rule_pc
hide_rule = request.website.hide_rule / 100.0
# Grouby task_template_id, if no task_template_id is specified # Grouby task_template_id, if no task_template_id is specified
# then group by start_time, if no start_time specified sort by # then group by start_time, if no start_time specified sort by
@ -405,8 +385,7 @@ class WebsiteShiftController(http.Controller):
) )
# Get config # Get config
regular_next_shift_limit = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.regular_next_shift_limit'))
regular_next_shift_limit = request.website.regular_next_shift_limit
shift_period = int(request.env['ir.config_parameter'].get_param( shift_period = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.shift_period')) 'beesdoo_website_shift.shift_period'))
@ -426,11 +405,11 @@ class WebsiteShiftController(http.Controller):
shift.revert_info = main_shift.revert_info shift.revert_info = main_shift.revert_info
# Set new date # Set new date
shift.start_time = self.add_days( shift.start_time = self.add_days(
fields.Datetime.from_string(main_shift.start_time),
main_shift.start_time,
days=i * shift_period days=i * shift_period
) )
shift.end_time = self.add_days( shift.end_time = self.add_days(
fields.Datetime.from_string(main_shift.end_time),
main_shift.end_time,
days=i * shift_period days=i * shift_period
) )
# Add the fictive shift to the list of shift # Add the fictive shift to the list of shift
@ -450,11 +429,9 @@ class WebsiteShiftController(http.Controller):
# Get config # Get config
past_shift_limit = 0 past_shift_limit = 0
if self.is_user_irregular(): if self.is_user_irregular():
past_shift_limit = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.irregular_past_shift_limit'))
past_shift_limit = request.website.irregular_past_shift_limit
if self.is_user_regular(): if self.is_user_regular():
past_shift_limit = int(request.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.regular_past_shift_limit'))
past_shift_limit = request.website.regular_past_shift_limit
# Get shifts where user was subscribed # Get shifts where user was subscribed
now = datetime.now() now = datetime.now()
if past_shift_limit > 0: if past_shift_limit > 0:

32
beesdoo_website_shift/data/res_config_data.xml

@ -5,38 +5,6 @@
--> -->
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<record id="beesdoo_website_shift.irregular_shift_limit" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.irregular_shift_limit</field>
<field name="value">0</field>
</record>
<record id="beesdoo_website_shift.highlight_rule_pc" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.highlight_rule_pc</field>
<field name="value">30</field>
</record>
<record id="beesdoo_website_shift.hide_rule" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.hide_rule</field>
<field name="value">20</field>
</record>
<record id="beesdoo_website_shift.irregular_enable_sign_up" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.irregular_enable_sign_up</field>
<field name="value">True</field>
</record>
<record id="beesdoo_website_shift.irregular_past_shift_limit" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.irregular_past_shift_limit</field>
<field name="value">10</field>
</record>
<record id="beesdoo_website_shift.regular_past_shift_limit" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.regular_past_shift_limit</field>
<field name="value">10</field>
</record>
<record id="beesdoo_website_shift.regular_next_shift_limit" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.regular_next_shift_limit</field>
<field name="value">13</field>
</record>
<record id="beesdoo_website_shift.regular_highlight_rule" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.regular_highlight_rule</field>
<field name="value">20</field>
</record>
<record id="beesdoo_website_shift.shift_period" model="ir.config_parameter"> <record id="beesdoo_website_shift.shift_period" model="ir.config_parameter">
<field name="key">beesdoo_website_shift.shift_period</field> <field name="key">beesdoo_website_shift.shift_period</field>
<field name="value">28</field> <field name="value">28</field>

11
beesdoo_website_shift/migrations/9.0.2.1.1/post-migrate.py

@ -1,11 +0,0 @@
# coding: utf-8
def migrate(cr, version):
"""Create a sequence for beesdoo_website_shift_config_settings."""
cr.execute(
"""
CREATE SEQUENCE IF NOT EXISTS
beesdoo_website_shift_config_settings_id_seq
"""
)

1
beesdoo_website_shift/models/__init__.py

@ -1 +1,2 @@
from . import website
from . import res_config from . import res_config

125
beesdoo_website_shift/models/res_config.py

@ -1,136 +1,45 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
# Copyright 2017-2020 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from ast import literal_eval from ast import literal_eval
from odoo import fields, models, api from odoo import fields, models, api
PARAMS = [
('irregular_shift_limit', 'beesdoo_website_shift.irregular_shift_limit'),
('highlight_rule_pc', 'beesdoo_website_shift.highlight_rule_pc'),
('hide_rule', 'beesdoo_website_shift.hide_rule'),
('irregular_enable_sign_up',
'beesdoo_website_shift.irregular_enable_sign_up'),
('irregular_past_shift_limit',
'beesdoo_website_shift.irregular_past_shift_limit'),
('regular_past_shift_limit',
'beesdoo_website_shift.regular_past_shift_limit'),
('regular_next_shift_limit',
'beesdoo_website_shift.regular_next_shift_limit'),
('regular_highlight_rule',
'beesdoo_website_shift.regular_highlight_rule'),
]
class WebsiteShiftConfigSettings(models.TransientModel): class WebsiteShiftConfigSettings(models.TransientModel):
_name = 'beesdoo.website.shift.config.settings'
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
# Irregular worker settings # Irregular worker settings
irregular_shift_limit = fields.Integer( irregular_shift_limit = fields.Integer(
help="Maximum shift that will be shown"
related='website_id.irregular_shift_limit',
readonly=False,
) )
highlight_rule_pc = fields.Integer( highlight_rule_pc = fields.Integer(
help="Treshold (in %) of available space in a shift that trigger the "
"highlight of the shift"
related='website_id.highlight_rule_pc',
readonly=False,
) )
hide_rule = fields.Integer( hide_rule = fields.Integer(
help="Treshold ((available space)/(max space)) in percentage of "
"available space under wich the shift is hidden"
related='website_id.highlight_rule_pc',
readonly=False,
) )
irregular_enable_sign_up = fields.Boolean( irregular_enable_sign_up = fields.Boolean(
help="Enable shift sign up for irregular worker"
related='website_id.irregular_enable_sign_up',
readonly=False,
) )
irregular_past_shift_limit = fields.Integer( irregular_past_shift_limit = fields.Integer(
help="Maximum past shift that will be shown for irregular worker"
related='website_id.irregular_past_shift_limit',
readonly=False,
) )
# Regular worker settings # Regular worker settings
regular_past_shift_limit = fields.Integer( regular_past_shift_limit = fields.Integer(
help="Maximum past shift that will be shown for regular worker"
related='website_id.regular_past_shift_limit',
readonly=False,
) )
regular_next_shift_limit = fields.Integer( regular_next_shift_limit = fields.Integer(
help="Maximun number of next shift that will be shown"
related='website_id.regular_next_shift_limit',
readonly=False,
) )
regular_highlight_rule = fields.Integer( regular_highlight_rule = fields.Integer(
help="Treshold (in %) of available space in a shift that trigger the "
"the highlight of a shift template."
related='website_id.regular_highlight_rule',
readonly=False,
) )
@api.multi
def set_params(self):
self.ensure_one()
for field_name, key_name in PARAMS:
value = getattr(self, field_name)
self.env['ir.config_parameter'].set_param(key_name, str(value))
@api.multi
def get_default_irregular_shift_limit(self):
return {
'irregular_shift_limit': int(
self.env['ir.config_parameter']
.get_param("beesdoo_website_shift.irregular_shift_limit")
)
}
@api.multi
def get_default_highlight_rule_pc(self):
return {
'highlight_rule_pc': int(
self.env['ir.config_parameter']
.get_param("beesdoo_website_shift.highlight_rule_pc")
)
}
@api.multi
def get_default_hide_rule(self):
return {
'hide_rule': int(self.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.hide_rule'))
}
@api.multi
def get_default_irregular_shift_sign_up(self):
return {
'irregular_enable_sign_up':
literal_eval(self.env['ir.config_parameter'].get_param(
'beesdoo_website_shift.irregular_enable_sign_up'))
}
@api.multi
def get_default_irregular_past_shift_limit(self):
return {
'irregular_past_shift_limit': int(
self.env['ir.config_parameter']
.get_param("beesdoo_website_shift.irregular_past_shift_limit")
)
}
@api.multi
def get_default_regular_past_shift_limit(self):
return {
'regular_past_shift_limit': int(
self.env['ir.config_parameter']
.get_param('beesdoo_website_shift.regular_past_shift_limit')
)
}
@api.multi
def get_default_regular_next_shift_limit(self):
return {
'regular_next_shift_limit': int(
self.env['ir.config_parameter']
.get_param('beesdoo_website_shift.regular_next_shift_limit')
)
}
@api.multi
def get_default_regular_highlight_rule(self):
return {
'regular_highlight_rule': int(
self.env['ir.config_parameter']
.get_param('beesdoo_website_shift.regular_highlight_rule')
)
}

47
beesdoo_website_shift/models/website.py

@ -0,0 +1,47 @@
# Copyright 2017-2020 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class Website(models.Model):
_inherit = 'website'
# Irregular worker settings
irregular_shift_limit = fields.Integer(
default=0,
help="Maximum shift that will be shown"
)
highlight_rule_pc = fields.Integer(
default=30,
help="Treshold (in %) of available space in a shift that trigger the "
"highlight of the shift"
)
hide_rule = fields.Integer(
default=20,
help="Treshold ((available space)/(max space)) in percentage of "
"available space under wich the shift is hidden"
)
irregular_enable_sign_up = fields.Boolean(
default=True,
help="Enable shift sign up for irregular worker"
)
irregular_past_shift_limit = fields.Integer(
default=10,
help="Maximum past shift that will be shown for irregular worker"
)
# Regular worker settings
regular_past_shift_limit = fields.Integer(
default=10,
help="Maximum past shift that will be shown for regular worker"
)
regular_next_shift_limit = fields.Integer(
default=13,
help="Maximun number of next shift that will be shown"
)
regular_highlight_rule = fields.Integer(
default=20,
help="Treshold (in %) of available space in a shift that trigger the "
"the highlight of a shift template."
)

1399
beesdoo_website_shift/views/my_shift_website_templates.xml
File diff suppressed because it is too large
View File

180
beesdoo_website_shift/views/res_config_views.xml

@ -4,101 +4,91 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <odoo>
<data>
<record id="view_website_shift_config_irregular" model="ir.ui.view"> <record id="view_website_shift_config_irregular" model="ir.ui.view">
<field name="name">Website Shift Settings Irregular Worker</field>
<field name="model">beesdoo.website.shift.config.settings</field>
<field name="arch" type="xml">
<form string="Configure Website Shift Irregular Worker" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/>
</header>
<div>
<label for="irregular_shift_limit"/>
<field name="irregular_shift_limit"/>
</div>
<div>
<label for="highlight_rule_pc"/>
<field name="highlight_rule_pc"/>
</div>
<div>
<label for="hide_rule"/>
<field name="hide_rule"/>
</div>
<div>
<label for="irregular_enable_sign_up"/>
<field name="irregular_enable_sign_up"/>
</div>
<div>
<label for="irregular_past_shift_limit"/>
<field name="irregular_past_shift_limit"/>
</div>
</form>
</field>
<field name="name">Website Shift Settings Irregular Worker</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="webmaster_settings" position="after">
<h2>Shift: Irregular Worker</h2>
<div class="row mt16 o_settings_container" id="shift_irregular_settings">
<div id="irregular_shift_limit_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="irregular_shift_limit"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="irregular_shift_limit"/>
</div>
</div>
</div>
<div id="highlight_rule_pc_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="highlight_rule_pc"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="highlight_rule_pc"/>
</div>
</div>
</div>
<div id="hide_rule_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="hide_rule"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="hide_rule"/>
</div>
</div>
</div>
<div id="irregular_enable_sign_up_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="irregular_enable_sign_up"/>
</div>
<div class="o_setting_right_pane">
<label for="irregular_enable_sign_up"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
</div>
</div>
<div id="irregular_past_shift_limit_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="irregular_past_shift_limit"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="irregular_past_shift_limit"/>
</div>
</div>
</div>
</div>
<h2>Shift: Regular Worker</h2>
<div class="row mt16 o_settings_container" id="shift_regular_settings">
<div id="regular_past_shift_limit_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="regular_past_shift_limit"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="regular_past_shift_limit"/>
</div>
</div>
</div>
<div id="regular_next_shift_limit_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="regular_next_shift_limit"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="regular_next_shift_limit"/>
</div>
</div>
</div>
<div id="regular_highlight_rule_settings" class="col-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="regular_highlight_rule"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="mt8">
<field name="regular_highlight_rule"/>
</div>
</div>
</div>
</div>
</div>
</field>
</record> </record>
<record id="view_website_shift_config_regular" model="ir.ui.view">
<field name="name">Website Shift Settings Regular Worker</field>
<field name="model">beesdoo.website.shift.config.settings</field>
<field name="arch" type="xml">
<form string="Configure Website Shift Regular Worker" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/>
</header>
<div>
<label for="regular_past_shift_limit"/>
<field name="regular_past_shift_limit"/>
</div>
<div>
<label for="regular_next_shift_limit"/>
<field name="regular_next_shift_limit"/>
</div>
<div>
<label for="regular_highlight_rule"/>
<field name="regular_highlight_rule"/>
</div>
</form>
</field>
</record>
<record id="action_website_shift_config_irregular" model="ir.actions.act_window">
<field name="name">Website Shift Settings Irregular Worker</field>
<field name="res_model">beesdoo.website.shift.config.settings</field>
<field name="view_id" ref="view_website_shift_config_irregular"/>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<record id="action_website_shift_config_regular" model="ir.actions.act_window">
<field name="name">Website Shift Settings Regular Worker</field>
<field name="res_model">beesdoo.website.shift.config.settings</field>
<field name="view_id" ref="view_website_shift_config_regular"/>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem
id="menu_website_shift_root"
name="Shift"
parent="website.menu_website_configuration"
sequence="20"/>
<menuitem
id="menu_website_shift_irregular"
name="Irregular Shift"
action="action_website_shift_config_irregular"
parent="menu_website_shift_root"
sequence="1"/>
<menuitem
id="menu_website_shift_regular"
name="Regular Shift"
action="action_website_shift_config_regular"
parent="menu_website_shift_root"
sequence="10"/>
</data>
</odoo> </odoo>

317
beesdoo_website_shift/views/shift_website_templates.xml

@ -1,211 +1,158 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2017-2018 Rémy Taymans <remytaymans@gmail.com>
Copyright 2017-2020 Rémy Taymans <remytaymans@gmail.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <odoo>
<!-- Add menu entries -->
<data noupdate="1">
<record id="menu_work_irregular" model="website.menu">
<field name="name">Shifts Irregular</field>
<field name="url">/shift_irregular_worker</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">50</field>
</record>
<record id="menu_work_regular" model="website.menu">
<field name="name">Shifts Regular</field>
<field name="url">/shift_template_regular_worker</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">51</field>
</record>
</data>
<template
id="public_shift_template_regular_worker"
name="Available Tasks Templates for Regular Workers"
<!-- Add menu entries -->
<data noupdate="1">
<record id="menu_work_irregular" model="website.menu">
<field name="name">Shifts Irregular</field>
<field name="url">/shift_irregular_worker</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">50</field>
</record>
<record id="menu_work_regular" model="website.menu">
<field name="name">Shifts Regular</field>
<field name="url">/shift_template_regular_worker</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">51</field>
</record>
</data>
<!-- Help texts -->
<template
id="help_text_public_shift_template_regular_worker"
name="Help text for public available shifts template for irregular worker"
> >
<t t-call="website.layout">
<p class="text-center">
Help text or information text.
</p>
</template>
<div class="oe_structure"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">
Available Tasks Templates for Regular Workers
</h1>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<p class="text-center">
Subscribe via the member office or via
<a href="mailto:membre@bees-coop.be">membre@bees-coop.be</a>
</p>
</div>
</div>
</div>
</section>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="oe_structure"/>
<div class="visible-xs" t-foreach="task_tpls_data" t-as="template_data">
<t t-set="template" t-value="template_data[0]"/>
<t t-set="has_enough_workers" t-value="template_data[1]"/>
<t t-set="highlight_class" t-value="'panel-warning' if not has_enough_workers else 'panel-default'"/>
<div t-att-class="'panel %s' % highlight_class">
<div class="panel-heading clearfix">
<div class="panel-title pull-left">
<t t-esc="template.planning_id.name"/> :
<t t-esc="template.day_nb_id.name"/>
<t t-esc='float_to_time(template.start_time)' /> -
<t t-esc='float_to_time(template.end_time)'/>
</div>
<div class="label label-default pull-right"
t-if="template.remaining_worker > 0">
<t t-esc="template.remaining_worker"/> space(s)
</div>
<div class="label label-default pull-right"
t-if="template.remaining_worker == 0">
full
<template
id="help_text_public_shift_irregular_worker"
name="Help text for public Available Shifts for Irregular Worker"
>
<p class="text-center">
Help text or information text.
</p>
</template>
<!-- Public Available Tasks Templates for Regular Workers -->
<template
id="public_shift_template_regular_worker"
name="Available Tasks Templates for Regular Workers"
>
<t t-call="portal.portal_layout">
<div class="o_regular_shift_template">
<div class="container mt32">
<div class="row mt4">
<div class="col">
<h1 class="text-center">
Available Tasks Templates for Regular Workers
</h1>
</div>
</div> </div>
</div>
<div class="panel-body clearfix">
<t t-esc="template.task_type_id.name"/>
<div class="label label-warning pull-right"
t-if="not template.super_coop_id">
Need Super Co-operator
<div class="row mt4">
<div class="col">
<t t-call="beesdoo_website_shift.help_text_public_shift_template_regular_worker"/>
</div>
</div> </div>
</div>
</div> </div>
</div>
<table class="hidden-xs table table-striped">
<thead>
<tr>
<th>Week</th>
<th>Day</th>
<th>Time</th>
<th>Type of Task</th>
<th>Super Co-operator</th>
<th class="text-center">Available Spaces</th>
</tr>
</thead>
<tbody>
<t t-foreach="task_tpls_data" t-as="template_data">
<t t-set="template" t-value="template_data[0]"/>
<t t-set="has_enough_workers" t-value="template_data[1]"/>
<!-- Row with no super coop will be shown in color -->
<tr t-attf-class="{{ 'warning' if not has_enough_workers else '' }}">
<td>
<t t-esc="template.planning_id.name"/>
</td>
<td>
<t t-esc="template.day_nb_id.name"/>
</td>
<td>
<t t-esc='float_to_time(template.start_time)' /> -
<t t-esc='float_to_time(template.end_time)'/>
</td>
<td>
<t t-esc="template.task_type_id.name"/>
</td>
<td>
<t t-if="template.super_coop_id">
Yes
</t>
<t t-if="not template.super_coop_id">
Not yet
</t>
</td>
<td class="text-center">
<t t-esc="template.remaining_worker"/>
</td>
</tr>
</t>
</tbody>
</table>
</div> <!-- col-md -->
</div> <!-- row -->
</div> <!-- container -->
</section>
<div class="oe_structure"/>
</t>
</template>
<!-- Public Available Shifts for Irregular Workers -->
<template
id="public_shift_irregular_worker"
name="Available Shifts for Irregular Workers"
>
<t t-call="website.layout">
<div class="oe_structure"/>
<div class="container mb64">
<div class="row mt4 justify-content-center">
<div class="col-12 col-lg-6">
<t t-foreach="task_tpls_data" t-as="template_data">
<t t-set="template" t-value="template_data[0]"/>
<t t-set="has_enough_workers" t-value="template_data[1]"/>
<t t-set="highlight_header_class" t-value="'bg-warning' if not has_enough_workers else ''"/>
<t t-set="highlight_class" t-value="'border-warning' if not has_enough_workers else ''"/>
<div t-att-class="'card mt-4 %s' % highlight_class">
<div t-att-class="'card-header %s clearfix' % highlight_header_class">
<div class="pull-left">
<t t-esc="template.planning_id.name"/> :
<t t-esc="template.day_nb_id.name"/>
<t t-esc='float_to_time(template.start_time)' /> -
<t t-esc='float_to_time(template.end_time)'/>
</div>
<div class="badge badge-secondary pull-right"
t-if="template.remaining_worker > 0">
<t t-esc="template.remaining_worker"/> space(s)
</div>
<div class="badge badge-secondary pull-right"
t-if="template.remaining_worker == 0">
full
</div>
</div>
<div class="card-body clearfix">
<t t-esc="template.task_type_id.name"/>
<div class="badge badge-warning pull-right"
t-if="not template.super_coop_id">
Need Super Co-operator
</div>
</div>
</div>
</t>
</div>
</div>
</div>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">
Available Shifts for Irregular Workers
</h1>
</div> </div>
</div>
</div>
</section>
<div class="oe_structure"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<p class="text-center">
Subscribe via <a href="mailto:volant@bees-coop.be">volant@bees-coop.be</a>
</p>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
</t>
</template>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<t t-call="beesdoo_website_shift.available_shift_irregular_worker"/>
<!-- Public Available Shifts for Irregular Workers -->
<template
id="public_shift_irregular_worker"
name="Available Shifts for Irregular Workers"
>
<t t-call="portal.portal_layout">
<t t-set="no_breadcrumbs" t-value="True"/>
<div class="o_regular_shift_template">
<div class="container mt32">
<div class="row mt4">
<div class="col">
<h1 class="text-center">
Available Shifts for Irregular Workers
</h1>
</div>
</div>
</div> <!-- col-md -->
</div> <!-- row -->
</div> <!-- container -->
</section>
<div class="row mt4">
<div class="col">
<t t-call="beesdoo_website_shift.help_text_public_shift_irregular_worker "/>
</div>
</div>
</div>
<div class="oe_structure"/>
<div class="container mb64">
<div class="row mt4 justify-content-center">
<div class="col-12 col-lg-6">
</t>
</template>
<t t-call="beesdoo_website_shift.available_shift_irregular_worker"/>
</div>
</div>
</div>
</div>
</t>
</template>
</odoo> </odoo>
Loading…
Cancel
Save