R28360 SalesOrder - Allow Any But Not Both Allowed Directions

Code R28360
Entity Crm.Sales.SalesOrders Entity
Name AllowAnyButNotBothAllowedDirections
Attribute -
Layer Front-End

Back-End
Events Planning +
Modify NO
Action Validate that:

If (SalesOrder.SalesOrdersOptions.AllowedDirections == AllowedDirections.AllowAnyButNotBoth) (All(*).SalesOrderLines.LineAmount >= 0 && All(*).SalesOrderLines.Quantity >= 0) || (All(*).SalesOrderLines.LineAmount <= 0 and All(*).SalesOrderLines.Quantity <= 0)
Description Each specific sales order type may be set to support different type of rows (see Sales order row types). The need of such restriction may origin from various reasons - for example the generation procedures which are set in the sales order type may be selected only for returning goods and these settings may not be applicable if we are processing normal goods or services sales rows.

The 'Allow any, but not both' option requires all rows of the document to have only Quantity <= 0 and LineAmount <= 0 or Quantity >= 0 and LineAmount >= 0.
Message The allowed directions setting for document '{DocumentText}' is set to 'Allow any, but not both' but there are lines in the document from both types (that return and that do not return products or services). Delete some of the lines or edit them so that all lines are from the same type.
Introduced In Version 2018
Revocable NO

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