Skip to content

fix: flip clubbed DN status To Bill → Completed on consolidated SI submit#25

Merged
sayanthns merged 1 commit into
mainfrom
fix/clubbed-dn-billing-status
Jun 26, 2026
Merged

fix: flip clubbed DN status To Bill → Completed on consolidated SI submit#25
sayanthns merged 1 commit into
mainfrom
fix/clubbed-dn-billing-status

Conversation

@sayanthns

Copy link
Copy Markdown
Contributor

Problem

Clubbing multiple DNs into one net-off Sales Invoice left the source DNs stuck on To Bill.

Cause

The net-off SI omits SI Item.delivery_note (to dodge validate_multiple_billing), so ERPNext's update_billing_status sums zero linked rows → per_billed never moves. And no handler refreshed the custom_consolidated_si-linked DNs on submit (only the inter-company path handled its own custom_inter_company_si DNs).

Fix

  • SI on_submitmark_consolidated_dns_billed: set each clubbed DN per_billed=100 / status=Completed (flat).
  • SI on_cancel + on_trashunmark_consolidated_dns_billed (ERPNext recompute → To Bill), before clearing the stamp.
  • No schema change → no migrate. Regression test added (submit flips, cancel reverts).

When multiple DNs are clubbed into one net-off Sales Invoice
(consolidate_dns_to_si), the source DNs stayed on "To Bill" forever.

Cause: the net-off SI omits SI Item.delivery_note (to avoid
validate_multiple_billing), so ERPNext's update_billing_status sums zero
linked rows and never advances per_billed. And nothing refreshed the
custom_consolidated_si-linked DNs on submit (only the inter-company path
refreshed its own custom_inter_company_si DNs).

Fix: on Sales Invoice on_submit, mark every custom_consolidated_si-linked DN
per_billed=100 / status=Completed (flat — a clubbed DN is fully invoiced).
On cancel and on_trash, revert via ERPNext's update_billing_status (back to
To Bill for a pure net-off DN; reflects any other real invoices otherwise) —
done before clearing the stamp. No schema change. Regression test added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sayanthns sayanthns merged commit e433657 into main Jun 26, 2026
1 of 3 checks passed
@sayanthns sayanthns deleted the fix/clubbed-dn-billing-status branch June 26, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant