Commit Graph

59074 Commits

Author SHA1 Message Date
Mihir Kandoi
32216bd75b fix(pos): return raw Item Group names from get_item_groups (double-escape regression)
The Postgres-portability change moved the POS item-group filters to the query builder
(item.item_group.isin(...)) and frappe.get_all(["name","in",...]), which escape values
once. get_item_groups() still pre-escaped each name with frappe.db.escape(), so the
names were escaped TWICE -> `item_group IN ('''Products''')`, matching nothing. Any POS
Profile that restricts item groups returned ZERO items, on both MariaDB and Postgres.

Return raw names; the parameterized callers escape them correctly. (get_parent_item_group
also returned the quoted literal before this fix.) Add a regression test: a POS Profile
restricted to an item group must still surface that group's items — it returns 0 before
the fix and passes after, on both engines.
2026-06-22 19:00:35 +05:30
Nabin Hait
a120bf8363 Merge pull request #56286 from nabinhait/ci-patch-test-no-workers-during-migrate
ci: don't run background workers during patch-test migrate
2026-06-22 17:05:15 +05:30
Nabin Hait
d48cffd1a5 Merge pull request #56303 from nabinhait/test-blanket-order-multirow
test(blanket_order): cover over-ordering aggregated across rows
2026-06-22 17:04:35 +05:30
Mihir Kandoi
624844d52f Merge pull request #56308 from mihir-kandoi/gh55802
fix: submittable product bundle issues
2026-06-22 16:15:59 +05:30
Nishka Gosalia
c24fc063fc Merge pull request #56309 from nishkagosalia/migrating-document-naming-setting
fix: Removing the document naming series dialog and moving to framework
2026-06-22 16:07:08 +05:30
Nabin Hait
3f832d4ee0 Merge pull request #56247 from nabinhait/commission-rate-data-to-percent
fix(selling): make commission_rate a Percent field on Sales Person and Sales Team
2026-06-22 15:56:30 +05:30
Mihir Kandoi
d48a1e0d16 fix: address product bundle review comments 2026-06-22 15:53:52 +05:30
nishkagosalia
aa7402b1e3 fix: removing the document naming series dialog and moving to framework 2026-06-22 15:46:15 +05:30
Mihir Kandoi
a218b8db8c fix: submittable product bundle issues 2026-06-22 15:40:16 +05:30
rohitwaghchaure
9b8c363bed feat: capitalize full actual charge on stock items only for Purchase Invoice (#56223)
* feat: capitalize full actual charge on stock items only for Purchase Invoice

Extends #56102 (Purchase Receipt) to the Purchase Invoice GL: an actual
valuation charge (e.g. Freight) flagged 'Allocate Full Amount to Stock Items'
is fully capitalized onto stock/asset items only; when unchecked, only the
stock items' share of a spread-across-all-items charge is capitalized.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: aggregate GL rows per account in PI freight test

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 15:39:10 +05:30
Mihir Kandoi
23bbcca97e Merge pull request #56306 from frappe/codex/fix-address-portal-row
fix: link portal address rows to web form
2026-06-22 15:29:20 +05:30
Mihir Kandoi
5008b82f90 fix: link portal address rows to web form 2026-06-22 15:19:40 +05:30
Nabin Hait
9436ab7f19 Merge pull request #56294 from frappe/chore/subcontracting-test-coverage
test: Subcontracting coverage; fix service-cost mismatch by PO item
2026-06-22 15:08:34 +05:30
Nabin Hait
c38bab7e5e Merge pull request #56302 from nabinhait/test-coupon-code-validation
test(coupon_code): cover coupon validation and usage-count edges
2026-06-22 15:07:10 +05:30
Mihir Kandoi
eafb0019bf Merge pull request #56300 from mihir-kandoi/fix-party-specific-item
fix: party specific item doesnt work if there are 2 suppliers with sa…
2026-06-22 14:57:09 +05:30
Nabin Hait
943c6d210a fix: only rewrite commission_rate rows the column change can't cast
The previous string comparison (str(raw) != str(cleaned)) rewrote every
whole-number row ('20' vs '20.0'), turning a targeted cleanup into a
full-table rewrite on Sales Team. Skip rows already holding a plain numeric
string and only fix NULL / empty / non-numeric / percent-sign values.
2026-06-22 14:28:29 +05:30
Nabin Hait
0b1d06d46d fix: handle percent-sign commission rates in migration patch
Values like "20%" or "20 %" parse to 0 via flt, which would wipe a real
rate. Strip a trailing percent sign before parsing so they migrate as 20.
2026-06-22 14:28:29 +05:30
Nabin Hait
2fe0601a2e fix(selling): make commission_rate a Percent field on Sales Person and Sales Team
commission_rate was a free-text Data field on the Sales Person master and the
Sales Team child, storing percentages as strings. Convert both to Percent.

A pre_model_sync patch sanitizes the existing values first (empty / NULL /
non-numeric -> 0, others normalised via flt) so the Data -> Percent column
change casts cleanly under strict SQL mode, where Percent is a NOT NULL
decimal column. The patch is idempotent and avoids db-specific SQL so it works
on both MariaDB and Postgres.
2026-06-22 14:28:28 +05:30
Nabin Hait
c5ff32aa2f refactor: tidy update_coupon_code_count
Drop the dead 'if coupon:' guard (get_doc would have thrown) and collapse the
duplicate increment branches into a single exhausted-check plus increment.
No behaviour change.
2026-06-22 14:27:16 +05:30
Mihir Kandoi
7d205c89ea test: add test case 2026-06-22 14:26:28 +05:30
Nabin Hait
8cb94ebedb test: avoid needless submit in SCO validation tests
Use do_not_submit=1 for the service-item and reserve-warehouse validation
tests; they only exercise in-memory validation methods, so submitting the
Subcontracting Order is unnecessary.
2026-06-22 14:25:34 +05:30
Nabin Hait
afed7884d4 test(blanket_order): cover over-ordering aggregated across rows
The over-order check sums the same item across multiple order rows. Add a
test where one item is split into two Sales Order rows against the same
blanket order and together exceed its quantity.
2026-06-22 14:23:41 +05:30
Nabin Hait
bcd850c808 Merge pull request #56240 from nabinhait/test-sales-commission-contribution
test(sales_order): cover sales partner commission and sales-team contribution
2026-06-22 14:20:47 +05:30
Nabin Hait
eaab71a99e test(coupon_code): cover coupon validation and usage-count edges
Add tests for the previously-untested branches of validate_coupon_code
(not-yet-valid, expired, maximum-use exhausted) and update_coupon_code_count
(releasing a use on cancel, and rejecting use beyond the maximum). Both
functions are now fully covered.
2026-06-22 14:20:41 +05:30
Nabin Hait
324f72ce4d Merge pull request #56156 from nabinhait/refactor-so-reservation
refactor(sales_order): simplify create_stock_reservation_entries
2026-06-22 14:18:08 +05:30
Mihir Kandoi
98f5116a09 fix: party specific item doesnt work if there are 2 suppliers with same item 2026-06-22 14:10:45 +05:30
Nabin Hait
b4c9827318 Merge pull request #56295 from nabinhait/test-lead-coverage
test(lead): cover lead details and prospect sync/unlink
2026-06-22 14:05:35 +05:30
Nabin Hait
95b82eeba8 Merge pull request #56290 from nabinhait/test-opportunity-lost-flow
test(opportunity): improve coverage (lost flow, auto-close, item details, prospect sync)
2026-06-22 14:05:06 +05:30
Nabin Hait
b26c09ce8a Merge pull request #56238 from frappe/chore/supplier-scorecard-test-coverage
test: Supplier Scorecard coverage + fix standing/on-time shipment bugs
2026-06-22 14:04:18 +05:30
Nabin Hait
19ba681e16 Merge pull request #56296 from nabinhait/opportunity-auto-close-default-days
fix(crm): drive opportunity auto-close days from CRM Settings, not a hardcoded fallback
2026-06-22 14:04:00 +05:30
Nabin Hait
1b3cde9d44 fix: minor fix in test
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-06-22 13:23:02 +05:30
Nabin Hait
daee9cc89c test(sales_order): cover sales partner commission and sales-team contribution
The parent Commission section (Sales Partner commission) and the Sales Team
table (Sales Person contribution) drive separate logic in
SellingController.calculate_commission / calculate_contribution. Add
integration tests on Sales Order:
- sales partner commission: total_commission = eligible amount * rate / 100,
  and the commission-rate 0..100 bound;
- sales-person allocated_amount tracks amount_eligible_for_commission
  (grant_commission gated), not gross net_total, plus the incentive math;
- the allocated-percentage must-total-100 throw;
- rejection of a disabled sales person.
2026-06-22 13:23:02 +05:30
Nabin Hait
ee0635246f refactor(sales_order): simplify create_stock_reservation_entries
The method (cyclomatic complexity C/14) mixed packed-item separation, SRE
creation and packed-item reservation. Extract _extract_packed_item_details,
_packed_items_to_reserve and _reserve_packed_items (verbatim moves). Drops
C/14 -> A/3; no C-rank function remains in the module. No behaviour change
(stock-reservation, product-bundle and pick-list reservation suites green).
2026-06-22 13:21:31 +05:30
ruthra kumar
4ba1f5214e Merge pull request #55488 from Shllokkk/authorise-set-status
fix: add validation and tests for set_status
2026-06-22 13:19:52 +05:30
Nabin Hait
fc0dee5730 Merge pull request #56291 from frappe/chore/rfq-sq-test-coverage
test: RFQ + Supplier Quotation coverage; fix broken SQ expiry task
2026-06-22 13:10:19 +05:30
Nabin Hait
f1b6a7d690 fix(crm): drive opportunity auto-close days from CRM Settings, not a hardcoded fallback
auto_close_opportunity fell back to 15 days in code when the CRM Setting was
blank (and its docstring still said 7). The field already defaults to 15, so
read the value straight from CRM Settings and add a patch to backfill 15 for
existing sites that left it blank, keeping the same auto-close schedule.
2026-06-22 13:05:50 +05:30
Nabin Hait
ef81caeb3d test: address review feedback on Supplier Scorecard tests
- assert cost-of-shipments against the PO base_amount instead of a
  hardcoded total, so it holds when conversion_rate != 1
- guard the idempotency test's fixed scorecard name against leftovers
- clarify that the eval-statement zero/None substitution is a truthiness check
2026-06-22 13:00:59 +05:30
Nabin Hait
d68f7ea9d1 fix: match Subcontracting Order service cost by purchase order item
calculate_service_costs paired the service_items and items child tables
by list index, which breaks if the tables are not index-aligned (e.g.
populate_items_table skips a service item with zero available qty),
assigning the wrong service cost or raising IndexError. Match by
purchase_order_item instead, and guard against division by zero qty.

Adds a regression test asserting service costs follow purchase_order_item
regardless of table ordering.
2026-06-22 12:56:26 +05:30
Nabin Hait
4c6b030a4b test(lead): cover lead details fetch and prospect sync/unlink
Add tests for get_lead_details and the Lead <-> Prospect lifecycle: editing a
lead syncs into its Prospect Lead row, and deleting the only lead of a
prospect removes the prospect. Lead controller coverage 65% -> 74%.
2026-06-22 12:50:25 +05:30
Nabin Hait
bbb7384ea5 test: add Subcontracting Order validation and process-loss coverage
Covers previously untested Subcontracting Order paths:
- a Subcontracting Order requires a subcontracting Purchase Order
- service items must be non-stock items
- a supplied item's reserve warehouse must differ from the supplier warehouse
- the Subcontracting Receipt mapper applies BOM process-loss to the received qty
2026-06-22 12:48:14 +05:30
Nabin Hait
017e09eaac test(opportunity): cover item details, auto-close and prospect sync
Add tests for get_item_details, auto_close_opportunity (a stale Replied
opportunity is closed, a recent one is not) and the Opportunity -> Prospect
opportunity sync. Opportunity controller coverage 62% -> 80%.
2026-06-22 12:45:12 +05:30
Mihir Kandoi
14b1250ea7 Merge pull request #56284 from mihir-kandoi/party-alias
feat: party aliases
2026-06-22 12:43:48 +05:30
Nabin Hait
dd4371e35b fix: repair broken Supplier Quotation expiry scheduled task
set_expired_status passed filters= and fieldname= kwargs that
frappe.db.set_value does not accept, so the daily scheduled task threw
TypeError on every run and quotations were never marked Expired. Pass
the filter dict as the positional docname argument, and scope it to
submitted documents so draft quotations aren't wrongly expired (matching
the selling Quotation behaviour).

