---
id: change/bcapps/12153
type: change
title: "#12153 [Main]-Adjust Cost Creates an Output Value Entry with Entry Type = Variance and Expected Cost = Yes After Reversing a Finished Production Order."
summary: Fixed a bug where reversing a finished production order and reposting output caused Adjust Cost to create variance value entries incorrectly marked as expected cost instead of actual cost, preventing Post Inventory Cost to G/L from completing.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit inventory adjustment
system: inventory
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: 330985a5563366ad4dd32883ed9a444770614dcd
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12153
    title: "microsoft/BCApps#12153: [Main]-Adjust Cost Creates an Output Value Entry with Entry Type = Variance and Expected Cost = Yes After Reversing a Finished Production Order."
    date: "2026-11-26"
    commit: 330985a5563366ad4dd32883ed9a444770614dcd
    t: null
    quote: Fixed in codeunit 5895 "Inventory Adjustment" (W1, APAC, RU layers), as suggested in review
links:
  learn: []
  objects:
    - object/codeunit/5895
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/finance-about-finished-production-order-costs
      title: About finished production order costs
      label: possibly related
      why: Documents finished production order cost adjustment and variance entries after reversal
      by: model
number: 12153
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12153
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-26T16:27:19Z"
author: DhavalMore88
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 4
  additions: 202
  deletions: 3
  al: 3
apps:
  - Base Application
objects_touched:
  - key: codeunit/5895
    page: codeunit/5895
    type: codeunit
    id: 5895
    name: Inventory Adjustment
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/APAC/BaseApp/Inventory/Costing/InventoryAdjustment.Codeunit.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 653000
systems:
  - inventory
quote: Fixed in codeunit 5895 "Inventory Adjustment" (W1, APAC, RU layers), as suggested in review
joined_against:
  major: "30"
  commit: f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671
---

# #12153 [Main]-Adjust Cost Creates an Output Value Entry with Entry Type = Variance and Expected Cost = Yes After Reversing a Finished Production Order.

> Fixed a bug where reversing a finished production order and reposting output caused Adjust Cost to create variance value entries incorrectly marked as expected cost instead of actual cost, preventing Post Inventory Cost to G/L from completing.

[Pull request](https://github.com/microsoft/BCApps/pull/12153) · merged into `main` (BC30) on 2026-11-26 by DhavalMore88 (community contribution) · 4 files (+202 -3), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Variance and Indirect Cost entries with zero invoiced quantity now use Valued Quantity instead when posting actual cost adjustments
- New local procedure GetActualCostAdjmtInvoicedQty determines the correct quantity for posting based on entry type
- Prevents expected cost flag from being incorrectly set on actual cost adjustments for variance entries
- Resolves Post Inventory Cost to G/L failures on standard cost items after production order reopening
- Fix applied across W1, APAC, and RU layers with new test coverage
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 5895 "Inventory Adjustment"](../../objects/codeunit/5895.md), Base Application: modified
- `src/Layers/APAC/BaseApp/Inventory/Costing/InventoryAdjustment.Codeunit.al`: modified, not in the BC30 snapshot

## Context

- Work items: AB#653000
- Labels: ADO: Sync, From Fork, Team: SCM
- Systems: inventory
- From the description: "Fixed in codeunit 5895 "Inventory Adjustment" (W1, APAC, RU layers), as suggested in review"

## Possibly related

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

- [About finished production order costs](https://learn.microsoft.com/dynamics365/business-central/finance-about-finished-production-order-costs) — possibly related: Documents finished production order cost adjustment and variance entries after reversal (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).
