R30383-23 InvoiceLine - Convert Unit Price

Code 30383-23
Entity Crm.Invoicing.InvoiceLines Entity
Name ConvertUnitPrice
Attribute UnitPrice
Layer Front-End
Events AttributeChanged(QuantityUnit)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action IF(oldQuantityUnit!=null AND newQuantityUnit!=null AND oldQuantityUnit!=newQuantityUnit AND Product!=null AND UnitPrice!=null)

Ratio = Product.GetRatio(oldQuantityUnit, newQuantityUnit)

UnitPrice = UnitPrice*ratio.Divisor/ratio.Multiplier
Description When Quantity Unit is changed from one value to another and neither of them is null, if Product and Unit Price in the line are not empty, the current value of Unit Price should be converted using the ratio between these two Measurement units.
Message
Version Introduced: 2020
Revocable YES

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.