Adds coverage for valid-till validation, the expiry task, and the
RFQ quote-status round-trip on submit/cancel.
2026-06-22 12:38:32 +05:30
Nabin Hait
618ee6ddeb test: add RFQ duplicate-supplier, scorecard-block and status coverage 2026-06-22 12:38:31 +05:30
Nabin Hait
61c2e7ad6e test(opportunity): cover the mark-as-lost flow
declare_enquiry_lost had almost no coverage. Add tests that marking an
Opportunity as lost records the lost reasons, competitors and detailed
reason and sets status to Lost, and that it is blocked when an active
(submitted) Quotation exists.
2026-06-22 12:33:19 +05:30
Ankush Menat
7256fc98e9 ci: Wait for processes to die (#56288) 2026-06-22 12:25:16 +05:30
Mihir Kandoi
5e16d41387 feat: party aliases 2026-06-22 12:23:44 +05:30
Nabin Hait
599b1bab60 ci: don't run background workers during patch-test migrate
The Patch Test starts the full bench (incl. workers) and then runs migrate.
Migrate enqueues orphan-link cleanup jobs (delete_dynamic_links) that the
workers pick up and process while migrate is altering tables, which
intermittently fails with MySQL 1412 'Table definition has changed, please
retry transaction'.

Start every bench process except the workers during migrate, so nothing
consumes the queue mid-migrate. Redis and the other services stay up; the
queued jobs just wait.
2026-06-22 11:30:46 +05:30
Mihir Kandoi
73459af908 Merge pull request #56283 from frappe/revert-56261-qcs-uae-regional
revert: "feat: Enhance UAE VAT Reports, UAE FTA Audit File and Add VAT Register"
2026-06-22 11:03:17 +05:30
Mihir Kandoi
cfaaf43381 Revert "feat: Enhance UAE VAT Reports, UAE FTA Audit File and Add VAT Register" 2026-06-22 10:42:57 +05:30