---
id: change/bcapps/14490
type: change
title: "#14490 [Master]-Repeated partial return posting reuses first credit memo and corrupts original order quantities"
summary: Fixed repeated partial return postings that were incorrectly reusing the first credit memo and corrupting original order quantities. The fix ensures each posting uses the current credit memo to update order quantities correctly.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit sales-post
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-11-27T01:03:39.433Z"
  flags: []
generated:
  at: "2026-12-02T00:15:44.908Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 959e97763dcdc6afbb3a50f3035c9c4bd675ef69
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/14490
    title: "microsoft/BCApps#14490: [Master]-Repeated partial return posting reuses first credit memo and corrupts original order quantities"
    date: "2026-11-26"
    commit: 959e97763dcdc6afbb3a50f3035c9c4bd675ef69
    t: null
    quote: Use the current posting's credit memo to update order quantities correctly from global variable
links:
  learn: []
  objects:
    - object/codeunit/80
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/design-details-item-tracking-posting-structure
      title: Design details - Item tracking posting structure
      label: possibly related
      why: touches Codeunit 80 "Sales-Post"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-snapshot-debugging
      title: Snapshot debugging
      label: possibly related
      why: touches Codeunit 80 "Sales-Post"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/sales-how-process-sales-returns-orders
      title: Process sales return orders
      label: possibly related
      why: Documents sales return orders and partial return posting workflows.
      by: model
number: 14490
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/14490
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-26T17:10:42Z"
author: neeleshsinghal
author_type: User
community_contribution: false
labels:
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 14
  additions: 252
  deletions: 60
  al: 12
apps:
  - Base Application
objects_touched:
  - key: codeunit/80
    page: codeunit/80
    type: codeunit
    id: 80
    name: Sales-Post
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports:
  - number: 14700
    base: releases/29.x
    url: https://github.com/microsoft/BCApps/pull/14700
fixes_issues: []
work_items:
  - 660149
systems:
  - sales
quote: Use the current posting's credit memo to update order quantities correctly from global variable
joined_against:
  major: "30"
  commit: f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671
---

# #14490 [Master]-Repeated partial return posting reuses first credit memo and corrupts original order quantities

> Fixed repeated partial return postings that were incorrectly reusing the first credit memo and corrupting original order quantities. The fix ensures each posting uses the current credit memo to update order quantities correctly.

[Pull request](https://github.com/microsoft/BCApps/pull/14490) · merged into `main` (BC30) on 2026-11-26 by neeleshsinghal · 14 files (+252 -60), 12 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Repeated partial returns reused the first credit memo instead of the latest posted one
- This corrupted the quantities on the original sales order
- Sales-Post now updates order quantities from the current posting's credit memo held in a global variable
- Change applied to Sales-Post in the W1, APAC, BE, CH, ES, FI, FR, GB, IT, NA, NO and RU layers
- Regression tests added in ERM Copy Purch Sales Doc (W1 and APAC)
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 80 "Sales-Post"](../../objects/codeunit/80.md), Base Application: modified
- `src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al`: modified, not in the BC30 snapshot
- `src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al`: modified, not in the BC30 snapshot
- `src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al`: modified, not in the BC30 snapshot

## Also merged into

- [#14700](https://github.com/microsoft/BCApps/pull/14700) into `releases/29.x` on 2026-12-01

## Context

- Work items: AB#660149
- Labels: Team: SCM
- Systems: sales
- From the description: "Use the current posting's credit memo to update order quantities correctly from global variable"

## Possibly related

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

- [Design details - Item tracking posting structure](https://learn.microsoft.com/dynamics365/business-central/design-details-item-tracking-posting-structure) — possibly related: touches Codeunit 80 "Sales-Post"
- [Snapshot debugging](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-snapshot-debugging) — possibly related: touches Codeunit 80 "Sales-Post"
- [Process sales return orders](https://learn.microsoft.com/dynamics365/business-central/sales-how-process-sales-returns-orders) — possibly related: Documents sales return orders and partial return posting workflows. (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).
