Skip to content

[18.0][MIG] stock_partner_delivery_window: Migration to 18.0 #1783

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

Closed

Conversation

thienvh332
Copy link
Contributor

No description provided.

Copy link

@ajaniszewska-dev ajaniszewska-dev left a comment

Choose a reason for hiding this comment

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

seems good

@rousseldenis
Copy link
Contributor

/ocabot migration stock_partner_delivery_window

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Jan 10, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Jan 10, 2025
69 tasks
@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). 🤖

domain = [("partner_id", "in", self.ids)]
if day_name is not None:
week_day_id = self.env["time.weekday"]._get_id_by_name(day_name)
domain.append(("time_window_weekday_ids", "in", week_day_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

append is never a good idea. Using expression.AND() is better.

}
for window_id in self.delivery_time_window_ids
]
result["delivery_time_window_ids"] = [(0, 0, val) for val in values]
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor comment, using Command is IMHO better.

message = self.env._(
"The scheduled date is {date} ({weekday}), but the partner is "
"set to prefer deliveries on working days."
).format(
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use translate function arguments instead.

def _planned_delivery_date(self):
return self.scheduled_date

@api.onchange("scheduled_date")
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, warnings could be avoided using alerts instead.

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use BaseCommon class to avoid this.

@@ -61,7 +58,9 @@ def get_delivery_windows(self, day_name=None):
domain = [("partner_id", "in", self.ids)]
if day_name is not None:
week_day_id = self.env["time.weekday"]._get_id_by_name(day_name)
domain.append(("time_window_weekday_ids", "in", week_day_id))
domain = expression.AND(
[domain, [("time_window_weekday_ids", "in", week_day_id)]]
Copy link
Contributor

Choose a reason for hiding this comment

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

domain = expression.AND(
                [domain, [("time_window_weekday_ids", "in", [week_day_id])]]

rousseldenis and others added 20 commits February 4, 2025 16:22
Currently translated at 100.0% (27 of 27 strings)

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

Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_partner_delivery_window
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_partner_delivery_window/
Currently translated at 100.0% (27 of 27 strings)

Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_partner_delivery_window
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_partner_delivery_window/it/
Currently translated at 100.0% (27 of 27 strings)

Translation: stock-logistics-workflow-16.0/stock-logistics-workflow-16.0-stock_partner_delivery_window
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_partner_delivery_window/it/
@thienvh332 thienvh332 force-pushed the 18.0-mig-stock_partner_delivery_window branch from bce6c2f to 019dc92 Compare February 4, 2025 09:27
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

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

It works but it seems there is some formatting issue in the error message:

image

@ArnauCForgeFlow
Copy link
Contributor

Hello @thienvh332 will you address the comments, or I should do a supersede?

@sebalix
Copy link
Contributor

sebalix commented Apr 3, 2025

@ArnauCForgeFlow yes please go ahead :)

@ArnauCForgeFlow
Copy link
Contributor

@sebalix Done! here is the new pr: #1910

@thienvh332
Copy link
Contributor Author

Hello @ArnauCForgeFlow ,
Oh sorry I missed it. Thanks for your help 🙏

@sebalix
Copy link
Contributor

sebalix commented Apr 7, 2025

Closing in favor of #1910
Thanks @thienvh332 and @ArnauCForgeFlow

@sebalix sebalix closed this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.