Skip to content
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

[18.0][MIG] sale_order_carrier_auto_assign: Migration to 18.0 #3394

Open
wants to merge 40 commits into
base: 18.0
Choose a base branch
from

Conversation

lef-adhoc
Copy link

No description provided.

grindtildeath and others added 30 commits November 8, 2024 12:04
Currently translated at 100.0% (1 of 1 strings)

Translation: sale-workflow-13.0/sale-workflow-13.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_order_carrier_auto_assign/es/
Currently translated at 100.0% (1 of 1 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_carrier_auto_assign/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_carrier_auto_assign/
Currently translated at 100.0% (7 of 7 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_carrier_auto_assign/it/
lef-adhoc and others added 8 commits November 8, 2024 12:04
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_carrier_auto_assign/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_carrier_auto_assign/
Currently translated at 100.0% (6 of 6 strings)

Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_carrier_auto_assign
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_carrier_auto_assign/es/
@lef-adhoc lef-adhoc mentioned this pull request Nov 8, 2024
57 tasks
Copy link
Contributor

@matiasperalta1 matiasperalta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@xaviedoanhduy xaviedoanhduy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @lef-adhoc, thanks for migration this module.
I tested the functional and it works fine.
btw, could you squash administrative commits.

.with_context(**delivery_wiz_context)
.create({})
)
delivery_wiz._get_delivery_rate()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to call this function, I checked and found that it is mainly called in onchange functions and did not see it appear in any test in odoo codebase. I tried removing it and found that the module still works as expected and I guess that just calling button_confirm is enough, since in button_confirm there is a call to set_delivery_line function. I'm not sure if it's completely correct because I might miss something, do you think so?

Copy link
Author

@lef-adhoc lef-adhoc Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the line and I get an error in the tests and if I don't delete it I don't get an error. Can you check?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking the time, maybe it was worth appearing on that line.


def _add_delivery_carrier_on_confirmation(self):
"""Automatically add delivery.carrier on sale order confirmation"""
for order in self:
Copy link

@xaviedoanhduy xaviedoanhduy Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see action_confirm has iterated over the records in sale.order and called _add_delivery_carrier_on_confirmation function for each single record. So why do we need to iterate over it again, you can consider it with function that directly handles that record and call ensure_one function will make the code clearer

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it another way, what do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks fine to me. thanks

@lef-adhoc lef-adhoc force-pushed the 18.0-mig-sale_order_carrier_auto_assign branch 3 times, most recently from 7c292e2 to 362e2ef Compare December 2, 2024 17:25
Copy link

@xaviedoanhduy xaviedoanhduy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing this commit bfa00bb

and this change OCA/delivery-carrier@bdff1b3

and integrate those commits that were postponed for next version https://github.com/OCA/sale-workflow/pull/3081/commits

Comment on lines 10 to 12
for rec in self:
if not rec.company_id.carrier_auto_assign:
continue
rec._add_delivery_carrier_on_confirmation()
self.filtered(
lambda so: so.company_id.carrier_auto_assign
)._add_delivery_carrier_on_confirmation()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be part of the migration commit

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already changed it to another commit

@lef-adhoc
Copy link
Author

lef-adhoc commented Feb 3, 2025

@jbaudoux This is the migration to 18 of the module that is already in 17 and has the same commits that are in 17 https://github.com/OCA/sale-workflow/commits/17.0/sale_order_carrier_auto_assign shouldn't you do the PRs first to 17 before including them in 18?

…irst

Replaced the loop with `filtered()` to improve code clarity and avoid
iterating over irrelevant records. The method `_add_delivery_carrier_on_confirmation`
is now only called on applicable orders directly.
@lef-adhoc lef-adhoc force-pushed the 18.0-mig-sale_order_carrier_auto_assign branch from 362e2ef to e082bdd Compare February 3, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.