-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
12.0 polln #275
base: 12.0
Are you sure you want to change the base?
12.0 polln #275
Conversation
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
The module beesdoo_product does not need to depend on bessdoo base that introduce a lot of specific field (ie: for the beescard on res.partner)
Don't raise an error in computed field, if the value does not allow to compute the field properly fallbaclk on default value raise an error may forbid the installation of the module
print label that take module specific field into account with the different criteria: Geo, ethic, bio etc..
- Migrate code from V9 - Replace deleted standard qweb report by a new one
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 [WIP] [FIX] open instead as draft doesnt exist anymore [ADD] send (un)subscribed mail when worker is changed. [WIP] 2 [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 [WIP] final wip to clean [WIP] 4 [FIX] prod fix
Work in progress View cleaning done
…on when time is midnight
…cooperator + portal
@@ -41,18 +41,22 @@ | |||
<group | |||
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', '!=', 'worker_eater')]}" | |||
> | |||
<separator string="Eaters" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #284
@@ -138,10 +138,11 @@ def _new_eater(self, surname, name, email): | |||
partner_data = { | |||
"lastname": name, | |||
"firstname": surname, | |||
"is_customer": True, | |||
"customer": True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -23,7 +23,7 @@ def _cooperator_share_type(self): | |||
Return the share.type that correspond to the cooperator_type. | |||
""" | |||
self.ensure_one() | |||
share_type = None | |||
share_type = self.env['product.template'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -38,6 +38,7 @@ def _cooperator_share_type(self): | |||
"share_ids.share_product_id.default_code", | |||
"share_ids.share_product_id.allow_working", | |||
"share_ids.share_number", | |||
"worker_store", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else: | ||
rec.is_worker = False | ||
is_worker = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
def _search_worker(self, operator, value): | ||
lines = self.env["share.line"].search( | ||
[("share_product_id.allow_working", "=", "True")] | ||
) | ||
partner_ids = lines.mapped("partner_id").ids | ||
partner_ids = lines.mapped("partner_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,2 @@ | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,48 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -351,8 +351,7 @@ def _change_counter(self, data): | |||
# Irregular Cron implementation # | |||
############################################### | |||
|
|||
def _get_irregular_worker_domain(self, **kwargs): | |||
today = kwargs.get("today") or self.today | |||
def _get_irregular_worker_domain(self, today): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -96,7 +96,7 @@ def _get_status(self): | |||
comodel_name="cooperative.exempt.reason", string="Exempt Reason" | |||
) | |||
status = fields.Selection( | |||
selection=_get_status, | |||
selection=lambda x: x._get_status(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -112,11 +112,10 @@ def _get_status(self): | |||
) | |||
|
|||
# Specific to irregular | |||
irregular_start_date = fields.Date() # TODO migration script | |||
irregular_start_date = fields.Date() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discard
irregular_absence_counter = ( | ||
fields.Integer() | ||
) # TODO unsubscribe when reach -2 | ||
irregular_absence_counter = fields.Integer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discard
Overwrite write to historize the change | ||
""" | ||
for field in [ | ||
def _get_watched_fields(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -356,7 +358,7 @@ def _cron_compute_counter_irregular(self, today=False): | |||
if not journal: | |||
journal = self.env["beesdoo.shift.journal"].create({"date": today}) | |||
|
|||
domain = self._get_irregular_worker_domain(today=today) | |||
domain = self._get_irregular_worker_domain(today) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -445,7 +447,7 @@ def _change_counter(self, data): | |||
# Irregular Cron implementation # | |||
############################################### | |||
|
|||
def _get_irregular_worker_domain(self): | |||
def _get_irregular_worker_domain(self, today): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -61,7 +61,7 @@ def _get_final_state(self): | |||
) | |||
end_time = fields.Datetime(track_visibility="always", required=True) | |||
state = fields.Selection( | |||
selection=_get_selection_status, | |||
selection=lambda x: x._get_selection_status(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -214,10 +214,19 @@ def _nb_worker_max(self): | |||
) | |||
) | |||
|
|||
@api.constrains("start_time", "end_time") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@api.onchange("start_time", "end_time") | ||
def _get_duration(self): | ||
if self.start_time and self.end_time: | ||
self.duration = self.end_time - self.start_time | ||
self.duration = (self.end_time or 0.0) - (self.start_time or 0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,10 +1,50 @@ | |||
from odoo import fields, models | |||
from odoo import api, fields, models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -98,20 +98,6 @@ def _compute_color(self): | |||
for rec in self: | |||
rec.color = self._get_color_mapping(rec.state) | |||
|
|||
def _compensation_validation(self, task): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<field name="alert_start_time" /> | ||
<field name="extension_start_time" /> | ||
<field name="status" widget="statusbar" /> | ||
<field name="cooperator_id"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<field name="start_time" /> | ||
<field name="end_time" /> | ||
<field name="duration" /> | ||
<field name="start_time" widget="float_time" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -5,7 +5,7 @@ | |||
<field name="arch" type="xml"> | |||
<form> | |||
<group> | |||
<field name="planning_id" /> | |||
<field name="planning_ids" widget="many2many_tags" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -17,7 +17,7 @@ class GenerateShiftTemplate(models.TransientModel): | |||
column1="wizard_id", | |||
column2="day_id", | |||
) | |||
planning_id = fields.Many2one("beesdoo.shift.planning", required=True) | |||
planning_ids = fields.Many2many("beesdoo.shift.planning", 'generate_shift_planning_rel', 'planning_id', 'wizard_id', required=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shift_template_data | ||
) | ||
ids.append(new_rec.id) | ||
for planning_id in self.planning_ids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Last step should be the shift subscription because we check working mode in shift | ||
# It may raise an error you subscribe to a creanu with already existing shift | ||
# and the coop is subscribed before have the proper working mode | ||
if self.shift_id and self.working_mode == "regular": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already Done
@@ -169,14 +170,6 @@ def subscribe(self): | |||
# when going to irregular. | |||
if self.shift_id and self.shift_id.remaining_worker <= 0: | |||
raise UserError(_("There is no remaining spot in this shift")) | |||
if self.shift_id: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already done
@@ -140,6 +140,7 @@ def _get_reset_counter_default(self): | |||
resigning = fields.Boolean( | |||
default=False, help="Want to leave the beescoop" | |||
) | |||
create_user = fields.Boolean(defaul=False, help="Create a portal user for the new worker") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -211,4 +204,24 @@ def subscribe(self): | |||
# to a shift to keep information like "Worker mode, session info | |||
# ,... | |||
status_id.sudo().write(data) | |||
if self.create_user: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return True | ||
|
||
def _create_user(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -31,6 +31,7 @@ | |||
name="irregular_start_date" | |||
attrs="{'invisible': [('working_mode', '!=', 'irregular')]}" | |||
/> | |||
<field name="create_user" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -20,28 +20,28 @@ | |||
|
|||
class WebsiteShiftController(http.Controller): | |||
def is_user_worker(self): | |||
user = request.env["res.users"].browse(request.uid) | |||
user = request.env["res.users"].browse(request.uid).sudo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -46,8 +46,8 @@ | |||
|
|||
<template id="my_shift_worker_status_common" name="My Shift Worker Status Common"> | |||
|
|||
<p> | |||
<label class="font-weight-bold">Working Mode:</label> | |||
<p id="working_mode"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -871,7 +861,7 @@ | |||
</h2> | |||
|
|||
<div class="row"> | |||
<div class="col-12 col-md-6 text-justify"> | |||
<div class="col-12 col-md-12 text-justify"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abc40d1
to
fa7679b
Compare
@tfrancoi Salut Thibaut, pour te signaler que le refacto beesdoo_shift est en cours et sera mergé courant février. Pour info, on a vu un impact sur la surcharge de is_worker avec un conflit de priorité entre le module cooperator_worker et le module polln_shift, quand les deux sont installés (en tous cas si polln_shift est installé en dernier). On laisse comme ça pour le moment car on peut s'en sortir grâce au "force worker". |
Do not merge just base for discussion