Repository navigation
RTO and insurance changes move extra discount, not the customer price #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,21 +158,24 @@ def pack_unit_cx_is_pack_rollup(cx, snap, unit=None): | |
|
|
||
| recompute_lead stores pack payable on the lead. Overlay used to copy that | ||
| onto unit 1, so Unit 1 locked to the sum of every unit. | ||
|
|
||
| A lower RTO / insurance drops today's gross vehicle cost under the agreed | ||
| price. That gap is the extra-discount rule (Additional shrinks, payable | ||
| stays), so a price above today's GVC is still this unit. The pack total | ||
| is another vehicle: more than one and a half times this unit's ex-showroom. | ||
| """ | ||
| cx = round2(num(cx)) | ||
| if cx <= 0: | ||
| return False | ||
| snap = snap or {} | ||
| unit = unit or {} | ||
| ex = round2(num(snap.get("exShowroom") or unit.get("exShowroom"))) | ||
| if ex > 0: | ||
| return cx > ex * 1.5 + DEAL_AMOUNT_EQUAL_RUPEES | ||
|
Comment on lines
+172
to
+174
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Missing extra income on pack sales When an RTO or insurance cut exhausts the discount, Learn moreAn owner can lower RTO and insurance through Price Structure. When the agreed price remains above the revised charges, unit payable refresh keeps the agreed price and records the positive gap as extra customer income. Lead recompute only derives that income directly for single vehicles, and its lead-level margin and earnings use that single-vehicle result. The Dealer Earnings register uses the persisted lead margin, so saving or reloading the report does not recover the omitted amount. Example: A pack unit stays at ₹8,05,000 after its gross cost falls to ₹7,95,000 and the discount reaches zero. The unit records ₹10,000 in extra customer income, but none of that ₹10,000 reaches Dealer Earnings. Recommended fix: Roll up extra customer income from the freshly computed pack units and include it exactly once in persisted margin and total earnings. Extend the large-cut regression to assert the lead-level margin and the earnings register contribution. Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For a mixed-SKU pack whose first unit costs much more than another vehicle, the pack total can be below 1.5× the first unit’s ex-showroom (for example, a Storm LR200 plus a HiRange SR). This returns false for a legacy pack roll-up copied onto unit 1, so Useful? React with 👍 / 👎. |
||
| gvc = _gvc_from_charges(snap) | ||
| if gvc <= 0: | ||
| gvc = _gvc_from_charges(unit) | ||
| if gvc > 0 and cx > gvc + DEAL_AMOUNT_EQUAL_RUPEES: | ||
| return True | ||
| ex = round2(num(snap.get("exShowroom") or unit.get("exShowroom"))) | ||
| if ex > 0 and cx > ex * 1.5 + DEAL_AMOUNT_EQUAL_RUPEES: | ||
| return True | ||
| return False | ||
| return gvc > 0 and cx > gvc + DEAL_AMOUNT_EQUAL_RUPEES | ||
|
|
||
|
|
||
| def pack_unit_locked_cx_demand(snap, unit=None): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Legacy pack totals double-count cheaper vehicles
On older packs with the order total copied to unit 1,
pack_unit_cx_is_pack_rollupaccepts totals below the new cutoff. Recompute then adds the sibling prices again, inflating the customer’s balance.Learn more
Older pack price hydration could copy the lead’s commercial fields onto the first unit. The existing legacy data regression test covers a copied order total, but its total is far above the new cutoff. Price Structure runs recompute after an edit. Unit payable refresh keeps the copied Cx Demand as the first unit’s price when the cutoff misses it. Pack recompute then persists the inflated sum as payable and uses it for outstanding.
Example: A Storm with ₹12,00,000 ex-showroom has an agreed price of ₹11,80,000. A sibling costs ₹5,90,000. If unit 1 still carries the copied ₹17,70,000 pack total, the new ₹18,00,001 cutoff accepts it, and a price save writes ₹23,60,000 instead of ₹17,70,000.
Recommended fix: Distinguish explicit per-unit agreements from legacy copied totals using their source, with pack context available during reconciliation. Cover both a mixed-price pack with a copied total below the cutoff and a genuine unit agreement that exceeds GVC after a charge cut.
Was this helpful? React with 👍 or 👎 to provide feedback.