-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
[17.0][MIG] repair_type: Migration to 17.0 #43
Conversation
The destination location was removed from the repair since 12.0.
Currently translated at 72.0% (18 of 25 strings) Translation: manufacture-14.0/manufacture-14.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_type/hr/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: manufacture-14.0/manufacture-14.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_type/
Currently translated at 100.0% (23 of 23 strings) Translation: manufacture-14.0/manufacture-14.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_type/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: repair-16.0/repair-16.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_type/
Currently translated at 100.0% (23 of 23 strings) Translation: repair-16.0/repair-16.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_type/it/
Currently translated at 100.0% (23 of 23 strings) Translation: repair-16.0/repair-16.0-repair_type Translate-URL: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_type/it/
5381d48
to
1a8f0bd
Compare
b48cb2b
to
e02b877
Compare
Do you know how to test migration script in v17 in that case? Thanks in advance |
178d058
to
ef54e99
Compare
Hello @BernatPForgeFlow @LoisRForgeFlow! In collaboration with @miquelalzanillas we carried out the migration including the data migration script. |
ef54e99
to
b854e0c
Compare
Hi @peluko00 @miquelalzanillas! Thanks for the improvements! I add some comments for things that I miss. I am missing the 'Default Add Source Location' and 'Default Remove Destination Location' in the operation types. We use these locations to record which components have been used to repair products and are under warranty. Also, can you create the new operation type fields with the same definition as the core ones? https://github.com/odoo/odoo/blob/17.0/addons/repair/models/stock_picking.py#L25 In that way, we pre-compute a value when creating it and we can edit it later. For the 'Default ... Source Location' fields I would maybe use this compute: https://github.com/odoo/odoo/blob/17.0/addons/stock/models/stock_picking.py#L252 Then, for the migration script, if you want to add fields like 'sequence_id' or 'sequence_prefix' that are not from this module, I would use a column_exists to make sure those columns exist: https://github.com/OCA/partner-contact/blob/14.0/partner_stage/migrations/14.0.2.0.0/pre-migrate.py#L8 |
Hi @BernatPForgeFlow, thanks for the annotations. The 'Default Remove Destination Location' field is defined in the core. |
b854e0c
to
08f7f2b
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.
I add the last comments. To set the default locations in the Operation Type I would use the following structure. To do that, we can inherit from core compute methods and add some logic afterwards. I add as individual comments how I would replace each of the methods.
Apart from that, in the '_get_repair_locations()' I would use the default_add_location_dest_id that we are defining in the operation type.
) | ||
|
||
@api.depends("code") | ||
def _compute_default_location_src_id(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.
@api.depends("code")
def _compute_default_location_src_id(self):
res = super()._compute_default_location_src_id()
for picking_type in self:
stock_location = picking_type.warehouse_id.lot_stock_id
if picking_type.code == "repair_operation":
picking_type.default_add_location_src_id = stock_location.id
return res
).id | ||
|
||
@api.depends("code") | ||
def _compute_default_location_dest_id(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.
@api.depends("code")
def _compute_default_location_dest_id(self):
res = super()._compute_default_location_dest_id()
for picking_type in self:
if picking_type.code == "repair_operation":
picking_type.default_add_location_dest_id = picking_type.default_location_dest_id.id
picking_type.default_remove_location_src_id = picking_type.default_location_dest_id.id
picking_type.default_recycle_location_src_id = picking_type.default_location_dest_id.id
return res
repair_type/models/stock_move.py
Outdated
): | ||
res = ( | ||
self.repair_id.picking_type_id.default_add_location_src_id, | ||
res[1], |
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.
self.repair_id.picking_type_id.default_add_location_dest_id
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.
@peluko00 Here I was meaning to change the res[1]
by self.repair_id.picking_type_id.default_add_location_dest_id
.
First one should keep as self.repair_id.picking_type_id.default_add_location_src_id
08f7f2b
to
0885008
Compare
Thank you very much! The purpose of these changes is to default to a logical stock move if someone wants to set up a new "Repair" operation type. This way, even if they want to change locations, they will have a schema to base on their changes. And then also that when the repair orders are made, that we actually take the locations that we have configured in the operation type. Then, with the last change that I requested some minutes ago I will approve this PR 👍 . |
0885008
to
377edd2
Compare
Just done! Can you make the final review? Thanks in advance |
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.
LGTM! Functional and code review! 👍
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.
Thanks
Is ready for merge @LoisRForgeFlow @BernatPForgeFlow ? |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
This PR has the |
Congratulations, your PR was merged at 1d0a56a. Thanks a lot for contributing to OCA. ❤️ |
Standard migration with one exception:
cc https://github.com/APSL 155813 @peluko00 @mpascuall please review