DiscountSchema works with every CumulativeLevel value

Description

In the DiscountSchema you can choose a CumulativeLevel of "line". (The only alternative is to not choose any level.) There is only Java code for the "line" case.

Now I want to implement a plugin for a "document" level of discounts. But the discountschema is applied for "line" every time. The code should be conditional.

Perhaps we should make the CumulativeLevel mandatory. I see no usecase where you create a DiscountSchema record without any Level.

Environment

None

Attachments

2

Activity

Show:

Carlos Ruiz January 13, 2015 at 3:10 PM

fix broken when DiscountType is FlatPercent

Carlos Ruiz January 13, 2015 at 3:08 PM

found and reported an issue at google forums:
https://groups.google.com/d/msg/idempiere/j3Vlgbl_mIo/yRbDKJJeMIEJ

Thomas Bayen September 3, 2014 at 10:51 PM

Yes, I agree with you. This class is the better place.
(and also I used a string contant in my patch (Tz!))

Carlos Ruiz September 3, 2014 at 10:12 PM

Hi Thomas, I'm attaching my suggested patch as PatchAboutDiscountSchema.patch

I think is better to patch ProductPricing instead of MDiscountSchema - as you still could use MDiscountSchema.calculateDiscount passing as parameters the sum(qty) and avg(price) for all lines and still get the correct discount.

WDYT?

Regards,

Carlos Ruiz

Thomas Bayen August 20, 2014 at 4:33 PM

I was sure that patched that issue last week here in my attic but it seems he did not apply that patch to the trunk. (Or I missed it and am very stupid ) So this is an (alternative) solution from me. Please review.

Fixed

Assignee

Reporter

Labels

Priority

Created August 20, 2014 at 4:28 PM
Updated May 4, 2015 at 5:43 PM
Resolved January 13, 2015 at 3:10 PM