---
id: change/bcapps/12857
type: change
title: "#12857 [master]Incorrect Purchase Credit Memo created when Customer and Vendor Subscription Contracts have the same Contract Number."
summary: Billing totals now filter by both Subscription Contract No. and Partner type to prevent incorrect credit memos when customer and vendor contracts share the same number.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit billing proposal
  - table billing line
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-16T01:17:10.523Z"
  flags: []
generated:
  at: "2026-10-24T01:02:25.817Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: ff3d70c57cbfb3ade10598c76a16e1272c0ee025
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12857
    title: "microsoft/BCApps#12857: [master]Incorrect Purchase Credit Memo created when Customer and Vendor Subscription Contracts have the same Contract Number."
    date: "2026-10-15"
    commit: ff3d70c57cbfb3ade10598c76a16e1272c0ee025
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/8062
    - object/table/8061
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/SRB/sales/credit-memo-cancellation
      title: Credit memos and cancellation
      label: possibly related
      why: Describes credit memo creation for subscription billing, core to the incorrect credit memo issue being fixed.
      by: model
    - to: https://learn.microsoft.com/dynamics365/business-central/SRB/working-with-contracts/vendor-contract-integration-purchase-invoice
      title: Vendor contract integration in purchase invoices
      label: possibly related
      why: Documents vendor contract integration in purchase invoices and billing lines, directly relevant to the subscription contract bug fix.
      by: model
number: 12857
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12857
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-15T21:29:48Z"
author: neeleshsinghal
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 164
  deletions: 25
  al: 2
apps:
  - Subscription Billing
objects_touched:
  - key: codeunit/8062
    page: codeunit/8062
    type: codeunit
    id: 8062
    name: Billing Proposal
    app: Subscription Billing
    status: modified
  - key: table/8061
    page: table/8061
    type: table
    id: 8061
    name: Billing Line
    app: Subscription Billing
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 654305
systems:
  - sales
quote: null
joined_against:
  major: "30"
  commit: f18567dc08e2bd162bf192e1da4d714b57eb099f
---

# #12857 [master]Incorrect Purchase Credit Memo created when Customer and Vendor Subscription Contracts have the same Contract Number.

> Billing totals now filter by both Subscription Contract No. and Partner type to prevent incorrect credit memos when customer and vendor contracts share the same number.

[Pull request](https://github.com/microsoft/BCApps/pull/12857) · merged into `main` (BC30) on 2026-10-15 by neeleshsinghal · 3 files (+164 -25), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Added Partner filtering in GetServiceAmountForContract and GetServiceAmount methods
- Prevents customer credit memo lines from affecting vendor contract billing totals
- Fixes issue where shared contract numbers caused wrong document type (credit memo instead of invoice)
- Changes affect billing line calculations and codeunit logic
- Comprehensive test coverage added for the correction scenario
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 8062 "Billing Proposal"](../../objects/codeunit/8062.md), Subscription Billing: modified
- [Table 8061 "Billing Line"](../../objects/table/8061.md), Subscription Billing: modified

## Context

- Work items: AB#654305
- Labels: AL: Apps (W1), Team: Finance
- Systems: sales

## Possibly related

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

- [Credit memos and cancellation](https://learn.microsoft.com/dynamics365/business-central/SRB/sales/credit-memo-cancellation) — possibly related: Describes credit memo creation for subscription billing, core to the incorrect credit memo issue being fixed. (model-linked)
- [Vendor contract integration in purchase invoices](https://learn.microsoft.com/dynamics365/business-central/SRB/working-with-contracts/vendor-contract-integration-purchase-invoice) — possibly related: Documents vendor contract integration in purchase invoices and billing lines, directly relevant to the subscription contract bug fix. (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).
