Open
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
tfrancoi
commented
Feb 24, 2022
| "lastname": name, | ||
| "firstname": surname, | ||
| "is_customer": True, | ||
| "customer": True, |
tfrancoi
commented
Feb 24, 2022
| """ | ||
| self.ensure_one() | ||
| share_type = None | ||
| share_type = self.env['product.template'] |
tfrancoi
commented
Feb 24, 2022
| "share_ids.share_product_id.default_code", | ||
| "share_ids.share_product_id.allow_working", | ||
| "share_ids.share_number", | ||
| "worker_store", |
| is_worker = share_type.allow_working | ||
| else: | ||
| rec.is_worker = False | ||
| is_worker = False |
| [("share_product_id.allow_working", "=", "True")] | ||
| ) | ||
| partner_ids = lines.mapped("partner_id").ids | ||
| partner_ids = lines.mapped("partner_id") |
tfrancoi
commented
Feb 24, 2022
| @@ -0,0 +1,2 @@ | |||
| # -*- coding: utf-8 -*- | |||
tfrancoi
commented
Feb 24, 2022
| @@ -0,0 +1,48 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
tfrancoi
commented
Feb 24, 2022
|
|
||
| def _get_irregular_worker_domain(self, **kwargs): | ||
| today = kwargs.get("today") or self.today | ||
| def _get_irregular_worker_domain(self, today): |
| ) | ||
| status = fields.Selection( | ||
| selection=_get_status, | ||
| selection=lambda x: x._get_status(), |
|
|
||
| # Specific to irregular | ||
| irregular_start_date = fields.Date() # TODO migration script | ||
| irregular_start_date = fields.Date() |
| irregular_absence_counter = ( | ||
| fields.Integer() | ||
| ) # TODO unsubscribe when reach -2 | ||
| irregular_absence_counter = fields.Integer() |
| Overwrite write to historize the change | ||
| """ | ||
| for field in [ | ||
| def _get_watched_fields(self): |
| journal = self.env["beesdoo.shift.journal"].create({"date": today}) | ||
|
|
||
| domain = self._get_irregular_worker_domain(today=today) | ||
| domain = self._get_irregular_worker_domain(today) |
| ############################################### | ||
|
|
||
| def _get_irregular_worker_domain(self): | ||
| def _get_irregular_worker_domain(self, today): |
tfrancoi
commented
Feb 24, 2022
| end_time = fields.Datetime(track_visibility="always", required=True) | ||
| state = fields.Selection( | ||
| selection=_get_selection_status, | ||
| selection=lambda x: x._get_selection_status(), |
tfrancoi
commented
Feb 24, 2022
| ) | ||
| ) | ||
|
|
||
| @api.constrains("start_time", "end_time") |
tfrancoi
commented
Feb 24, 2022
| 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) |
tfrancoi
commented
Feb 24, 2022
| @@ -1,10 +1,50 @@ | |||
| from odoo import fields, models | |||
| from odoo import api, fields, models | |||
tfrancoi
commented
Feb 24, 2022
beesdoo_shift/models/task.py
Outdated
| for rec in self: | ||
| rec.color = self._get_color_mapping(rec.state) | ||
|
|
||
| def _compensation_validation(self, task): |
tfrancoi
commented
Feb 24, 2022
| <field name="alert_start_time" /> | ||
| <field name="extension_start_time" /> | ||
| <field name="status" widget="statusbar" /> | ||
| <field name="cooperator_id"/> |
tfrancoi
commented
Feb 24, 2022
| <field name="start_time" /> | ||
| <field name="end_time" /> | ||
| <field name="duration" /> | ||
| <field name="start_time" widget="float_time" /> |
tfrancoi
commented
Feb 24, 2022
| <form> | ||
| <group> | ||
| <field name="planning_id" /> | ||
| <field name="planning_ids" widget="many2many_tags" /> |
tfrancoi
commented
Feb 24, 2022
| 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) |
tfrancoi
commented
Feb 24, 2022
| shift_template_data | ||
| ) | ||
| ids.append(new_rec.id) | ||
| for planning_id in self.planning_ids: |
tfrancoi
commented
Feb 24, 2022
| # 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": |
tfrancoi
commented
Feb 24, 2022
beesdoo_shift/wizard/subscribe.py
Outdated
| # 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: |
tfrancoi
commented
Feb 24, 2022
| 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") |
tfrancoi
commented
Feb 24, 2022
| # to a shift to keep information like "Worker mode, session info | ||
| # ,... | ||
| status_id.sudo().write(data) | ||
| if self.create_user: |
tfrancoi
commented
Feb 24, 2022
| self.cooperator_id.sudo().write({"subscribed_shift_ids": [(5,)]}) | ||
| return True | ||
|
|
||
| def _create_user(self): |
tfrancoi
commented
Feb 24, 2022
| name="irregular_start_date" | ||
| attrs="{'invisible': [('working_mode', '!=', 'irregular')]}" | ||
| /> | ||
| <field name="create_user" /> |
tfrancoi
commented
Feb 24, 2022
| 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() |
tfrancoi
commented
Feb 24, 2022
|
|
||
| <p> | ||
| <label class="font-weight-bold">Working Mode:</label> | ||
| <p id="working_mode"> |
tfrancoi
commented
Feb 24, 2022
|
|
||
| <div class="row"> | ||
| <div class="col-12 col-md-6 text-justify"> | ||
| <div class="col-12 col-md-12 text-justify"> |
abc40d1 to
fa7679b
Compare
Collaborator
|
@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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge just base for discussion