Skip to content

fix: resolve missing item, tax account and payment schedule in PEPPOL parser#38

Merged
pritambiswal merged 1 commit intoprilk-consulting:developfrom
maasanto:fix/peppol-parser-missing-values
Feb 13, 2026
Merged

fix: resolve missing item, tax account and payment schedule in PEPPOL parser#38
pritambiswal merged 1 commit intoprilk-consulting:developfrom
maasanto:fix/peppol-parser-missing-values

Conversation

@maasanto
Copy link

@maasanto maasanto commented Feb 12, 2026

Summary

When creating a Purchase Invoice from an incoming EDocument without matching_data, three issues prevent successful document creation:

  • Item not resolved: when no matching_data, BuyersItemIdentification or Item Supplier record exists, item_code stays None. ERPNext's set_missing_item_details() skips items without item_code, so the expense account from Item Defaults is never loaded → "Compte de charge est obligatoire pour l'article X"
  • Tax account_head empty: the tax account guessing in guess_missing_values was a no-op stub (pass). Missing account_head and description are mandatory fields on the taxes child table
  • Payment schedule crash: when no complex payment terms exist in the XML, a default Payment Schedule entry was created with only due_date and no payment_amount, causing a TypeError in ERPNext's set_payment_schedule()

Changes

Item name matching (guess_missing_values): after seller_product_id lookup fails, try matching by item_name as a last resort (exact match on Item doctype name, then by item_name field).

Tax account lookup (guess_missing_values): query Purchase Taxes and Charges Template rows matching the tax rate and company to resolve account_head. Set a default description when missing.

Payment schedule (parse_peppol_payment_terms): don't create a default entry with only due_date. ERPNext will compute the schedule from the payment_terms_template (resolved via supplier defaults by set_missing_values).

Test plan

  • Create an incoming EDocument with an item that exists by name but has no matching_data
  • Verify the Purchase Invoice is created with correct expense_account from Item Defaults
  • Verify tax rows have account_head resolved from Purchase Taxes templates
  • Verify no payment_schedule crash when XML has no complex payment terms

@maasanto maasanto marked this pull request as draft February 12, 2026 14:40
… parser

Three issues preventing Purchase Invoice creation from incoming EDocuments:

1. Items not matched by name: when no matching_data, buyer_item_id or
   seller_product_id match exists, try matching by item_name (exact match
   on Item doctype). Without item_code, set_missing_item_details skips
   the item and expense_account is never resolved.

2. Tax account_head left empty: the tax guessing stub was a no-op.
   Now looks up account_head from existing Purchase Taxes templates
   matching the rate and company.

3. Payment schedule entry with only due_date (no payment_amount) caused
   a TypeError in set_payment_schedule. Don't create a default entry;
   let ERPNext compute it from payment_terms_template.
@maasanto maasanto force-pushed the fix/peppol-parser-missing-values branch from 102ca1f to 9562017 Compare February 12, 2026 15:00
@maasanto maasanto marked this pull request as ready for review February 13, 2026 08:47
@pritambiswal pritambiswal merged commit f38d7a3 into prilk-consulting:develop Feb 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants