-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
[MIG] product_operating_unit: Migration to 17.0 #668
[MIG] product_operating_unit: Migration to 17.0 #668
Conversation
/ocabot migration product_operating_unit |
cb48d89
to
493f37d
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.
Small improvements suggested.
CI is red, though.
category_ou_ids = rec.operating_unit_ids.ids | ||
for product in products: | ||
ou_ids = product.operating_unit_ids.ids | ||
ou_ids.extend(category_ou_ids) | ||
product.operating_unit_ids = [Command.set(ou_ids)] |
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.
Nitpicking: might as well use records directly, instead of ids
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.
at least it's worth it to try if it fails on this
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.
Logic updated with records instead of ids. Thanks for the review 👍
if self.categ_id and self.categ_id.operating_unit_ids: | ||
return [(6, 0, self.categ_id.operating_unit_ids.ids)] |
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.
Since this method is used as a default method, self.categ_id
will always be empty.
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.
For now, I simply removed the if statement but I'm wondering if the default is still needed with the compute based on the categ_id
@api.depends("categ_id") | ||
def _compute_operating_unit_ids(self): | ||
for record in self: | ||
if record.categ_id.operating_unit_ids: |
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.
I think you can remove this if
statement: if the category is changed to a category with no OU, the field can be safely emptied
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.
Statement removed 👍
you need to add
this should fix the build |
1153f91
to
88faccc
Compare
@jdidderen-nsi thanks for the migration |
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.
Migration LGTM, thanks
compute="_compute_operating_unit_ids", | ||
store=True, | ||
readonly=False, | ||
default=lambda self: self._default_operating_unit_ids(), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
This was one of my thoughts, given the compute based on the categ_id
So piece of code is removed
88faccc
to
aec48e1
Compare
#667 is now merged 😸 |
@jdidderen-nsi can you please remove dependency commit and rebase? |
…the product template.
Co-Authored-By: Patrick Wilson <36892066+patrickrwilson@users.noreply.github.com>
…the product template.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: operating-unit-16.0/operating-unit-16.0-product_operating_unit Translate-URL: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-product_operating_unit/
Currently translated at 100.0% (7 of 7 strings) Translation: operating-unit-16.0/operating-unit-16.0-product_operating_unit Translate-URL: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-product_operating_unit/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: operating-unit-16.0/operating-unit-16.0-product_operating_unit Translate-URL: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-product_operating_unit/
Currently translated at 14.2% (1 of 7 strings) Translation: operating-unit-16.0/operating-unit-16.0-product_operating_unit Translate-URL: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-product_operating_unit/ja/
This PR fixes an issue with the method operating_unit_default_get where it would return an operating unit even for a company that was not active, which would cause all sorts of issues Steps to reproduce on runboat, taking as example purchase_operating_unit: - User has a default ou belonging to Company 1 - Switch to Company 2 (make sure Company 1 is not active at all) - Try to create a Purchase Order The issue arises because the operating_unit field is pre-compiled on the PO with an Operating Unit whose company is inactive, and the onchanges cannot find or access related data.
Currently translated at 100.0% (7 of 7 strings) Translation: operating-unit-16.0/operating-unit-16.0-product_operating_unit Translate-URL: https://translation.odoo-community.org/projects/operating-unit-16-0/operating-unit-16-0-product_operating_unit/it/
aec48e1
to
f589b76
Compare
@gurneyalex @yankinmax Rebased and good to go 👍 |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 1fe5bd0. Thanks a lot for contributing to OCA. ❤️ |
Some changes (security rules) are based on changes made in the base modules #667
I removed domains on operating units fields for two reasons:
operating-unit/operating_unit/models/res_users.py
Line 76 in 025e778
Depends on: