[IMP] beesdoo_shift: add name_get on task_template#302
Conversation
|
TODO: retarget on 12.0 once add-polln-shift is merged |
a4ee9c7 to
7db0a90
Compare
d18b0bd to
01974fb
Compare
| 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.
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.
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.
|
|
||
| def name_get(self): | ||
| res = [] | ||
| for rec in self: |
There was a problem hiding this comment.
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.
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é |
polchampion
left a comment
There was a problem hiding this comment.
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