---
id: change/bcapps/11256
type: change
title: "#11256 [main] Add setup option to restore Sales and Purchase Order quantities when posting returns"
summary: Added optional settings to control whether credit memo and invoice-correction operations restore quantities on originating sales and purchase orders, with both settings enabled by default to maintain current behavior.
tier: official
language: en
tags:
  - feature
  - main
  - bc30
  - codeunit contoso purchase
  - codeunit contoso sales receivable setup
  - codeunit correct posted purch. invoice
  - table purchases & payables setup
  - codeunit correct posted sales invoice
  - table sales & receivables setup
system: purchasing
review:
  state: reviewed
  by: opus
  at: "2026-11-07T01:03:56.773Z"
  flags: []
generated:
  at: "2026-11-08T00:19:04.246Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 3452841d8a68db52375c227e17141a0481266527
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/11256
    title: "microsoft/BCApps#11256: [main] Add setup option to restore Sales and Purchase Order quantities when posting returns"
    date: "2026-11-06"
    commit: 3452841d8a68db52375c227e17141a0481266527
    t: null
    quote: Adds settings to control whether existing credit-memo and invoice-correction flows restore quantities on originating sales and purchase orders
links:
  learn: []
  objects:
    - object/codeunit/4781
    - object/codeunit/5269
    - object/codeunit/1313
    - object/table/312
    - object/codeunit/1303
    - object/table/311
    - object/codeunit/104000
    - object/codeunit/9998
    - object/codeunit/1325
    - object/page/460
    - object/codeunit/1323
    - object/page/459
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/LocalFunctionality/Belgium/specify-journal-template-mandatory
      title: Make Journal Templates Mandatory [BE]
      label: possibly related
      why: touches Table 312 "Purchases & Payables Setup"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/match-purchase-invoice-drafts-to-orders
      title: Match Purchase Invoice Drafts to Purchase Orders
      label: possibly related
      why: touches Table 312 "Purchases & Payables Setup"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/purchasing-how-correct-cancel-unpaid-purchase-invoices
      title: Amend or cancel unpaid purchase invoices
      label: possibly related
      why: Correcting/canceling purchase invoices with this new setup option to restore order quantities.
      by: model
    - to: https://learn.microsoft.com/dynamics365/business-central/sales-how-correct-cancel-sales-invoice
      title: Correct or cancel a posted sales invoice
      label: possibly related
      why: Correcting/canceling sales invoices with this new setup option to restore order quantities.
      by: model
number: 11256
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/11256
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-06T17:57:06Z"
author: JakovljevicDusan
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: SCM"
change_class: code
change_kind: feature
behavior_change: true
breaking: false
files:
  count: 99
  additions: 4508
  deletions: 752
  al: 67
apps:
  - Base Application
  - ContosoCoffeeDemoDataset
objects_touched:
  - key: codeunit/4781
    page: codeunit/4781
    type: codeunit
    id: 4781
    name: Contoso Purchase
    app: ContosoCoffeeDemoDataset
    status: modified
  - key: codeunit/5269
    page: codeunit/5269
    type: codeunit
    id: 5269
    name: Contoso Sales Receivable Setup
    app: ContosoCoffeeDemoDataset
    status: modified
  - key: codeunit/1313
    page: codeunit/1313
    type: codeunit
    id: 1313
    name: Correct Posted Purch. Invoice
    app: Base Application
    status: modified
  - key: table/312
    page: table/312
    type: table
    id: 312
    name: Purchases & Payables Setup
    app: Base Application
    status: modified
  - key: codeunit/1303
    page: codeunit/1303
    type: codeunit
    id: 1303
    name: Correct Posted Sales Invoice
    app: Base Application
    status: modified
  - key: table/311
    page: table/311
    type: table
    id: 311
    name: Sales & Receivables Setup
    app: Base Application
    status: modified
  - key: codeunit/104000
    page: codeunit/104000
    type: codeunit
    id: 104000
    name: Upgrade - BaseApp
    app: Base Application
    status: modified
  - key: codeunit/9998
    page: codeunit/9998
    type: codeunit
    id: 9998
    name: Upgrade Tag Definitions
    app: Base Application
    status: modified
  - key: codeunit/1325
    page: codeunit/1325
    type: codeunit
    id: 1325
    name: Cancel PstdPurchInv (Yes/No)
    app: Base Application
    status: modified
  - key: page/460
    page: page/460
    type: page
    id: 460
    name: Purchases & Payables Setup
    app: Base Application
    status: modified
  - key: codeunit/1323
    page: codeunit/1323
    type: codeunit
    id: 1323
    name: Cancel PstdSalesInv (Yes/No)
    app: Base Application
    status: modified
  - key: page/459
    page: page/459
    type: page
    id: 459
    name: Sales & Receivables Setup
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/APAC/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/APAC/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/CH/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/DACH/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Purchases/History/CorrectPostedPurchInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Sales/History/CorrectPostedSalesInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/FI/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/FI/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/GB/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/GB/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/IS/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/IT/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/IT/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/NA/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/NA/BaseApp/Sales/Setup/SalesReceivablesSetup.Table.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/NO/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/NO/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/RU/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/RU/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 648443
  - 649626
