Merge develop into version-15#258
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
What changes
Test plan
🤖 Generated with Claude Code