When posting a Sales Invoice (Page43) the function Post() on the Page is called.
Since 2018 the line with the condition "IF ApplicationAreaSetup.IsFoundationEnabled THEN" is removed.
Scenario: When I post invoices to Customers, I like to keep the format (number of lines) the same each invoice. That means that there will be invoices that have lines with Quantity = 0. But now it is not possible to post an Invoice that has 1 or more lines where the Quantity is 0.
Does anyone know what the logic is to remove this option and why this is not made optional with setting?
LOCAL Post(PostingCodeunitID : Integer;Navigate : Option)
IF ApplicationAreaSetup.IsFoundationEnabled THEN
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec);
0
Answers
SalesLine.SETRANGE("Document No.",SalesHeader."No.");
SalesLine.SETRANGE("Document Type",SalesHeader."Document Type");
SalesLine.SETFILTER(Type,'<>%1',SalesLine.Type::" ");
can't you add lines with a blank type?
SalesLine.SETRANGE("Document No.",SalesHeader."No.");
SalesLine.SETRANGE("Document Type",SalesHeader."Document Type");
SalesLine.SETFILTER(Type,'<>%1',SalesLine.Type::" ");
IF SalesLine.FINDSET THEN
REPEAT
IF (SalesLine."No." <> '') AND (SalesLine.Quantity = 0) THEN
ERROR(LinesMissingQuantityErr);
UNTIL SalesLine.NEXT = 0;
There is a special value of Type field, 0 (Type::" ") which is meant to serve as a free-text/inline comments in sales documents. For other line types if you put something into No. then some Quantity is expected and this is, in my opinion, not an unreasonable requirement.
This can be seen as a check if someone started to populate the Sales Line (typed some Type and some No.) but has not finished yet, therefore an attempt of posting such 'unfinished' sales order ends up with an error. It is, again in my opinion, better to have this way rather than letting the half-empty line to go through posting.
If you don't want to post anything from a Sales Line but you do want it in the posted document set both Qty. to Ship and Qty To Invoice to 0 before posting Sales Order
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
In the Sales Invoice Page (43) the code and functionality behind the Post function has changed; a line with No. <> '' and Quantity = 0 can NOT be posted.
Fine, if this is the new functionality. But why is it not the same between Order and Invoice?
Code in page 42
LOCAL Post(PostingCodeunitID : Integer;Navigate : Option)
IF ApplicationAreaSetup.IsFoundationEnabled THEN
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec);
SendToPosting(PostingCodeunitID);
Code in Page 43
LOCAL Post(PostingCodeunitID : Integer;Navigate : Option)
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec);
PreAssignedNo := "No.";
SendToPosting(PostingCodeunitID);
From that point of view it might be seen as that you have exploited an error in the code, an ommision in checking if the line has been fully populated. This error has now been fixed by MS in one place but not in another. Why? Only God and Microsoft know. Well maybe Microsoft only ...
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03