Skip to content

Merge develop into version-15#258

Merged
engahmed1190 merged 6 commits into
version-15from
merge/develop-into-version-15
May 13, 2026
Merged

Merge develop into version-15#258
engahmed1190 merged 6 commits into
version-15from
merge/develop-into-version-15

Conversation

@engahmed1190
Copy link
Copy Markdown
Contributor

Summary

Brings the develop branch (4 commits ahead) into the version-15 release branch, including PR #257 fixes for transaction-level promotional schemes and the SBB auto-creation regression for free product bundles.

Commits included

  • a01c2d7 — fix(offers): apply transaction-level promotional schemes in POS
  • ba79473 — feat(invoice): enhance free item handling in invoice submission
  • f00ad13 — fix(invoice): set use_serial_batch_fields for batch/serial-tracked rows on submit
  • 43c9d5a — fix(invoice): set use_serial_batch_fields on batch/serial-tracked packed_items

What changes

  • POS now evaluates Promotional Schemes with apply_on = Entire Transaction (previously silently ignored).
  • Free-item Jinja print format renders is_free_item rows with a "(FREE)" badge.
  • Sales Invoice override now sets use_serial_batch_fields=1 on batch/serial-tracked SI Item rows and on batch/serial-tracked packed_items (bundle components), avoiding the broken auto-SBB validation path that throws "serial and batch bundle not linked to Sales Invoice".

Test plan

  • Confirm v1.15 site can apply gift1 (Apply On: Transaction) promotion in POS cart
  • Confirm "Gift 1" free row appears in cart, payment dialog, and printed receipt with "(FREE)" badge
  • Submit a POS invoice with a batch-tracked paid item + free product bundle with batch-tracked components; verify it submits cleanly without the SBB linkage error
  • Regression check: existing per-item Pricing Rules still apply

🤖 Generated with Claude Code

engahmed1190 and others added 6 commits May 13, 2026 12:38
ERPNext routes Pricing Rules with apply_on="Transaction" through a
separate engine (apply_pricing_rule_on_transaction) that pos_next
never invoked, so "Entire Transaction" Promotional Schemes — like
"spend X get free product Y" — were silently dropped regardless of
cart contents. apply_offers() now also builds a transient (never-saved)
Sales Invoice and runs ERPNext's transaction-level engine on it,
merging any free-item rows into the existing free_items response under
the same (item_code, pricing_rule) dedup key the per-item path uses.

The POS Next Receipt Jinja template now annotates is_free_item rows
with a green "(FREE)" badge and renders the rate column as
"qty x FREE / IQD 0.00", matching the cart and offline-receipt
treatment so customers and cashiers see consistent labeling on
server-rendered prints (browser + silent QZ Tray paths).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Updated the `formatItemsForSubmission` function to synthesize dedicated free item rows when legacy carts indicate free quantities via `free_qty`. This ensures compatibility with ERPNext's Sales Invoice expectations, which require separate rows for free items. Additionally, modified the `usePOSCartStore` to consistently handle free items by adding dedicated rows, improving the overall handling of promotional offers in both online and offline modes.

Refactored the sales invoice logic to merge packed items from free bundles into their corresponding paid rows, preventing duplication and ensuring accurate stock management.
…ws on submit

When a batch-tracked paid item is submitted with batch_no but
use_serial_batch_fields=0 and no pre-created serial_and_batch_bundle,
ERPNext's auto-SBB path triggers SBB validation inside the SLE on_submit
and fails for packed_items of free product bundles with
"The serial and batch bundle X not linked to Sales Invoice Y".

Setting use_serial_batch_fields=1 whenever batch_no or serial_no is set
routes the row through ERPNext's legacy batch fields path and avoids the
broken auto-SBB validation for bundle components.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ked_items

The FE-only fix for SI Item rows is not sufficient when the bundle's
component items themselves are batch- or serial-tracked. ERPNext still
attempts auto-SBB creation for those packed_items at SLE.on_submit time
and the resulting bundle fails validate_voucher_detail_no, throwing
"The serial and batch bundle X not linked to Sales Invoice Y".

Override update_packing_list to mark batch/serial-tracked packed_items
with use_serial_batch_fields=1 so the row goes through ERPNext's legacy
batch fields path and skips the broken auto-bundle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…otional-schemes

fix(offers): apply transaction-level promotional schemes in POS
Brings PR #257 fixes:
- fix(offers): apply transaction-level promotional schemes in POS
- feat(invoice): enhance free item handling in invoice submission
- fix(invoice): set use_serial_batch_fields for batch/serial-tracked rows on submit
- fix(invoice): set use_serial_batch_fields on batch/serial-tracked packed_items
@engahmed1190 engahmed1190 merged commit b5ee185 into version-15 May 13, 2026
3 checks passed
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