-
Notifications
You must be signed in to change notification settings - Fork 323
[Shopify] Automatic Transaction Posting #6515
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?
[Shopify] Automatic Transaction Posting #6515
Conversation
Summary This PR introduces automatic posting of Shopify order transactions as general journal lines when posting invoices and credit memos connected to Shopify Orders in Business Central. Changes New Functionality: • Automatic posting setup fields in "Shpfy Payment Method Mapping" table and page: Added "Post Automatically", "Auto-Post Jnl. Template" and "Auto-Post Jnl. Batch" fields. • Visibility for transactions which will be automatically posted: Added field "Auto-Post Enabled" to "Shpfy Order Transaction" table and "Shpfy Order Transaction" page. • Automatic post of order transactions: When posting sales order, related shopify order transactions are created as cust. ledger entries if auto-post is enabled for those transactions. • Automatic post of refund transactions: When posting sales cr. memo, related shopify refund transaction is created as cust. ledger entry if auto-post is enabled for that transaction. Prerequisites to post transactions automatically: • In "Shpfy Payment Method Mapping", "Post Automatically" is set as true, "Auto-Post Jnl. Template" and "Auto-Post Jnl. Batch" fields are filled in. • Transaction relates to "Shpfy Payment Method Mapping" which is set up for automatic post. Tests: • Added ShpfyItemAttrAsOptionTest.Codeunit.al (ID 139540) with tests for: o Auto-Post Jnl. Batch validation when journal batch has a balancing account number. o Auto-Post Jnl. Batch validation when journal batch does not have a balancing account number. o Auto-Post Jnl. Batch validation when value is empty. o Successfully automatically posting Order Transaction when Post Automatically is set to true. o Not posting Order Transaction when Post Automatically is set to false. o Successfully automatically posting multiple Order Transactions when Post Automatically is set to true. o Successfully posting only transactions linked to auto post Payment Method Mapping and not posting non linked transactions o Successfully automatically posting Refund Transaction when Post Automatically is set to true. o Successfully posting sales order when error occurs in posting of the Transaction.
|
Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link. |
|
Adding link to work item |
|
@Tautvydas-Labarauskas please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
1 similar comment
|
@Tautvydas-Labarauskas please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| GenJournalLine.SetRange("Shpfy Transaction Id", OrderTransaction."Shopify Transaction Id"); | ||
| GenJournalLine.SetRange("Automatically Posted", true); | ||
| if GenJournalLine.FindFirst() then begin | ||
| GenJournalLine.SendToPosting(Codeunit::"Gen. Jnl.-Post"); |
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.
If Post with Job Queue is enabled on the GLSetup then the lines won't be posted directly and the lines might be deleted before the actual posting.
| [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post", 'OnBeforeCode', '', false, false)] | ||
| local procedure OnBeforeCode(var GenJournalLine: Record "Gen. Journal Line"; var HideDialog: Boolean) | ||
| begin | ||
| if GenJournalLine."Automatically Posted" then |
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.
Have you thought about using manual event binding to skip the dialog instead of a boolen field in the general journal line?
You could simple use manual event binding for the posting process in Shpfy Auto Post Transactions
Summary
This PR introduces automatic posting of Shopify order transactions as general journal lines when posting invoices and credit memos connected to Shopify Orders in Business Central.
Changes
New Functionality:
Prerequisites to post transactions automatically:
Tests:
Added ShpfyAutoPostTransTest.Codeunit.al (ID 139614) with tests for:
Fixes # AB#620951