---
id: change/bcapps/9396
type: change
title: "#9396 [Subcontracting] Fix subcontracting order opening wrong purchase order after creation"
summary: Fixed subcontracting order creation to open the newly created purchase order instead of displaying an old received one when production order quantity was increased after a previous subcontracting operation.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - pageextension subc. prod. order rtng.
  - codeunit subc. purchase order creator
system: manufacturing
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:10:29.855Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: eac1bcdc7a9460f4d7c3a426a6d921eb4dcafc54
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9396
    title: "microsoft/BCApps#9396: [Subcontracting] Fix subcontracting order opening wrong purchase order after creation"
    date: "2026-07-31"
    commit: eac1bcdc7a9460f4d7c3a426a6d921eb4dcafc54
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/pageextension/20503
    - object/codeunit/20557
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9396
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9396
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-31T08:49:24Z"
author: 6CRIPT
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - Subcontracting
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 195
  deletions: 52
  al: 2
apps:
  - Subcontracting
objects_touched:
  - key: pageextension/20503
    page: pageextension/20503
    type: pageextension
    id: 20503
    name: Subc. Prod. Order Rtng.
    app: Subcontracting
    status: modified
  - key: codeunit/20557
    page: codeunit/20557
    type: codeunit
    id: 20557
    name: Subc. Purchase Order Creator
    app: Subcontracting
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 639381
systems:
  - manufacturing
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9396 [Subcontracting] Fix subcontracting order opening wrong purchase order after creation

> Fixed subcontracting order creation to open the newly created purchase order instead of displaying an old received one when production order quantity was increased after a previous subcontracting operation.

[Pull request](https://github.com/microsoft/BCApps/pull/9396) · merged into `main` (BC30) on 2026-07-31 by 6CRIPT · 3 files (+195 -52), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Subcontracting order creation now correctly opens the newly created purchase order when the production order quantity increases
- The fix captures purchase orders created or updated in the current invocation before determining which ones to display
- Filtering logic was aligned with existing PurchLineExists logic to only show open, unreceived lines
- Fallback handling ensures the feature still works when an existing open PO is updated instead of creating a new one
- Two integration tests were added to cover the delta-PO and updated-open-PO scenarios
- Behaviour changes for users or extensions.

## AL objects touched

- [Page extension 20503 "Subc. Prod. Order Rtng."](../../objects/pageextension/20503.md), Subcontracting: modified
- [Codeunit 20557 "Subc. Purchase Order Creator"](../../objects/codeunit/20557.md), Subcontracting: modified

## Context

- Work items: AB#639381
- Labels: AL: Apps (W1), Subcontracting, Team: SCM
- Systems: manufacturing

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