R30077 SalesOrder - POS Return For Sales Order Line Required

Code R30077
Entity Crm.Sales.SalesOrders Entity
Name POSReturnForSalesOrderLineRequired
Attribute Line.ReturnForSalesOrderLine
Layer Back-End
Events FirmPlanning +
Priority Normal
Modify NO
Applicable Legislations BG (EnterpriseCompany.Company)
Action Validate that:

If ((PosLocation != NULL) &&

(SalesOrdersOptions [DocumentType=SalesOrder.DocumentType].AllowedDirections = SalesReturn))

, then Child.Lines[(HistoricalDataJson = NULL) && (ReturnForSalesOrderLine = NULL)].Count() == 0
Description When returning products in a POS Location, according to the Bulgarian legislation, the return receipt must contain particular information about the Sales Order and the fiscal receipt with which the products are sold. Such information is the Fiscal Sales Number of the original Sales Order and the number, date and time, amount and fiscal memory number of the original fiscal receipt.

This information can be gathered automatically by the system. In this case the relation between the return sale and the sales order for the sale of the products is made through the field 'Return For Sales Order Line' in the return sale's lines.

Alternatively, the information can be entered manually in the filed Historical Data Json in the lines of the return Sales Order.

For this reason, the current rule reassures that if the Allowed Direction of the Sales Orders's document type is 'Sales Return' and the field POS Location has a value - then at least one of the fields 'Return For Sales Order Line' or 'Historical Data Json' is filled in.
Message The fields 'Return For Sales Order Line' and 'Historical Data Json' in line number '{LineNo}' of document '{DocumentText}' do not have values.

Please, make sure that at least one of the fields 'Return For Sales Order Line' or 'Historical Data Json' is filled in all of the lines of the return sales order.
Version Introduced: 2019.1

Updated: 2019.1 - Added condition HistoricalDataJson = NULL
Revocable NO

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