Browse Source

[ADD] b_w_shift: Message for new worker

pull/70/head
nicolasjamoulle 6 years ago
committed by Rémy Taymans
parent
commit
1d53e2b71a
  1. 26
      beesdoo_website_shift/controllers/main.py
  2. 6
      beesdoo_website_shift/i18n/fr_BE.po
  3. 76
      beesdoo_website_shift/views/my_shift_website_templates.xml

26
beesdoo_website_shift/controllers/main.py

@ -18,6 +18,11 @@ from openerp.addons.beesdoo_shift.models.cooperative_status import PERIOD
class WebsiteShiftController(http.Controller):
def is_user_worker(self):
user = request.env['res.users'].browse(request.uid)
share_type = user.partner_id.cooperator_type
return share_type == 'share_a'
def is_user_irregular(self):
user = request.env['res.users'].browse(request.uid)
working_mode = user.partner_id.working_mode
@ -28,6 +33,11 @@ class WebsiteShiftController(http.Controller):
working_mode = user.partner_id.working_mode
return working_mode == 'regular'
def is_user_regular_without_shift(self):
user = request.env['res.users'].browse(request.uid)
return (not user.partner_id.subscribed_shift_ids.id
and self.is_user_regular())
def is_user_exempted(self):
user = request.env['res.users'].browse(request.uid)
working_mode = user.partner_id.working_mode
@ -89,6 +99,11 @@ class WebsiteShiftController(http.Controller):
'beesdoo_website_shift.my_shift_irregular_worker',
self.my_shift_irregular_worker(nexturl='/my/shift')
)
if self.is_user_regular_without_shift():
return request.render(
'beesdoo_website_shift.my_shift_regular_worker_without_shift',
self.my_shift_regular_worker_without_shift()
)
if self.is_user_regular():
return request.render(
'beesdoo_website_shift.my_shift_regular_worker',
@ -99,6 +114,11 @@ class WebsiteShiftController(http.Controller):
'beesdoo_website_shift.my_shift_exempted_worker',
self.my_shift_exempted_worker()
)
if self.is_user_worker():
return request.render(
'beesdoo_website_shift.my_shift_new_worker',
{}
)
return request.render(
'beesdoo_website_shift.my_shift_non_worker',
@ -199,6 +219,12 @@ class WebsiteShiftController(http.Controller):
return template_context
def my_shift_regular_worker_without_shift(self):
"""
Return template variables for 'beesdoo_website_shift.my_shift_regular_worker_without_shift' template
"""
return self.my_shift_worker_status()
def my_shift_regular_worker(self):
"""
Return template variables for 'beesdoo_website_shift.my_shift_regular_worker' template

6
beesdoo_website_shift/i18n/fr_BE.po

@ -566,6 +566,12 @@ msgstr "Vous êtes un supercoopérateur"
msgid "You don't have to participate to shift system."
msgstr "Vous ne devez pas participer au système de shift."
#. module: beesdoo_website_shift
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_new_worker
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_regular_worker_without_shift
msgid "Please contact the members office to suscribe to shifts."
msgstr "Merci de contacter le bureau des membres pour vous inscrire à un créneau de travail."
#. module: beesdoo_website_shift
#: model:ir.ui.view,arch_db:beesdoo_website_shift.my_shift_next_shifts
msgid "Your next shifts"

76
beesdoo_website_shift/views/my_shift_website_templates.xml

@ -638,6 +638,32 @@
</t>
</template>
<!-- Shift for new worker -->
<template
id="my_shift_new_worker"
name="My Shift for New Worker"
page="True">
<t t-call="website.layout">
<t t-call="beesdoo_website_shift.my_shift_title"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
Please contact the members office to suscribe to shifts.
</div>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
</t>
</template>
<!-- Shifts Exempted Workers -->
<template
id="my_shift_exempted_worker"
@ -691,6 +717,56 @@
</t>
</template>
<!-- Shifts regular worker without shift -->
<template
id="my_shift_regular_worker_without_shift"
name="My Shifts for regular worker without shift"
page="True">
<t t-call="website.layout">
<t t-call="beesdoo_website_shift.my_shift_title"/>
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-4 pull-right text-justify">
<t t-call="beesdoo_website_shift.my_shift_worker_status_title"/>
<t t-call="beesdoo_website_shift.my_shift_worker_status_common"/>
<div class="oe_structure"/>
</div>
<div class="col-xs-12 col-md-8">
<section class="wrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info">
Please contact the members office to suscribe to shifts.
</div>
</div>
</div>
</div>
</section>
<div class="oe_structure"/>
</div> <!-- col-md-8 -->
</div> <!-- row -->
</div> <!-- container -->
</section>
<div class="oe_structure"/>
</t>
</template>
<!-- Shifts for Regular Workers -->
<template
id="my_shift_regular_worker"

Loading…
Cancel
Save