-
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
[IMP] beesdoo_shift: add name_get on task_template #302
base: 12.0
Are you sure you want to change the base?
Conversation
TODO: retarget on 12.0 once add-polln-shift is merged |
a4ee9c7
to
7db0a90
Compare
d18b0bd
to
01974fb
Compare
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.
TODO:
- will need a migration script.
- move to beesdoo_shift
time_domain = [] | ||
FIELDS = ['planning_id', 'name', 'day_nb_id'] | ||
for n in name.split(" "): | ||
if re.search(r"^\(\d{2}:\d{2}-\d{2}:\d{2}\)$", n): |
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.
could you provide an example(s) of matched pattern for readability ?
Also, nitpicking, shouldn't you compile the pattern out of the loop?
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.
could you provide an example(s) of matched pattern for readability ?
Yes we are looking for the time (generated by the name get) for example 12:30-15h30
Also, nitpicking, shouldn't you compile the pattern out of the loop?
From the perf point of view the number of iteration depends on the number of token in the search term so between 1 and 4. I don't think it really matter.
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.
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.
Good to know, thanks!
|
||
def name_get(self): | ||
res = [] | ||
for rec in 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.
We try to use more explicit names in our loops, such as for template in self:
or for shift_template in self:
. Don't you use that at Odoo ?
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.
Don't you use that at Odoo ?
There is no specific guidelines for that in odoo (you can grep for rec in self, for record in self)
Personnaly when the record come from a search it makes sense to specify the object
when they come from self, you already know in which model you are, it's less important
this allow to use generated task template name and not add all info of the template directly in the name
01974fb
to
8cb913d
Compare
Codecov Report
@@ Coverage Diff @@
## 12.0 #302 +/- ##
==========================================
- Coverage 68.53% 68.24% -0.30%
==========================================
Files 107 107
Lines 3366 3388 +22
Branches 589 595 +6
==========================================
+ Hits 2307 2312 +5
- Misses 951 968 +17
Partials 108 108
Continue to review full report at Codecov.
|
Virg et Pol : Ne pas merger, pas voulu, à mettre dans un module séparé si on veut vraiment implémenter cette fonctionnalié |
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.
Ne pas merger, pas voulu, à mettre dans un module séparé si on veut vraiment implémenter cette fonctionnalié
abc40d1
to
fa7679b
Compare
this allow to use generated task template name
and not add all info of the template directly in the name