-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[11.0][IMP] sale_order_type: Find sale order type based on the products of the sale order #770
Conversation
…cts of the sale order
@OCA/crm-sales-marketing-maintainers please check, I don't know if this is the correct way to forward port a change, any suggestion for improvement is appreciated |
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.
Functionally tested 👍
Well I have some doubts but It works
Rules can also be associated with sale order types. | ||
|
||
Inside each rule, you can select any number of products and/or product categories. | ||
|
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.
Case 1
- 1 sale order with 2 product
- Each of that 2 products are in 2 different rules of 2 different sale_order_type
Product 1 -> Sale order type 1
Product 2 -> Sale order type 2
Sale Order TEST has product 1 + product 2
Which is the result?
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.
Hi, thanks for your review!
As stated few lines below, the order types are inspected following the order of their sequence
field, so:
0. Suppose Type 1 has sequence 1 and Type 2 has sequence 2;
- Type 1 is inspected: does this match the current order?
- Does any rule of type 1 match any product in the order?
*. Yes -> choose type 1 and exit
*. No -> go on - Does any rule of type 1 match any product category in the order?
*. (same as above)
- Does any rule of type 1 match any product in the order?
- Repeat step 1 for the following order types
At least this is the behavior I tried to describe in the README, if that is not clear enough I can add an example.
@OCA/crm-sales-marketing-maintainers can this be merged? Consider that this functionality is just forward ported from #716, thanks |
sale_order_type/models/sale_order.py
Outdated
@@ -36,6 +36,23 @@ def onchange_type_id(self): | |||
if order.type_id.incoterm_id: | |||
order.incoterm = order.type_id.incoterm_id.id | |||
|
|||
@api.multi | |||
@api.onchange('order_line') | |||
def _onchange_order_line(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.
This onchange shouldn't be triggered automatically.
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.
Hi, thanks for the review!
It is triggered automatically but it only does something if the type_id
of the order is empty.
Are you suggesting it should depend on something else or should I remove it completely?
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.
It should be removed IMO due to performance reasons.
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.
Ok then I'll remove it, double-thinking about it, it might be confusing when:
- add first line -> type is set
- add second line, type should change but it doesn't
In the end, everyone would be clicking on the recompute
button to be sure the type is correct..
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.
Done in 65a7dc2
… can be confusing and not efficient.
@SimoRubi please fix this as you have broken several CIs due to hard-coded dependency in test of |
Hi, I see that Travis of the merged commit is ✔️, which CIs are broken? |
Those that don't install |
Forward port of #716