Compare commits
merge into: Myceliandre:12.0
Myceliandre:12.0
Myceliandre:12.0-beesdoo-easymycoo-fix
Myceliandre:12.0-beesdoo_account-imp-invoice-negative-amount
Myceliandre:12.0-beesdoo_base-fix-group-force-barcode
Myceliandre:12.0-beesdoo_purchase-adapt-product-purchase-selling-price
Myceliandre:12.0-beesdoo_shift-fix-action_worker
Myceliandre:12.0-beesdoo_shift-search-default-gb-type
Myceliandre:12.0-fix-b_emc-checkbox
Myceliandre:12.0-fix-b_s_attendance-shift_does_not_exists
Myceliandre:12.0-fix-b_shift-trad
Myceliandre:12.0-fix-beesdoo_shift-res_partner
Myceliandre:12.0-fix-cooperator_status
Myceliandre:12.0-macavrac-prod
Myceliandre:12.0-openupgrade
Myceliandre:12.0-pog-filter_product_on_supplier
Myceliandre:12.0-pos_keyboard
Myceliandre:12.0-posorder_amount_by_year
Myceliandre:12.0-pre-commit-target
Myceliandre:12.0-sc-effective-sale-price
Myceliandre:12.0-supplier_margin
Myceliandre:12.0-tasmeilleurtemps
Myceliandre:20181114_155
Myceliandre:9.0
Myceliandre:9.0-bees-highlight_task_template
Myceliandre:9.0-beesdoo_shift-add-search-filter
Myceliandre:9.0-docker
Myceliandre:9.0-hide-countdown-date-unsuscribed
Myceliandre:9.0-po-add-partner
Myceliandre:9.0-s0055-beescard-remy-vincent
Myceliandre:9.0-shift6-welcome_screen-tfr
Myceliandre:9.0_warn_on_oversubscribe2
pull from: Myceliandre:12.0-macavrac-prod
Myceliandre:12.0
Myceliandre:12.0-beesdoo-easymycoo-fix
Myceliandre:12.0-beesdoo_account-imp-invoice-negative-amount
Myceliandre:12.0-beesdoo_base-fix-group-force-barcode
Myceliandre:12.0-beesdoo_purchase-adapt-product-purchase-selling-price
Myceliandre:12.0-beesdoo_shift-fix-action_worker
Myceliandre:12.0-beesdoo_shift-search-default-gb-type
Myceliandre:12.0-fix-b_emc-checkbox
Myceliandre:12.0-fix-b_s_attendance-shift_does_not_exists
Myceliandre:12.0-fix-b_shift-trad
Myceliandre:12.0-fix-beesdoo_shift-res_partner
Myceliandre:12.0-fix-cooperator_status
Myceliandre:12.0-macavrac-prod
Myceliandre:12.0-openupgrade
Myceliandre:12.0-pog-filter_product_on_supplier
Myceliandre:12.0-pos_keyboard
Myceliandre:12.0-posorder_amount_by_year
Myceliandre:12.0-pre-commit-target
Myceliandre:12.0-sc-effective-sale-price
Myceliandre:12.0-supplier_margin
Myceliandre:12.0-tasmeilleurtemps
Myceliandre:20181114_155
Myceliandre:9.0
Myceliandre:9.0-bees-highlight_task_template
Myceliandre:9.0-beesdoo_shift-add-search-filter
Myceliandre:9.0-docker
Myceliandre:9.0-hide-countdown-date-unsuscribed
Myceliandre:9.0-po-add-partner
Myceliandre:9.0-s0055-beescard-remy-vincent
Myceliandre:9.0-shift6-welcome_screen-tfr
Myceliandre:9.0_warn_on_oversubscribe2
10 Commits
12.0
...
12.0-macav
Author | SHA1 | Message | Date |
---|---|---|---|
Thibault Francois |
4137864ca7
|
Update task.py
|
4 years ago |
Thibault Francois |
c0484b2d94
|
Update my_shift_website_templates.xml
|
4 years ago |
Thibault Francois | ed097db682 |
[WIP] 4
|
4 years ago |
Thibault Francois | baf7775e1b |
[WIP] final wip to clean
|
4 years ago |
Thibault Francois |
30a5fc707e
|
[FIX] can unsubscribe
delta is between date in the future and now not the opposite To get the full timedelta in hours we should get the days number and the seconds |
4 years ago |
Thibault Francois | fd3ae85656 |
[WIP] 2
|
4 years ago |
odoo-pda | ddf9296b23 |
[ADD] send (un)subscribed mail when worker is
changed. |
4 years ago |
odoo-pda | 83304986e3 |
[FIX] open instead as draft doesnt exist anymore
|
4 years ago |
Thibault Francois | 785a7df304 |
[WIP]
|
4 years ago |
Thibault Francois | bd66a9808e |
[FIX] beesdoo_shift: dynamic selection field
Add lambda so there is no more need to redefine field states Add parameter today to _get_irregular_worker_domain Move specific constrains to beesdoo_worker_status |
4 years ago |
17 changed files with 2384 additions and 176 deletions
-
13beesdoo_shift/models/cooperative_status.py
-
41beesdoo_shift/models/task.py
-
2beesdoo_shift/views/cooperative_status.xml
-
2beesdoo_website_shift/controllers/main.py
-
169beesdoo_website_shift/views/my_shift_website_templates.xml
-
3beesdoo_worker_status/models/cooperative_status.py
-
40beesdoo_worker_status/models/task.py
-
1macavrac_base/__init__.py
-
8macavrac_base/__manifest__.py
-
1macavrac_base/controllers/__init__.py
-
16macavrac_base/controllers/main.py
-
16macavrac_base/data/mail_template.xml
-
1746macavrac_base/i18n/fr_BE.po
-
1macavrac_base/models/__init__.py
-
285macavrac_base/models/planning.py
-
25macavrac_base/models/res_partner.py
-
191macavrac_base/views/shift.xml
@ -1 +1,2 @@ |
|||||
from . import models |
from . import models |
||||
|
from . import controllers |
@ -0,0 +1 @@ |
|||||
|
from . import main |
@ -0,0 +1,16 @@ |
|||||
|
|
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
from werkzeug.exceptions import Forbidden |
||||
|
|
||||
|
class WebsiteMacavracShiftController(http.Controller): |
||||
|
|
||||
|
@http.route("/shift/<int:shift_id>/unsubscribe", auth="user", website=True) |
||||
|
def unsubscribe_to_shift(self, shift_id=-1, **kw): |
||||
|
shift = request.env["beesdoo.shift.shift"].sudo().browse(shift_id) |
||||
|
# Get current user |
||||
|
if request.env.user.partner_id != shift.worker_id or not shift.can_unsubscribe: |
||||
|
raise Forbidden() |
||||
|
shift.worker_id = False |
||||
|
return request.redirect(kw["nexturl"]) |
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Mail template are declared in a NOUPDATE block |
||||
|
so users can freely customize/delete them --> |
||||
|
<data noupdate="1"> |
||||
|
<record id="email_template_shift_subscribed" model="mail.template"> |
||||
|
<field name="name">Shift Subscribed</field> |
||||
|
<field name="model_id" ref="model_beesdoo_shift_shift"/> |
||||
|
</record> |
||||
|
|
||||
|
<record id="email_template_shift_unsubscribed" model="mail.template"> |
||||
|
<field name="name">Shift Unsubscribed</field> |
||||
|
<field name="model_id" ref="model_beesdoo_shift_shift"/> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
1746
macavrac_base/i18n/fr_BE.po
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1,2 @@ |
|||||
from . import res_partner |
from . import res_partner |
||||
|
from . import planning |
@ -0,0 +1,285 @@ |
|||||
|
from datetime import datetime |
||||
|
|
||||
|
from odoo import api, models, fields |
||||
|
from odoo.addons.beesdoo_shift.models.cooperative_status import add_days_delta |
||||
|
|
||||
|
class TaskType(models.Model): |
||||
|
_inherit = "beesdoo.shift.type" |
||||
|
|
||||
|
super_only = fields.Boolean('Referent Only') |
||||
|
|
||||
|
class TaskTemplate(models.Model): |
||||
|
_inherit = 'beesdoo.shift.template' |
||||
|
|
||||
|
super_only = fields.Boolean(related="task_type_id.super_only") |
||||
|
shift_presence_value = fields.Float(default=1.0) |
||||
|
|
||||
|
class WizardSubscribe(models.TransientModel): |
||||
|
_inherit = 'beesdoo.shift.subscribe' |
||||
|
|
||||
|
def _get_mode(self): |
||||
|
partner = self.env["res.partner"].browse(self._context.get("active_id")) |
||||
|
return partner.working_mode or 'irregular' |
||||
|
|
||||
|
working_mode = fields.Selection(selection=[ |
||||
|
("irregular", "worker"), |
||||
|
("exempt", "Exempted"), |
||||
|
], default=_get_mode) |
||||
|
|
||||
|
class Task(models.Model): |
||||
|
_inherit = 'beesdoo.shift.shift' |
||||
|
|
||||
|
can_unsubscribe = fields.Boolean(compute="_compute_can_unsubscribe") |
||||
|
super_only = fields.Boolean(related="task_type_id.super_only") |
||||
|
|
||||
|
def _get_selection_status(self): |
||||
|
return [ |
||||
|
("open","Confirmed"), |
||||
|
("done","Attended"), |
||||
|
("absent","Absent"), |
||||
|
("cancel","Cancelled") |
||||
|
] |
||||
|
|
||||
|
def _get_counter_date_state_change(self, new_state): |
||||
|
""" |
||||
|
Return the cooperator_status of the cooperator that need to be |
||||
|
change and data that need to be change. It does not perform the |
||||
|
change directly. The cooperator_status will be changed by the |
||||
|
_change_counter function. |
||||
|
|
||||
|
Check has been done to ensure that worker is legitimate. |
||||
|
""" |
||||
|
data = {} |
||||
|
status = self.worker_id.cooperative_status_ids[0] |
||||
|
if new_state == "done": |
||||
|
data['sr'] = self.task_template_id.shift_presence_value or 1.0 |
||||
|
|
||||
|
return data, status |
||||
|
|
||||
|
def _compute_can_unsubscribe(self): |
||||
|
now = datetime.now() |
||||
|
ICP = self.env["ir.config_parameter"].sudo() |
||||
|
max_hours = int(ICP.get_param("max_hours_to_unsubscribe", 2)) |
||||
|
for rec in self: |
||||
|
if now > rec.start_time or rec.state != 'open': |
||||
|
rec.can_unsubscribe = False |
||||
|
else: |
||||
|
delta = (rec.start_time - now) |
||||
|
delta = delta.seconds / 3600.0 + delta.days * 24 |
||||
|
rec.can_unsubscribe = delta >= max_hours |
||||
|
|
||||
|
|
||||
|
# def write(self, vals): |
||||
|
# if 'worker_id' in vals: |
||||
|
# template_unsubscribed = self.env.ref("macavrac_base.email_template_shift_unsubscribed") |
||||
|
# template_subscribed = self.env.ref("macavrac_base.email_template_shift_subscribed") |
||||
|
# new_worker_id = self.env['beesdoo.shift.shift'].browse(vals.get('worker_id')) |
||||
|
# for record in self: |
||||
|
# old_worker_id = record.worker_id |
||||
|
# if old_worker_id: |
||||
|
# template_unsubscribed.send_mail(record.id) |
||||
|
# if new_worker_id and old_worker_id != new_worker_id: |
||||
|
# res = super(Task, record).write(vals) |
||||
|
# template_subscribed.send_mail(record.id) |
||||
|
# return super(Task, self).write(vals) |
||||
|
|
||||
|
|
||||
|
class CooperativeStatus(models.Model): |
||||
|
_inherit = 'cooperative.status' |
||||
|
|
||||
|
def _get_status(self): |
||||
|
return [ |
||||
|
("ok", "Up to Date"), |
||||
|
("alert", "Alerte"), |
||||
|
("suspended", "Suspended"), |
||||
|
("exempted", "Exempted"), |
||||
|
("unsubscribed", "Unsubscribed"), |
||||
|
("resigning", "Resigning"), |
||||
|
] |
||||
|
# TODO auto init for automatic migration |
||||
|
sr = fields.Float() |
||||
|
future_alert_date = fields.Date(compute="_compute_future_alert_date") |
||||
|
next_countdown_date = fields.Date(compute="_compute_next_countdown_date") |
||||
|
|
||||
|
######################################################## |
||||
|
# Method to override # |
||||
|
# To define the behavior of the status # |
||||
|
# # |
||||
|
# By default: everyone is always up to date # |
||||
|
######################################################## |
||||
|
|
||||
|
############################## |
||||
|
# Computed field section # |
||||
|
############################## |
||||
|
def _next_countdown_date(self, irregular_start_date, today): |
||||
|
""" |
||||
|
Return the next countdown date given irregular_start_date and |
||||
|
today dates. |
||||
|
This does not take holiday and other status into account. |
||||
|
""" |
||||
|
|
||||
|
delta = (today - irregular_start_date).days |
||||
|
if not delta % self._period: |
||||
|
return today |
||||
|
return add_days_delta(today, self._period - (delta % self._period)) |
||||
|
|
||||
|
|
||||
|
@api.depends( |
||||
|
"today", |
||||
|
"sr", |
||||
|
"temporary_exempt_start_date", |
||||
|
"temporary_exempt_end_date", |
||||
|
) |
||||
|
def _compute_future_alert_date(self): |
||||
|
"""Compute date before which the worker is up to date""" |
||||
|
for rec in self: |
||||
|
#TODO fix infinite loop |
||||
|
rec.future_alert_date = False |
||||
|
continue |
||||
|
# Only for irregular worker |
||||
|
# Alert start time already set |
||||
|
real_today = rec.today |
||||
|
if rec.alert_start_time: |
||||
|
rec.future_alert_date = False |
||||
|
elif rec.working_mode != "irregular" or not rec.irregular_start_date: |
||||
|
rec.future_alert_date = False |
||||
|
else: |
||||
|
date = rec.today |
||||
|
counter = rec.sr |
||||
|
next_countdown_date = False |
||||
|
while counter >= 0: |
||||
|
next_countdown_date = self._next_countdown_date(rec.irregular_start_date, date) |
||||
|
rec.today = next_countdown_date |
||||
|
if rec.status != 'exempted': |
||||
|
counter -= 1 |
||||
|
rec.today = real_today |
||||
|
date = add_days_delta(next_countdown_date, 1) |
||||
|
rec.future_alert_date = next_countdown_date |
||||
|
rec.today = real_today |
||||
|
|
||||
|
|
||||
|
@api.depends( |
||||
|
"today", |
||||
|
"irregular_start_date", |
||||
|
"holiday_start_time", |
||||
|
"holiday_end_time", |
||||
|
"temporary_exempt_start_date", |
||||
|
"temporary_exempt_end_date", |
||||
|
) |
||||
|
def _compute_next_countdown_date(self): |
||||
|
""" |
||||
|
Compute the following countdown date. This date is the date when |
||||
|
the worker will see his counter changed du to the cron. This |
||||
|
date is like the birthday date of the worker that occurred each |
||||
|
PERIOD. |
||||
|
""" |
||||
|
for rec in self: |
||||
|
#TODO fix infinite loop |
||||
|
rec.next_countdown_date = False |
||||
|
continue |
||||
|
real_today = rec.today |
||||
|
# Only for irregular worker |
||||
|
if rec.working_mode != "irregular" or not rec.irregular_start_date: |
||||
|
rec.next_countdown_date = False |
||||
|
else: |
||||
|
next_countdown_date = rec.today |
||||
|
while True: |
||||
|
next_countdown_date = self._next_countdown_date(rec.irregular_start_date, next_countdown_date) |
||||
|
rec.today = next_countdown_date |
||||
|
if rec.status != 'exempted': |
||||
|
rec.next_countdown_date = next_countdown_date |
||||
|
rec.today = real_today |
||||
|
break |
||||
|
else: |
||||
|
next_countdown_date = add_days_delta(next_countdown_date, 1) |
||||
|
|
||||
|
##################################### |
||||
|
# Status Change implementation # |
||||
|
##################################### |
||||
|
|
||||
|
def _get_regular_status(self): |
||||
|
""" |
||||
|
Return the value of the status |
||||
|
for the regular worker |
||||
|
""" |
||||
|
ICP = self.env["ir.config_parameter"].sudo() |
||||
|
suspended_count = int(ICP.get_param("suspended_count", -2)) |
||||
|
unsubscribed_count = int(ICP.get_param("unsubscribed_count", -4)) |
||||
|
if (self.temporary_exempt_start_date |
||||
|
and self.temporary_exempt_end_date |
||||
|
and self.today >= self.temporary_exempt_start_date |
||||
|
and self.today <= self.temporary_exempt_end_date |
||||
|
): |
||||
|
return 'exempted' |
||||
|
if self.sr >= 0: |
||||
|
return 'ok' |
||||
|
|
||||
|
if self.sr <= unsubscribed_count: |
||||
|
return 'unsubscribed' |
||||
|
if self.sr <= suspended_count: |
||||
|
return 'suspended' |
||||
|
if self.sr < 0: |
||||
|
return 'alert' |
||||
|
return 'ok' |
||||
|
|
||||
|
def _get_irregular_status(self): |
||||
|
""" |
||||
|
Return the value of the status |
||||
|
for the irregular worker |
||||
|
""" |
||||
|
return self._get_regular_status() |
||||
|
|
||||
|
def _state_change(self, new_state): |
||||
|
""" |
||||
|
Hook to watch change in the state |
||||
|
""" |
||||
|
self.ensure_one() |
||||
|
if new_state == "unsubscribed" or new_state == "resigning": |
||||
|
# Remove worker from task_templates |
||||
|
self.cooperator_id.sudo().write( |
||||
|
{"subscribed_shift_ids": [(5, 0, 0)]} |
||||
|
) |
||||
|
# Remove worker from supercoop in task_templates |
||||
|
task_tpls = self.env["beesdoo.shift.template"].search( |
||||
|
[("super_coop_id", "in", self.cooperator_id.user_ids.ids)] |
||||
|
) |
||||
|
task_tpls.write({"super_coop_id": False}) |
||||
|
# Remove worker for future tasks (remove also supercoop) |
||||
|
self.env["beesdoo.shift.shift"].sudo().unsubscribe_from_today( |
||||
|
[self.cooperator_id.id], now=fields.Datetime.now() |
||||
|
) |
||||
|
if new_state == "alert": |
||||
|
self.write({"alert_start_time": self.today}) |
||||
|
|
||||
|
def _change_counter(self, data): |
||||
|
""" |
||||
|
Call when a shift state is changed |
||||
|
use data generated by _get_counter_date_state_change |
||||
|
""" |
||||
|
self.sr += data.get("sr", 0) |
||||
|
|
||||
|
|
||||
|
############################################### |
||||
|
###### Irregular Cron implementation ########## |
||||
|
############################################### |
||||
|
|
||||
|
def _get_irregular_worker_domain(self, today): |
||||
|
""" |
||||
|
return the domain the give the list |
||||
|
of valid irregular worker that should |
||||
|
get their counter changed by the cron |
||||
|
""" |
||||
|
return [ |
||||
|
("status", "not in", ["unsubscribed", "exempted", "resigning"]), |
||||
|
("irregular_start_date", "!=", False), |
||||
|
] |
||||
|
|
||||
|
def _change_irregular_counter(self): |
||||
|
""" |
||||
|
Define how the counter will change |
||||
|
for the irregular worker |
||||
|
where today - start_date is a multiple of the period |
||||
|
by default 28 days |
||||
|
""" |
||||
|
self.sr -= 1 |
||||
|
|
@ -0,0 +1,191 @@ |
|||||
|
<odoo> |
||||
|
<record model="ir.ui.view" id="type_view_form_inherit"> |
||||
|
<field name="name">Shift Type Form Inherit</field> |
||||
|
<field name="model">beesdoo.shift.type</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.type_view_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="name" position="after"> |
||||
|
<field name="super_only" /> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="task_template_view_form_inherit"> |
||||
|
<field name="name">Task Template Form Inherit</field> |
||||
|
<field name="model">beesdoo.shift.template</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.task_template_view_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="super_coop_id" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="task_type_id" position="after"> |
||||
|
<field name="super_only" invisible="1" /> |
||||
|
<field name="shift_presence_value" /> |
||||
|
</field> |
||||
|
<field name="worker_ids" position="attributes"> |
||||
|
<attribute name="domain">[("is_worker", "=", True), ('need_referent', '=', super_only)]</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="task_view_form_inherit"> |
||||
|
<field name="name">Task Form inherit</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.task_view_form" /> |
||||
|
<field name="model">beesdoo.shift.shift</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="super_coop_id" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="replaced_id" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="is_regular" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="is_compensation" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="task_type_id" position="after"> |
||||
|
<field name="super_only" invisible="1" /> |
||||
|
</field> |
||||
|
<field name="worker_id" position="attributes"> |
||||
|
<attribute name="domain">[('cooperative_status_ids.status', 'not in', ('unsubscribed', 'resigning')), ('need_referent', '=', super_only)]</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="coop_status_form_view_inherit"> |
||||
|
<field name="name">Coop Status Form View Inherit</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.coop_status_form_view" /> |
||||
|
<field name="model">cooperative.status</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="irregular_start_date" position="attributes"> |
||||
|
<attribute name="attrs" ></attribute> |
||||
|
<attribute name="string">Start date</attribute> |
||||
|
</field> |
||||
|
<field name="sc" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="time_extension" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="extension_start_time" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="info_session" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="info_session_date" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="irregular_absence_counter" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="irregular_absence_date" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="holiday_start_time" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
<field name="holiday_end_time" position="attributes"> |
||||
|
<attribute name="invisible" >1</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.ui.view" id="super_coop_partner_inherited_view_form"> |
||||
|
<field name="name">Partner Macavrac</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.super_coop_partner_inherited_view_form"/> |
||||
|
<field name="priority">50</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<button name="coop_subscribe" string="Subscribe to shift" |
||||
|
class="oe_highlight" |
||||
|
type="object" |
||||
|
groups="beesdoo_shift.group_shift_management" |
||||
|
attrs="{'invisible': [('is_worker', '=', False)]}"/> |
||||
|
<button name="auto_extension" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</button> |
||||
|
<button name="manual_extension" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</button> |
||||
|
<button name="register_holiday" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</button> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
<!-- Wizard view modification --> |
||||
|
<record model="ir.ui.view" id="subscribe_coop_wizard_view_form_inherit"> |
||||
|
<field name="name">Subscribe Cooperator</field> |
||||
|
<field name="model">beesdoo.shift.subscribe</field> |
||||
|
<field name="inherit_id" ref="beesdoo_shift.subscribe_coop_wizard_view_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="shift_id" position="attributes"> |
||||
|
<attribute name="attrs"></attribute> |
||||
|
</field> |
||||
|
<field name="info_session" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="info_session_date" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
<field name="reset_compensation_counter" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<template id="my_shift" name="Shifts for Irregular Workers" |
||||
|
inherit_id="beesdoo_website_shift.my_shift_next_shifts"> |
||||
|
<xpath expr="//t[@t-esc='shift.task_type_id.name']" position="after"> |
||||
|
<button type="button" |
||||
|
class="btn btn-danger btn-sm pull-right" |
||||
|
data-toggle="modal" |
||||
|
t-att-data-target="'#unsubscribe-shift-%s' % shift.id" |
||||
|
t-if="shift.can_unsubscribe" > |
||||
|
<span class="fa fa-user-plus" aria-hidden="true"></span> |
||||
|
Unsubscribe |
||||
|
</button> |
||||
|
</xpath> |
||||
|
<xpath expr="//div[@t-if='shift.super_coop_id.name']/.." position="after"> |
||||
|
<t t-foreach="subscribed_shifts" t-as="shift"> |
||||
|
<div class="modal fade" |
||||
|
t-att-id="'unsubscribe-shift-%s' % shift.id" tabindex="-1" |
||||
|
role="dialog" |
||||
|
t-att-aria-labelledby="'unsubscribe-shift-%s-label' % shift.id"> |
||||
|
<div class="modal-dialog" role="document"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h4 class="modal-title" |
||||
|
t-att-id="'subscribe-shift-%s-label' % shift.id"> |
||||
|
Please confirm unsubscriptions |
||||
|
</h4> |
||||
|
</div> |
||||
|
<div class="modal-body"> |
||||
|
<span t-field="shift.start_time"/> |
||||
|
- |
||||
|
<span t-field="shift.end_time" |
||||
|
t-options='{"format": "HH:mm"}'/> |
||||
|
<br/> |
||||
|
<t t-esc="shift.task_type_id.name"/> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-default" |
||||
|
data-dismiss="modal">Close |
||||
|
</button> |
||||
|
<a class="btn btn-primary" |
||||
|
t-if="irregular_enable_sign_up" |
||||
|
t-att-href="'/shift/%s/unsubscribe?nexturl=%s' % (shift.id, nexturl)"> |
||||
|
Unsubscribe |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue