[19.0][MIG] base_partition: Migration to 19.0 - #3465
Conversation
Currently translated at 100.0% (2 of 2 strings) Translation: server-tools-16.0/server-tools-16.0-base_partition Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_partition/es/
Currently translated at 100.0% (2 of 2 strings) Translation: server-tools-16.0/server-tools-16.0-base_partition Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_partition/it/
Currently translated at 100.0% (2 of 2 strings) Translation: server-tools-17.0/server-tools-17.0-base_partition Translate-URL: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_partition/zh_CN/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-18.0/server-tools-18.0-base_partition Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_partition/
rrebollo
left a comment
There was a problem hiding this comment.
Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! I've provided a few suggestions for your consideration—feel free to address them as you see fit.
| def batch(self, batch_size=None): | ||
| """Yield successive batches of size batch_size, or .""" | ||
| if not (batch_size or "_default_batch_size" in dir(self)): | ||
| raise UserError( | ||
| self.env._( | ||
| "Either set up a '_default_batch_size' on the model" | ||
| " or provide a batch_size parameter." | ||
| ) | ||
| ) | ||
| batch_size = batch_size or self._default_batch_size | ||
| for i in range(0, len(self), batch_size): | ||
| yield self[i : i + batch_size] |
There was a problem hiding this comment.
It would be nice include some documentation in addon's description about this method too.
There was a problem hiding this comment.
Recently I discovered split_every. Maybe this could be deprecated in favor of the built-in helper.
| def read_per_record(self, fields=None, load="_classic_read"): | ||
| result = {} | ||
| data_list = self.read(fields=fields, load=load) | ||
| for d in data_list: | ||
| key = d.pop("id") | ||
| result[key] = d | ||
| return result |
There was a problem hiding this comment.
It would be nice include some documentation in addon's description about this method too.
rousseldenis
left a comment
There was a problem hiding this comment.
LGTM
@len-foss Maybe something to add in an improvement PR ?
|
This PR has the |
|
/ocabot migration base_partition /ocabot merge nobump |
|
What a great day to merge this nice PR. Let's do it! |
|
It looks like something changed on |
|
Congratulations, your PR was merged at b9c61bb. Thanks a lot for contributing to OCA. ❤️ |
No description provided.