metasfresh / metasfresh

We do Open Source ERP - Fast, Flexible & Free Software to scale your Business.
http://metasfresh.com/en
GNU General Public License v2.0
1.78k stars 601 forks source link

No recording of Products without pricing Conditions #3835

Closed metas-mk closed 6 years ago

metas-mk commented 6 years ago

Is this a bug or feature request?

Feature Request

What is the current behavior?

Currently, all Products can be recorded in document lines as long as they are available on product prices of the price system.

Which are the steps to reproduce?

Open, try and see.

What is the expected or desired behavior?

If a user records a product that is not defined in Pricing Conditions Schema (Discount Schema Break) then the line shall be marked specially. The user shall receive a message that the recording of conditions is needed in advance. This functionality shall be able to be switched on/off via sysconfig.

teosarca commented 6 years ago

requires: https://github.com/metasfresh/metasfresh-webui-api/issues/852 (Color Indicator Widget functionality API)

teosarca commented 6 years ago

Concept

  1. Introduce C_OrderLine.M_DiscountSchemaBreak_ID. Set that column when the price is calculated. i.e.

    • DiscountResult: introduce discountSchemaBreakId
    • set discountSchemaBreakId from org.adempiere.pricing.api.impl.CalculateDiscountCommand.calculateDiscount()
    • in PricingResult, introduce discountSchemaBreakId and set it in Discount.calculate
    • set C_OrderLine.M_DiscountSchemaBreak_ID from de.metas.order.impl.OrderLineBL.updatePrices0(I_C_OrderLine) and de.metas.order.impl.OrderLineBL.setPricesIfNotIgnored(Properties, I_C_OrderLine, int, BigDecimal, BigDecimal, boolean, String)
  2. Introduce de.metas.order.NoPriceConditionsColorName sysconfig which by default shall be empty or -. Btw, in code, handle - as empty.

  3. Introduce C_OrderLine.NoPriceConditionsColor_ID column, reference=Color

  4. If

    • de.metas.order.NoPriceConditionsColorName sysconfig is set
    • C_OrderLine.M_DiscountSchemaBreak_ID is null Then
    • set C_OrderLine.NoPriceConditionsColor_ID with the AD_Color_ID found by searching into AD_Color table by Name=de.metas.order.NoPriceConditionsColorName
metas-lc commented 6 years ago

IT

  1. sysconfig NoPriceConditionsColorName, value -
  2. create new order (test on both sales and purchase sides)
  3. add 2 products: one having Discount Schema and one not => no price conditions indicator is null (not set) OK
  4. sysconfig NoPriceConditionsColorName, value Gelb
  5. add 2 products: one having Discount Schema and one not => on the one without discount schema you get "no price conditions indicator" to #ffff00 OK

On the purchase side works the same. Is that wanted? OK? - OK for now!

  1. checked the same case using a discount schema of type flat => that schema didn't get to line so the "no price conditions indicator" is set to #ffff00 OK