[16.0][IMP] sell_only_by_packaging: support negative rounding when converting packaging qty#3248
[16.0][IMP] sell_only_by_packaging: support negative rounding when converting packaging qty#3248QuocDuong1306 wants to merge 2 commits intoOCA:16.0from
Conversation
|
This PR has the |
| float_compare( | ||
| qty, | ||
| 0.0, | ||
| precision_rounding=0.001, |
There was a problem hiding this comment.
Why this value and not another ?
There was a problem hiding this comment.
Hi @rousseldenis , I just based on the original one (positive rounding, here). Do you have any suggestion for this rounding?
There was a problem hiding this comment.
Yes, of course, using the product rounding.
There was a problem hiding this comment.
Thank @rousseldenis for your suggestions, a new commit has been added
|
/ocabot merge minor |
|
What a great day to merge this nice PR. Let's do it! |
|
@rousseldenis The merge process could not be finalized, because command |
|
/ocabot rebase |
|
Congratulations, PR rebased to 16.0. |
93569c4 to
f8637f8
Compare
|
/ocabot rebase |
|
Congratulations, PR rebased to 16.0. |
f8637f8 to
444f5da
Compare
|
Hi @QuocDuong1306 , thank you for your contribution! Could you please squash the commits? |
| For example, if your packaging is set to sell by 5 units and the employee fill | ||
| the quantity with 3, the quantity will be automatically replaced by 5 (it always rounds up). | ||
| For example, | ||
| - To sell packaging (fill positive product quantities), if your packaging is set to sell by 5 units and the employee fill |
There was a problem hiding this comment.
Please add a blank line before the list, like this:
For example:
- To sell....
|
@QuocDuong1306 hi, could you make the modification to let this pr be merge please :) thanks a lot for your effort |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for working on this, nice addition for return order support.
The rounding logic in _convert_packaging_qty looks correct to me -- the forced_qty -= q adjustment for negative quantities properly rounds away from zero (toward more negative), which is the expected mirror of the existing round-up behavior for positive quantities.
Good catch also on switching precision_rounding=0.001 to precision_rounding=uom.rounding -- using the UoM's actual precision is more correct than the hardcoded value.
Tests cover the key negative-qty scenarios well.
Two things still needed before this can merge:
-
The RST formatting issue that @ivs-cetmix already flagged in
README.rstalso exists inreadme/DESCRIPTION.rst(same source). The bullet list needs a blank line before it and the continuation lines should be indented to align with the list item text. This is what causedoca-gen-addon-readmeto fail on the previous merge attempt. -
Commits need squashing as requested.
|
hi guys, i've superseed this pr here --> #4196 you can close this one :) |
|
Closing as solved by: #4196 |
Currently, on upstream, It's possible to support creating return orders when filling negative quantities in product_uom_qty on Sale Order lines.
This PR will help to round down the product quantities to the nearest multiple of the packaging quantity in that case.