-
Notifications
You must be signed in to change notification settings - Fork 398
[Master]-Take Payment Discounts setting does not work as expected in the Suggest Vendor Payments EB routine from the EB Payment Journal in the Belgian version. #9092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,11 +119,20 @@ report 2000019 "Suggest Vendor Payments EB" | |
| ApplicationArea = Basic, Suite; | ||
| Caption = 'Take Payment Discounts'; | ||
| ToolTip = 'Specifies if you want the batch job to include vendor ledger entries for which you can receive a payment discount.'; | ||
|
|
||
| trigger OnValidate() | ||
| begin | ||
| if (IncPmtDiscount) and (PmtDiscDueDate = 0D) then | ||
| PmtDiscDueDate := WorkDate() | ||
| else | ||
| PmtDiscDueDate := 0D; | ||
| end; | ||
| } | ||
| field(PmtDiscDueDate; PmtDiscDueDate) | ||
| { | ||
| ApplicationArea = Basic, Suite; | ||
| Caption = 'Payment Discount Date'; | ||
| Editable = IncPmtDiscount; | ||
| ToolTip = 'Specifies the date that will be used to calculate the payment discount.'; | ||
| } | ||
| field(MaximumAmount; MaximumAmount) | ||
|
|
@@ -151,8 +160,10 @@ report 2000019 "Suggest Vendor Payments EB" | |
| begin | ||
| if DueDate = 0D then | ||
| DueDate := WorkDate(); | ||
| if PmtDiscDueDate = 0D then | ||
| PmtDiscDueDate := WorkDate(); | ||
| if (IncPmtDiscount) and (PmtDiscDueDate = 0D) then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Report 2000019 declares SaveValues = true, so IncPmtDiscount and PmtDiscDueDate are meant to persist across invocations.The new OnOpenPage logic is Recommendation:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
||
| PmtDiscDueDate := WorkDate() | ||
| else | ||
| PmtDiscDueDate := 0D; | ||
| if PostingDate = 0D then | ||
| PostingDate := WorkDate(); | ||
| IncCreditMemos := true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the IncPmtDiscount field's OnValidate trigger, the new logic 'if (IncPmtDiscount) and (PmtDiscDueDate = 0D) then PmtDiscDueDate := WorkDate() else PmtDiscDueDate := 0D' resets PmtDiscDueDate to 0D whenever IncPmtDiscount is true but PmtDiscDueDate already holds a non-zero value (the else branch fires because the AND condition requires PmtDiscDueDate = 0D).
The prior code only ever initialized an empty date and never clobbered an already-set one. Recommend nesting the checks so a non-zero date is preserved when the checkbox is enabled, and only cleared when it is disabled: guard the WorkDate() default inside 'if IncPmtDiscount then' and only assign 0D in the 'else' for IncPmtDiscount = false.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why