---
id: change/bcapps/12816
type: change
title: "#12816 [29.x]- Project Planning Lines are created in reverse order when purchase line descriptions are copied"
summary: Fixed project planning lines being created in reverse order when posting purchase invoices with multiple G/L account lines assigned to the same project, by sorting invoice posting buffer entries in ascending order by source line number.
tier: official
language: en
tags:
  - fix
  - releases/29.x
  - bc29
  - codeunit purch. post invoice
system: purchasing
review:
  state: reviewed
  by: opus
  at: "2026-10-17T01:12:18.483Z"
  flags: []
generated:
  at: "2026-11-25T00:13:20.045Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: c6447496099645d2af1227156879611ff56e4688
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12816
    title: "microsoft/BCApps#12816: [29.x]- Project Planning Lines are created in reverse order when purchase line descriptions are copied"
    date: "2026-10-16"
    commit: c6447496099645d2af1227156879611ff56e4688
    t: null
    quote: Project Planning Lines are created in reverse order when purchase line descriptions are copied
links:
  learn: []
  objects:
    - object/codeunit/816
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/projects-how-invoice-jobs
      title: Create a project sales invoice to invoice a project
      label: possibly related
      why: Project planning lines creation from purchase invoices relates to project sales invoice documentation.
      by: model
number: 12816
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12816
kind: pr
base_branch: releases/29.x
major: "29"
merged_at: "2026-10-16T19:44:15Z"
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: 10
  additions: 583
  deletions: 60
  al: 8
apps:
  - Base Application
objects_touched:
  - key: codeunit/816
    page: codeunit/816
    type: codeunit
    id: 816
    name: Purch. Post Invoice
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/CH/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/RU/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 651069
systems:
  - purchasing
quote: Project Planning Lines are created in reverse order when purchase line descriptions are copied
joined_against:
  major: "29"
  commit: e646fc169eb3bb7b1947b2089ed943d91dec46b0
---

# #12816 [29.x]- Project Planning Lines are created in reverse order when purchase line descriptions are copied

> Fixed project planning lines being created in reverse order when posting purchase invoices with multiple G/L account lines assigned to the same project, by sorting invoice posting buffer entries in ascending order by source line number.

[Pull request](https://github.com/microsoft/BCApps/pull/12816) · merged into `releases/29.x` (BC29) on 2026-10-16 by DhavalMore88 (community contribution) · 10 files (+583 -60), 8 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Project planning lines now maintain the original purchase line sequence when 'Copy Line Descr. to G/L Entry' is enabled
- Buffer processing loop in PurchPostInvoice codeunit modified to iterate groups in ascending order by source line number
- G/L Entry, VAT Entry, and Job Ledger Entry posting behavior remains unaffected
- Bug reproduced in job consumption purchase tests with multiple lines assigned to same project task
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 816 "Purch. Post Invoice"](../../objects/codeunit/816.md), Base Application: modified
- `src/Layers/CH/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al`: modified, not in the BC29 snapshot
- `src/Layers/RU/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al`: modified, not in the BC29 snapshot

## Context

- Work items: AB#651069
- Labels: ADO: Sync, From Fork, Team: SCM
- Systems: purchasing
- From the description: "Project Planning Lines are created in reverse order when purchase line descriptions are copied"

## Possibly related

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

- [Create a project sales invoice to invoice a project](https://learn.microsoft.com/dynamics365/business-central/projects-how-invoice-jobs) — possibly related: Project planning lines creation from purchase invoices relates to project sales invoice documentation. (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).
