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

[16.0][ADD] sale_lead_time #3539

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

AungKoKoLin1997
Copy link
Contributor

This module enhances the sales order process by adding a delivery_lead_time that is determined based on the most closely matching lead time profile. This time is then incorporated into the customer_lead of each sale order line, optimizing delivery scheduling based on specific lead time configurations.

@qrtl QT4790

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-add-sale_lead_time_profile branch from 2619b9b to e9a7924 Compare January 16, 2025 07:21
@rousseldenis rousseldenis added this to the 16.0 milestone Jan 16, 2025
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

Partial review.

sale_lead_time_profile/models/lead_time_profile.py Outdated Show resolved Hide resolved
sale_lead_time_profile/models/lead_time_profile.py Outdated Show resolved Hide resolved
sale_lead_time_profile/models/sale_order.py Outdated Show resolved Hide resolved
sale_lead_time_profile/models/sale_order.py Outdated Show resolved Hide resolved
sale_lead_time_profile/models/sale_order.py Outdated Show resolved Hide resolved
sale_lead_time_profile/views/lead_time_profile_views.xml Outdated Show resolved Hide resolved
sale_lead_time_profile/views/lead_time_profile_views.xml Outdated Show resolved Hide resolved
sale_lead_time_profile/views/lead_time_profile_views.xml Outdated Show resolved Hide resolved
sale_lead_time_profile/models/lead_time_profile.py Outdated Show resolved Hide resolved
sale_lead_time_profile/models/sale_order.py Outdated Show resolved Hide resolved
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-add-sale_lead_time_profile branch 2 times, most recently from d0fe46b to 0ff8e28 Compare January 17, 2025 03:10
Copy link
Member

@mmequignon mmequignon left a comment

Choose a reason for hiding this comment

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

This looks very very specific too me, with too many hardcoded values, and doesn't look specific enough to applicable in other contexts...

Comment on lines 27 to 44
score += 1
else:
return -1
if self.partner_id:
if partner == self.partner_id:
score += 3
else:
return -1
elif self.state_id:
if partner.state_id == self.state_id:
score += 2
else:
return -1
elif self.country_id:
if partner.country_id == self.country_id:
score += 1
else:
return -1
Copy link
Member

Choose a reason for hiding this comment

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

I would make those configurable. Also, I think it lacks some comments. Why is partner +3 and not +42? I feel like this should be configured on the company.

And as I see it, I'm thinking that maybe we could sum values.
For a given profile, profile score is warehouse score + partner score + …, according to what the customer wants to.

@yostashiro
Copy link
Member

@mmequignon Thanks for your comments! Can you please check the updated code?

@yostashiro yostashiro force-pushed the 16.0-add-sale_lead_time_profile branch from d8232e8 to 12203a8 Compare January 19, 2025 15:22
@AungKoKoLin1997 AungKoKoLin1997 changed the title [16.0][ADD] sale_lead_time_profile [16.0][ADD] sale_lead_time Jan 20, 2025
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-add-sale_lead_time_profile branch 3 times, most recently from f1cc0f4 to d4a7f4d Compare January 21, 2025 01:30
continue
partner_address_domain = rec._get_partner_address_domain()
warehouse_domain = rec._get_warehouse_domain()
domain = expression.AND([partner_address_domain, warehouse_domain])
Copy link
Member

Choose a reason for hiding this comment

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

Forgot to include the company in the domain.

Suggested change
domain = expression.AND([partner_address_domain, warehouse_domain])
domain = expression.AND([partner_address_domain, warehouse_domain, [("company_id", "=", rec.company_id.id)]])

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

Code review.

@AungKoKoLin1997 Can you please squash commits?

@@ -0,0 +1,4 @@
This module enhances the sales order process by adding a delivery_lead_time that is
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This module enhances the sales order process by adding a delivery_lead_time that is
This module enhances the sales order process by adding a Delivery Lead Lime that is

| Japan | Tokyo | | 2nd WH | 7.0 | N/A for warehouse mismatch |
+---------+-------+---------+-----------+------------------+-------------------------------+

As a result, 5.0 days of the Delivery Lead Time will be proposed for the sales order.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
As a result, 5.0 days of the Delivery Lead Time will be proposed for the sales order.
The profile with the highest score is considered the best match, and therefore, a
Delivery Lead Time of 5.0 days will be proposed for the sales order.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-add-sale_lead_time_profile branch from d318b86 to d58c6e8 Compare January 21, 2025 08:48
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-add-sale_lead_time_profile branch from d58c6e8 to c818996 Compare January 21, 2025 08:49
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.

5 participants