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][IMP] sell_only_by_packaging: support negative rounding when converting packaging qty #5

Closed
wants to merge 1 commit into from

Conversation

QuocDuong1306
Copy link
Owner

@QuocDuong1306 QuocDuong1306 commented Jul 18, 2024

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.

Comment on lines 59 to 70
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

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

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

Choose a reason for hiding this comment

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

Suggested change
forced_qty = forced_qty - q
forced_qty -= q

Copy link

@trisdoan trisdoan left a 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

@QuocDuong1306 QuocDuong1306 force-pushed the 16.0-imp-sell_only_by_packaging branch from acd29db to dfaaf73 Compare July 24, 2024 01:33
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.

2 participants