R30383-25 InvoiceLine - Load Standard Unit Price

Code 30383-25
Entity Crm.Invoicing.InvoiceLines Entity
Name LoadStandardUnitPrice
Attribute UnitPrice
Layer Front-End
Events AttributeChanged(Product)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action if (Product != null AND QuantityUnit != null AND Invoice.DocumentCurrency != null) muRatio = Product.GetRatioToBaseOrDefault(QuantityUnit)

pricePerUnit = (Product.StandardPricePerLot * muRatio.Divisor) / (Product.StandardLotSizeBase* muRatio.Multiplier)

//convert the product price to the document currency productCurrency = Product.CostingCurrency or if null CurrentEnterpriseCompany.BaseCurrency

if (productCurrency != null AND productCurrency != Invoice.DocumentCurrency)

if (Invoice.CurrencyDirectory == null) => can't calculate if (Invoice.CurrencyDirectory != null) => pricePerUnit = pricePerUnit.ConvertTo(Invoice.DocumentCurrency, Invoice.CurrencyDirectory)

UnitPrice = pricePerUnit
Description When Product is changed, Unit Price should be calculated using the Standard Price Per Lot from the product's definition. The standard price per lot is first converted to the measurement unit set as Quantity Unit in the line, then divided by the Standard Lot Size of the product. If the Product has a Costing Currency set and it is different from the Base Currency of the current Enterprise Company, then the calculated price per unit should be converted to the product's costing currency. If the convertion can't be done, because the document's Currency Directory is null, the action is terminated. Finally the Unit price is set to the calculated price per unit.
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.