-
Notifications
You must be signed in to change notification settings - Fork 0
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][IMP] sell_only_by_packaging: support negative rounding when converting packaging qty #5
Conversation
forced_qty = qty - (qty % q) + q | ||
# Support negative rounding | ||
if ( | ||
float_compare( | ||
qty, | ||
0.0, | ||
precision_rounding=0.001, | ||
) | ||
< 0 | ||
): | ||
forced_qty = forced_qty - q | ||
return forced_qty |
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.
nested-if could make other dev confused
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.
nah, i think it's fine
) | ||
< 0 | ||
): | ||
forced_qty = forced_qty - q |
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.
forced_qty = forced_qty - q | |
forced_qty -= q |
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.
an explanation (PR + readme) why the feature is useful is welcome
acd29db
to
dfaaf73
Compare
Currently, on upstream, It's possible to support creating return orders when filling negative quantities in product_uom_qty.
This PR will help to round down the product quantities to the nearest multiple of the packaging quantity in that case.