Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Line item
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Sep 2011 at 15:19 UTC
Updated:
8 Oct 2011 at 12:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
rszrama commentedThe attached patch fixes this by abstracting our custom rounding support out of the Tax module and allowing rounding to be applied on a per-unit price alteration basis; the 5 actions pertaining to manipulating the amount of a unit price now have the option to round the resultant amount using the same modes we support for tax rounding.
I'm still investigating an upgrade path, but the patch is here for testing on new rules. Using your precise scenario, I get the math showing up properly... even when used in conjunction with VAT rounding!
Comment #2
rszrama commentedOk, as it turns out, I was able to add an update function to accommodate this new rounding mode setting I added. I'm going to actually default the new behavior to round up like we need it for our project, and it should work for a majority of use cases (except in those rare instances where you might need to round down... but it's easily configurable via the action form).
The only hitch here is that there's a bug in Rules versions preceding 7.x-2.0-rc2 that will cause the fix to be ignored. Rules added a "dirty" parameter that marks Rules as containing invalid configuration, and a fix was committed for the rc2 that checks and removes this dirty parameter on save of the Rule. So, to use the working update path, you must first update to Rules 7.x-2.0-rc2 or apply the patch in #1270042-7: Rules remain dirty even if they've been fixed via the UI.
Once you have that, update your code to the latest Commerce dev version or apply the attached patch. Then go to update.php and run Line Item update 7000 to have your Rules updated to use the new rounding mode parameter. Voila! You're fixed. : )
Comment #3
guguss commentedWell done, it works fine.
I finally chose to update Commerce to the DEV version (instead of using the patch) and to update Rules to the RC2 version.
I did some testing with different use cases and it seems to work as wanted.
Thanks again.