[Bug]: XRechnung – Posting purchase document unrelated to E-Documents triggers error about missing Customer
Describe the issue
When posting or releasing a purchase document in Business Central (Germany localization) with the E-Document Service for XRechnung enabled, the system incorrectly validates the Buyer Reference setting.
Even though the Buyer Reference field is only relevant for sales documents (Sales Header, Sales Invoice Header, Sales Cr. Memo Header), the system attempts to fetch a Customer record when processing a purchase document.
This results in an error message:
The Customer does not exist. Identification fields and values: No.='V00010'
This behavior is incorrect because:
- Buyer Reference should not be validated on the purchase side.
- The check should only apply to sales documents selected for export via the E-Document Service.
- Current logic ignores the E-Document Service setup and applies validation globally.
Expected behavior
- Posting or releasing purchase documents should not trigger validation of the Buyer Reference field as the field is non-existent in purchase.
- The system should only enforce Buyer Reference checks on sales documents (Sales, Sales Invoices, Sales Credit Memos) that are explicitly selected for export via the E-Document Service.
Steps to reproduce
- Use Business Central for Germany.
- Enable E-Document Service for XRechnung.
- In setup:
- Set Buyer Reference Mandatory = Yes
- Set Buyer Reference = Customer Reference
- Configure a Workflow for XRechnung (per docs).
- Configure a Document Sending Profile for XRechnung (per docs).
- Mark this sending profile as the default profile.
- Create a new Vendor.
- Create a Purchase Order for this vendor.
- Attempt to release the purchase order.
- Observe the error:
The Customer does not exist. Identification fields and values: No.='V00010'
Additional context
Fixes AB#609592
No response
I will provide a fix for a bug
- [x] I will provide a fix for a bug
@djukicmilica FYI
This issue has been approved for contribution ✅ Thanks for contributing.
@JesperSchulz Can the Issue be moved to BCApps as the E-Docs module has been moved to BCApps?
@JesperSchulz sorry for pinging once again but the XRechnung seems to be present in ALAppExtensions in DE folder as this is a germany localization. Can you move it back to ALAppExtensions?