-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[19.0][MIG] base_partition: Migration to 19.0 #3465
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
base: 19.0
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice include some documentation in addon's description about this method too.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem
No description provided.