CRM0207 Create Asset Оrder
Basic Information
Module | Crm.Invoices |
---|---|
Code | CRM0207 |
Parent Document | Invoice |
Sub-document | AssetOrder |
Full Name | Create Asset Оrder |
Status | ACTIVE |
Deterministic | YES |
Supports Transitional Documents | NO |
Replaces | GenerateAssetOrder |
Orphan Rows | Forbid |
Introduced In Version | 2018.2 |
Date of Suspension | - |
Business Logic
The generation procedure is activated when in the Invoice lines there are assets (assets are products with Product.ProductType.IsFixedAsset = true). For each such product, its corresponding fixed asset is found, and for all the found assets, an Asset Order is created in the Fixed Assets module for their retirement.
The AssetOrder header is created as follows:
AssetOrder.Operation = Sale
The rest of the Document table attributes are filled in as described in Standard Document Attributes.
Fulfillments
Name | InvoiceLineToAssetOrderLine |
---|---|
Parent Entity | InvoiceLine |
Child Entity | AssetOrderLine |
Parent / Child Relationship | AssetOrderLine.ParentDocument = Invoice;AssetOrderLine.ParentLineNo = InvoiceLine.LineNo |
Metrics
Fulfillment Name | Metric Name | Measurement Unit | Parent Value | Child Value | New Record |
---|---|---|---|---|---|
InvoiceLineToAssetOrderLine | MQuantity | InvoiceLine.QuantityUnit | InvoiceLine.Quantity | AssetOrderLine.Quantity | YES |
InvoiceLineToAssetOrderLine | MLineAmount | Invoice.DocumentCurrency | InvoiceLine.AssetValue | AssetOrderLine.AssetValue | YES |
The generation includes only Invoice Lines which product has value and which is a fixed asset and which quantity is not 0. For each of those lines, its corresponding fixed asset is found (Asset) and its sale value is defined (AssetValue). The Asset is defined by an asset with the same code as the product (Asset.Code == InvoiceLine.Product.PartNumber). If there are products for which no asset is found - the generation breaks and throws an error:
> Cannot find a record with Asset Code '{Product.PartNumber}' in the Assets table.
The AssetValue is defined as follows: the LineAmount of the InvoiceLine is summed up with the amounts of all additional amounts where AddToLine == true.
If the Quantity in the row is -1, the generation procedure breaks and throws an error:
> Line {LineNo} of {DocumentText} has invalid quantity of {Quantity}. The generated document is Asset Order for sale and the quantity cannot be negative.
The AssetOrder lines are generated according to the data of the unfulfilled quantities and amounts. For each InvoiceLine from the Invoice, which product is fixed asset and quantity is not zero, REMAINING(MQuantity) and REMAINING(MLineAmount) are defined. If at least one of them is not 0, a new AssetOrderLine is created as follows:
AssetOrderLine.Asset = Asset AssetOrderLine.AssetValue = REMAINING(MLineAmount) AssetOrderLine.AssetValueCurrency = InvoiceLine.Invoice.DocumentCurrency AssetOrderLine.Quantity = REMAINING(MQuantity) AssetOrderLine.ParentLineNo = InvoiceLine.LineNo
AssetOrderLine.ParentDocument = Invoice