Skip to content

[Shopify] Do not create multiple links for the same invoice#6019

Merged
onbuyuka merged 1 commit intomainfrom
bugs/617360-ShpfyGetShipmentLines
Jan 6, 2026
Merged

[Shopify] Do not create multiple links for the same invoice#6019
onbuyuka merged 1 commit intomainfrom
bugs/617360-ShpfyGetShipmentLines

Conversation

@onbuyuka
Copy link
Copy Markdown
Contributor

@onbuyuka onbuyuka commented Jan 5, 2026

Fix: Duplicate document link error when posting consolidated invoice for multi-location Shopify orders

Problem

When posting a sales invoice that consolidates shipments from the same Shopify order, the system throws the error:

"The record in table Doc. Link To BC Doc. already exists. Identification fields and values: Shopify Document Type='Shopify Order' Shopify Document Id='...' Document Type='Posted Sales Invoice', Document No.='...'"

This occurs when:

  • A Shopify order contains items from multiple locations
  • Each location is shipped separately, creating multiple posted sales shipments
  • Both shipments are combined into a single consolidated invoice using "Get Shipment Lines"

The issue is that the code iterates through all shipment lines being invoiced and attempts to insert a document link for each shipment. When multiple shipments belong to the same Shopify order, it tries to create duplicate links to the same posted sales invoice.

Solution

Before creating a new document link from a Shopify order to the posted sales invoice, the code now checks if a link already exists for that specific combination of:

  • Shopify Document Type
  • Shopify Document Id
  • Document Type (Posted Sales Invoice)
  • Document No. (Invoice number)

Only if no existing link is found will a new one be created, preventing the duplicate record error.

Work Item(s)

Fixes AB#617360

@onbuyuka onbuyuka requested a review from a team as a code owner January 5, 2026 14:42
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 5, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Jan 5, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) January 6, 2026 10:38
@onbuyuka onbuyuka merged commit 798d3f7 into main Jan 6, 2026
42 checks passed
@onbuyuka onbuyuka deleted the bugs/617360-ShpfyGetShipmentLines branch January 6, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants