R31508-15 Purchase Invoice - Convert Line Prices

Code 31508-15
Entity Logistics.Procurement.PurchaseInvoices Entity
Name ConvertLinePrices
Attribute PurchaseInvoiceLine.UnitPrice
Layer Front-End
Events AttributeChanged(DocumentCurrency)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action IF(oldCurrency is not null and CurrencyDirectory is not null)

foreach (line in Lines) if (line.UnitPrice.Value != 0) {

IF(new Amount(line.UnitPrice.Value, oldCurrency).ConvertToOrDefault(DocumentCurrency, CurrencyDirectory)) is not null line.UnitPrice= new Amount(line.UnitPrice.Value, oldCurrency).ConvertToOrDefault(DocumentCurrency, CurrencyDirectory) if (null) IssueWarning once
Description When Document Currency is changed, Unit Price should be converted to the new currency for each of the lines in the document. If Currency Directory is missing, conversion is not made.
Message same as R30505-7 ReceivingOrder - Convert Line Prices
Version Introduced: 21
Revocable YES

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