systems:
  - purchasing
  - sales
  - platform
quote: Adds settings to control whether existing credit-memo and invoice-correction flows restore quantities on originating sales and purchase orders
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #11256 [main] Add setup option to restore Sales and Purchase Order quantities when posting returns

> Added optional settings to control whether credit memo and invoice-correction operations restore quantities on originating sales and purchase orders, with both settings enabled by default to maintain current behavior.

[Pull request](https://github.com/microsoft/BCApps/pull/11256) · merged into `main` (BC30) on 2026-11-06 by JakovljevicDusan · 99 files (+4508 -752), 67 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- New setup fields added to Sales & Receivables Setup and Purchases & Payables Setup tables to control quantity restoration on corrective operations
- When enabled, existing quantity-restoration behavior is preserved; when disabled, quantities remain unchanged on originating orders
- Restoration-specific confirmations and warnings display only when the setting is enabled
- Prepayment deduction reversals proceed regardless of settings to maintain order consistency
- All existing and new companies default to enabled settings, and comprehensive test coverage includes both enabled and disabled scenarios
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 4781 "Contoso Purchase"](../../objects/codeunit/4781.md), ContosoCoffeeDemoDataset: modified
- [Codeunit 5269 "Contoso Sales Receivable Setup"](../../objects/codeunit/5269.md), ContosoCoffeeDemoDataset: modified
- [Codeunit 1313 "Correct Posted Purch. Invoice"](../../objects/codeunit/1313.md), Base Application: modified
- [Table 312 "Purchases & Payables Setup"](../../objects/table/312.md), Base Application: modified
- [Codeunit 1303 "Correct Posted Sales Invoice"](../../objects/codeunit/1303.md), Base Application: modified
- [Table 311 "Sales & Receivables Setup"](../../objects/table/311.md), Base Application: modified
- [Codeunit 104000 "Upgrade - BaseApp"](../../objects/codeunit/104000.md), Base Application: modified
- [Codeunit 9998 "Upgrade Tag Definitions"](../../objects/codeunit/9998.md), Base Application: modified
- [Codeunit 1325 "Cancel PstdPurchInv (Yes/No)"](../../objects/codeunit/1325.md), Base Application: modified
- [Page 460 "Purchases & Payables Setup"](../../objects/page/460.md), Base Application: modified
- [Codeunit 1323 "Cancel PstdSalesInv (Yes/No)"](../../objects/codeunit/1323.md), Base Application: modified
- [Page 459 "Sales & Receivables Setup"](../../objects/page/459.md), Base Application: modified
- `src/Layers/APAC/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/APAC/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/CH/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/DACH/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/ES/BaseApp/Purchases/History/CorrectPostedPurchInvoice.Codeunit.al`: modified, not in the BC30 snapshot
- `src/Layers/ES/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/ES/BaseApp/Sales/History/CorrectPostedSalesInvoice.Codeunit.al`: modified, not in the BC30 snapshot
- `src/Layers/ES/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/FI/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/FI/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/GB/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/GB/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/IS/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/IT/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/IT/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/NA/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/NA/BaseApp/Sales/Setup/SalesReceivablesSetup.Table.al`: modified, not in the BC30 snapshot
- `src/Layers/NO/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/NO/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/RU/BaseApp/Purchases/Setup/PurchasesPayablesSetup.Page.al`: modified, not in the BC30 snapshot
- `src/Layers/RU/BaseApp/Sales/Setup/SalesReceivablesSetup.Page.al`: modified, not in the BC30 snapshot

## Context

- Work items: AB#648443, AB#649626
- Labels: AL: Apps (W1), Team: SCM
- Systems: purchasing, sales, platform
- From the description: "Adds settings to control whether existing credit-memo and invoice-correction flows restore quantities on originating sales and purchase orders"

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Make Journal Templates Mandatory \[BE\]](https://learn.microsoft.com/dynamics365/business-central/LocalFunctionality/Belgium/specify-journal-template-mandatory) — possibly related: touches Table 312 "Purchases & Payables Setup"
- [Match Purchase Invoice Drafts to Purchase Orders](https://learn.microsoft.com/dynamics365/business-central/match-purchase-invoice-drafts-to-orders) — possibly related: touches Table 312 "Purchases & Payables Setup"
- [Amend or cancel unpaid purchase invoices](https://learn.microsoft.com/dynamics365/business-central/purchasing-how-correct-cancel-unpaid-purchase-invoices) — possibly related: Correcting/canceling purchase invoices with this new setup option to restore order quantities. (model-linked)
- [Correct or cancel a posted sales invoice](https://learn.microsoft.com/dynamics365/business-central/sales-how-correct-cancel-sales-invoice) — possibly related: Correcting/canceling sales invoices with this new setup option to restore order quantities. (model-linked)

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).
