---
id: change/bcapps/9772
type: change
title: "#9772 [PA][Pioneer]: Numeric line fields mis-extracted (discount, quantity, unit of measure)"
summary: E-Document importer now preserves zero quantities instead of forcing them to 1, derives quantity from total and price only when valid, never fabricates discounts, and carries unresolved unit codes through to the unit of measure field.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit edocument json helper
  - codeunit e-doc. mllm schema helper
  - codeunit e-document adi handler
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:10:31.052Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: b8b74184bba49dec7b0346b693331e32dd31508f
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9772
    title: "microsoft/BCApps#9772: [PA][Pioneer]: Numeric line fields mis-extracted (discount, quantity, unit of measure)"
    date: "2026-08-03"
    commit: b8b74184bba49dec7b0346b693331e32dd31508f
    t: null
    quote: Now we keep a genuine zero quantity, only derive quantity from total over price when it makes sense, and never fabricate a discount.
links:
  learn: []
  objects:
    - object/codeunit/6121
    - object/codeunit/6232
    - object/codeunit/6174
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9772
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9772
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-03T21:05:51Z"
author: Explorer986
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 4
  additions: 60
  deletions: 20
  al: 3
apps:
  - EDocument
objects_touched:
  - key: codeunit/6121
    page: codeunit/6121
    type: codeunit
    id: 6121
    name: EDocument Json Helper
    app: EDocument
    status: modified
  - key: codeunit/6232
    page: codeunit/6232
    type: codeunit
    id: 6232
    name: E-Doc. MLLM Schema Helper
    app: EDocument
    status: modified
  - key: codeunit/6174
    page: codeunit/6174
    type: codeunit
    id: 6174
    name: E-Document ADI Handler
    app: EDocument
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 642334
systems:
  - integration
quote: Now we keep a genuine zero quantity, only derive quantity from total over price when it makes sense, and never fabricate a discount.
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9772 [PA][Pioneer]: Numeric line fields mis-extracted (discount, quantity, unit of measure)

> E-Document importer now preserves zero quantities instead of forcing them to 1, derives quantity from total and price only when valid, never fabricates discounts, and carries unresolved unit codes through to the unit of measure field.

[Pull request](https://github.com/microsoft/BCApps/pull/9772) · merged into `main` (BC30) on 2026-08-03 by Explorer986 · 4 files (+60 -20), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Zero quantity lines are preserved instead of being forced to 1
- Quantity is only derived from total divided by price when mathematically sensible
- Phantom discounts are no longer invented when line total matches price times quantity
- Unresolved unit codes like HUR now appear in the BC unit of measure field instead of blank
- Fixes incorrect line extraction for scanned invoices with missing or zero quantities
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6121 "EDocument Json Helper"](../../objects/codeunit/6121.md), EDocument: modified
- [Codeunit 6232 "E-Doc. MLLM Schema Helper"](../../objects/codeunit/6232.md), EDocument: modified
- [Codeunit 6174 "E-Document ADI Handler"](../../objects/codeunit/6174.md), EDocument: modified

## Context

- Work items: AB#642334
- Labels: AL: Apps (W1), Team: Integrations
- Systems: integration
- From the description: "Now we keep a genuine zero quantity, only derive quantity from total over price when it makes sense, and never fabricate a discount."

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
