Compare commits

..

242 Commits

Author SHA1 Message Date
Frappe PR Bot
a66ce02520 chore(release): Bumped to Version 15.90.0
# [15.90.0](https://github.com/frappe/erpnext/compare/v15.89.2...v15.90.0) (2025-11-25)

### Bug Fixes

* add filter company and status to job card employee ([015f946](015f946a14))
* add missing translate function ([475eada](475eada727))
* add return status for purchase receipt ([8ccb9a5](8ccb9a5ad2))
* add validation for FG Items as per BOM qty (backport [#50579](https://github.com/frappe/erpnext/issues/50579)) ([#50715](https://github.com/frappe/erpnext/issues/50715)) ([1995291](1995291194))
* apply precision for scrap items amount ([5b60fbb](5b60fbbd30))
* **customer:** link contact and addresses if created from lead/opportunity/prospect ([b1d40de](b1d40de87e))
* ignore reserved batches from total available batches ([673b893](673b893942))
* incorrect query filter when selecting primary customer adr ([#50727](https://github.com/frappe/erpnext/issues/50727)) ([e8e09cf](e8e09cf8ea))
* **ledger-summary-report:** show party group and territory ([56f03ae](56f03aee02))
* **manufacturing:** apply precision for bom amount and rm_cost_per_qty ([2678694](2678694c5f))
* pick list status doesn't update when DN created from it and PL was created from SO ([2809c46](2809c46a6e))
* prevent pi status from changing on asset repair ([3f2081b](3f2081b440))
* pricing rule was ignoring time validity ([f62e5e6](f62e5e69b8))
* **product bundle:** fields reset if doc is new ([4ba4da0](4ba4da090d))
* **purchase_receipt:** add internal_and_external_links field to show purchase invoice connection count ([89fcdbf](89fcdbf56b))
* redundant message on bom save ([5b16740](5b1674018b))
* remove disabled warehouse in get_warehouses_based_on_account ([aa94c91](aa94c91c12))
* serial batch selector shown only once ([25cd230](25cd230471))
* show current company warehouse only in get material from bom MR ([1d6e3e4](1d6e3e4e7d))
* tests ([45bc218](45bc218acb))
* unhide zero val checkbox ([a247337](a24733791d))
* unknown column error ([2e9a0cb](2e9a0cb01c))
* use current_tax_amount value for base_total_taxes_and_charges ([7ed3c6d](7ed3c6d18a))
* validate sabb autocreation when disabled ([85c0c16](85c0c16964))
* validation for SABB deletion ([0bc98b6](0bc98b609f))

### Features

* **accounting-dimension:** add dynamic triggers for custom accounting dimensions ([#50621](https://github.com/frappe/erpnext/issues/50621)) ([2b7d586](2b7d58602d))
* modify accounting dimension as multiselect field ([6b6e017](6b6e017e36))
* **reports:** preserve accounting dimension filters while navigating between reports ([02a1f81](02a1f815da))
2025-11-25 15:02:30 +00:00
ruthra kumar
3c43b42a01 Merge pull request #50741 from frappe/version-15-hotfix
chore: release v15
2025-11-25 20:31:01 +05:30
ruthra kumar
8ed3a0ec65 Merge branch 'version-15' into version-15-hotfix 2025-11-25 20:14:37 +05:30
mergify[bot]
488d635dc9 chore: switched frankfurter domain from frankfurter.app to frankfurter.dev (backport #50734) (#50740)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2025-11-25 15:49:53 +05:30
ruthra kumar
08d230b3e3 Merge pull request #50731 from frappe/mergify/bp/version-15-hotfix/pr-50561
fix(ledger-summary-report): show party group and territory (backport #50561)
2025-11-25 12:33:49 +05:30
Mihir Kandoi
f383fafb15 Merge pull request #50728 from frappe/mergify/bp/version-15-hotfix/pr-50727
fix: incorrect query filter when selecting primary customer adr (backport #50727)
2025-11-25 12:14:17 +05:30
ruthra kumar
38124a7616 chore: resolve conflicts 2025-11-25 12:01:37 +05:30
l0gesh29
56cf5382f0 test: add party_group, territory in json
(cherry picked from commit 8f91919933)

# Conflicts:
#	erpnext/accounts/report/customer_ledger_summary/test_customer_ledger_summary.py
2025-11-25 05:38:57 +00:00
l0gesh29
56f03aee02 fix(ledger-summary-report): show party group and territory
(cherry picked from commit 231479a6e2)

# Conflicts:
#	erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
2025-11-25 05:38:57 +00:00
Mihir Kandoi
841f5c24ad chore: resolve conflicts 2025-11-25 10:51:39 +05:30
ruthra kumar
e8051ba180 Merge pull request #50729 from frappe/mergify/bp/version-15-hotfix/pr-50621
feat(accounting-dimension): add dynamic triggers for custom accounting dimensions (backport #50621)
2025-11-25 10:26:47 +05:30
Logesh Periyasamy
2b7d58602d feat(accounting-dimension): add dynamic triggers for custom accounting dimensions (#50621)
* feat: add dynamic triggers for custom accounting dimensions

* feat: add accounting dimension trigger call in setup event

* chore: ignore cur_frm semgrep rules

* chore: move function to transaction.js

(cherry picked from commit 5e58e344b2)
2025-11-25 04:51:32 +00:00
Mihir Kandoi
e8e09cf8ea fix: incorrect query filter when selecting primary customer adr (#50727)
(cherry picked from commit c2b8b97d7d)

# Conflicts:
#	erpnext/selling/doctype/customer/customer.json
2025-11-25 04:49:20 +00:00
Khushi Rawat
188c633d6e Merge pull request #50544 from aerele/asset-repair-pi-status
fix: prevent pi status from changing on asset repair
2025-11-24 23:28:33 +05:30
mergify[bot]
1995291194 fix: add validation for FG Items as per BOM qty (backport #50579) (#50715)
Co-authored-by: Kavin <78342682+kavin0411@users.noreply.github.com>
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
Co-authored-by: Kavin <78342682+kavin-114@users.noreply.github.com>
fix: add validation for FG Items as per BOM qty (#50579)
2025-11-24 11:18:18 +00:00
Mihir Kandoi
bb0d75eb78 Merge pull request #50717 from frappe/mergify/bp/version-15-hotfix/pr-50716
fix: add missing translate function (backport #50716)
2025-11-24 13:53:48 +05:30
El-Shafei H.
475eada727 fix: add missing translate function
(cherry picked from commit 56def01240)
2025-11-24 07:39:09 +00:00
mergify[bot]
6cffba9a71 Merge pull request #50713 from frappe/mergify/bp/version-15-hotfix/pr-50712 2025-11-24 07:17:43 +00:00
Mihir Kandoi
35f9f9f330 Merge pull request #50711 from frappe/mergify/bp/version-15-hotfix/pr-50661
fix(manufacturing): apply precision for bom amount and rm_cost_per_qty (backport #50661)
2025-11-24 11:02:50 +05:30
Pugazhendhi Velu
5b60fbbd30 fix: apply precision for scrap items amount
(cherry picked from commit 9194e6350a)
2025-11-24 05:08:42 +00:00
Pugazhendhi Velu
2678694c5f fix(manufacturing): apply precision for bom amount and rm_cost_per_qty
(cherry picked from commit 57f9353d90)
2025-11-24 05:08:42 +00:00
Mihir Kandoi
b6a80da457 Merge pull request #50709 from frappe/mergify/bp/version-15-hotfix/pr-50707
fix: unknown column error (backport #50707)
2025-11-23 19:54:21 +05:30
Mihir Kandoi
2e9a0cb01c fix: unknown column error
(cherry picked from commit 3b7d7aed4c)
2025-11-23 14:08:48 +00:00
Frappe PR Bot
38c1867ade chore(release): Bumped to Version 15.89.2
## [15.89.2](https://github.com/frappe/erpnext/compare/v15.89.1...v15.89.2) (2025-11-21)

### Bug Fixes

* use current_tax_amount value for base_total_taxes_and_charges ([c082eda](c082edabf4))
2025-11-21 17:34:52 +00:00
Diptanil Saha
a48b999af9 Merge pull request #50691 from frappe/mergify/bp/version-15/pr-50690
fix: use current_tax_amount value for base_total_taxes_and_charges (backport #50476) (backport #50690)
2025-11-21 23:03:28 +05:30
Pugazhendhi Velu
c082edabf4 fix: use current_tax_amount value for base_total_taxes_and_charges
(cherry picked from commit 5a3fcbedb5)
(cherry picked from commit 7ed3c6d18a)
2025-11-21 17:16:54 +00:00
Diptanil Saha
60ec7d0fb8 Merge pull request #50690 from frappe/mergify/bp/version-15-hotfix/pr-50476
fix: use current_tax_amount value for base_total_taxes_and_charges (backport #50476)
2025-11-21 22:31:13 +05:30
Pugazhendhi Velu
7ed3c6d18a fix: use current_tax_amount value for base_total_taxes_and_charges
(cherry picked from commit 5a3fcbedb5)
2025-11-21 16:41:52 +00:00
Frappe PR Bot
b7e4fb9d83 chore(release): Bumped to Version 15.89.1
## [15.89.1](https://github.com/frappe/erpnext/compare/v15.89.0...v15.89.1) (2025-11-21)

### Bug Fixes

* ignore reserved batches from total available batches ([64950d3](64950d39b5))
2025-11-21 10:36:37 +00:00
rohitwaghchaure
e49e7b621d Merge pull request #50668 from frappe/mergify/bp/version-15/pr-50612
fix: ignore reserved batches from total available batches (backport #50612)
2025-11-21 16:05:05 +05:30
Mihir Kandoi
0a67d20ff8 Merge pull request #50671 from frappe/mergify/bp/version-15-hotfix/pr-50667
fix: pricing rule was ignoring time validity (backport #50667)
2025-11-21 13:08:25 +05:30
Mihir Kandoi
83c6d861eb Merge pull request #50670 from frappe/mergify/bp/version-15-hotfix/pr-50655
fix: pick list status doesn't update when DN created from it and PL w... (backport #50655)
2025-11-21 13:00:31 +05:30
Mihir Kandoi
f62e5e69b8 fix: pricing rule was ignoring time validity
(cherry picked from commit ffae7c4175)
2025-11-21 07:22:07 +00:00
Mihir Kandoi
45bc218acb fix: tests
(cherry picked from commit d26f8aa629)
2025-11-21 07:14:00 +00:00
Mihir Kandoi
2809c46a6e fix: pick list status doesn't update when DN created from it and PL was created from SO
(cherry picked from commit f7b3253683)
2025-11-21 07:14:00 +00:00
Kavin
15c41178d0 test: add unit test for reserved stock validation
(cherry picked from commit 55f2f1c515)
2025-11-21 06:46:17 +00:00
Kavin
64950d39b5 fix: ignore reserved batches from total available batches
(cherry picked from commit 673b893942)
2025-11-21 06:46:17 +00:00
Diptanil Saha
ff1b83025a Merge pull request #50666 from frappe/mergify/bp/version-15-hotfix/pr-50665
fix(customer): link contact and addresses if created from lead/opportunity/prospect (backport #50665)
2025-11-21 07:03:57 +05:30
diptanilsaha
b1d40de87e fix(customer): link contact and addresses if created from lead/opportunity/prospect
(cherry picked from commit 310099f4cd)
2025-11-21 01:18:18 +00:00
Mihir Kandoi
532031c21d Merge pull request #50650 from frappe/mergify/bp/version-15-hotfix/pr-50385
fix: remove disabled warehouse in get_warehouses_based_on_account (backport #50385)
2025-11-20 17:44:02 +05:30
Mihir Kandoi
cb70efb8ed Merge pull request #50653 from frappe/mergify/bp/version-15-hotfix/pr-50639
fix(product bundle): fields reset if doc is new (backport #50639)
2025-11-20 17:43:43 +05:30
Mihir Kandoi
ca0b4696ba Merge pull request #50652 from frappe/mergify/bp/version-15-hotfix/pr-50649
fix: unhide zero val checkbox in stock reco (backport #50649)
2025-11-20 17:43:26 +05:30
Mihir Kandoi
4ba4da090d fix(product bundle): fields reset if doc is new
(cherry picked from commit 7faee7edc2)
2025-11-20 10:42:53 +00:00
rohitwaghchaure
e3b2cc24b2 chore: fix conflicts 2025-11-20 16:12:41 +05:30
Mihir Kandoi
a24733791d fix: unhide zero val checkbox
(cherry picked from commit 20e0313a8c)

# Conflicts:
#	erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
2025-11-20 10:41:55 +00:00
Mihir Kandoi
aa94c91c12 fix: remove disabled warehouse in get_warehouses_based_on_account
(cherry picked from commit ff2d9bf4cb)
2025-11-20 10:33:54 +00:00
Mihir Kandoi
87ffbdf129 Merge pull request #50641 from frappe/mergify/bp/version-15-hotfix/pr-50502
fix(purchase_receipt): add internal_and_external_links field to show … (backport #50502)
2025-11-20 15:45:43 +05:30
rohitwaghchaure
5ef7b8c526 Merge pull request #50648 from frappe/mergify/bp/version-15-hotfix/pr-50646
fix: serial batch selector shown only once (backport #50646)
2025-11-20 15:12:51 +05:30
Mihir Kandoi
25cd230471 fix: serial batch selector shown only once
(cherry picked from commit aa6f09e9a9)
2025-11-20 09:38:37 +00:00
rohitwaghchaure
f05933e814 Merge pull request #50645 from frappe/mergify/bp/version-15-hotfix/pr-50644
fix: validation for SABB deletion (backport #50644)
2025-11-20 14:33:05 +05:30
Diptanil Saha
8df2612694 Merge pull request #50643 from frappe/mergify/bp/version-15-hotfix/pr-50289 2025-11-20 13:58:58 +05:30
Rohit Waghchaure
0bc98b609f fix: validation for SABB deletion
(cherry picked from commit dd4bef0706)
2025-11-20 08:19:48 +00:00
l0gesh29
02a1f815da feat(reports): preserve accounting dimension filters while navigating between reports
(cherry picked from commit fcfcaa76c6)
2025-11-20 07:46:55 +00:00
l0gesh29
6b6e017e36 feat: modify accounting dimension as multiselect field
(cherry picked from commit 3fcd8d84ac)
2025-11-20 07:46:55 +00:00
Karuppasamy B
89fcdbf56b fix(purchase_receipt): add internal_and_external_links field to show purchase invoice connection count
(cherry picked from commit 6c1620ab8c)
2025-11-20 07:03:55 +00:00
rohitwaghchaure
eb2571492f Merge pull request #50612 from aerele/fix/validate-reserved-stock
fix: ignore reserved batches from total available batches
2025-11-19 22:16:00 +05:30
Kavin
55f2f1c515 test: add unit test for reserved stock validation 2025-11-19 17:51:10 +05:30
Kavin
673b893942 fix: ignore reserved batches from total available batches 2025-11-19 17:51:10 +05:30
mergify[bot]
c85ce55f27 Merge pull request #50631 from frappe/mergify/bp/version-15-hotfix/pr-50629
fix: process loss % can be negative (backport #50629)
2025-11-19 11:30:39 +00:00
Mihir Kandoi
a19252e3b3 Merge pull request #50628 from frappe/mergify/bp/version-15-hotfix/pr-50627
fix: show current company warehouse only in get material from bom MR (backport #50627)
2025-11-19 16:29:17 +05:30
Mihir Kandoi
7ece6fd558 Merge pull request #50626 from frappe/mergify/bp/version-15-hotfix/pr-50625
fix: add filter company and status to job card employee (backport #50625)
2025-11-19 16:24:08 +05:30
Mihir Kandoi
1d6e3e4e7d fix: show current company warehouse only in get material from bom MR
(cherry picked from commit 3271eaaf0e)
2025-11-19 10:46:47 +00:00
Mihir Kandoi
015f946a14 fix: add filter company and status to job card employee
(cherry picked from commit 3ca3a6d9bb)
2025-11-19 10:42:32 +00:00
rohitwaghchaure
533a2dbc32 Merge pull request #50607 from frappe/mergify/bp/version-15-hotfix/pr-50512
fix: add return status for purchase receipt (backport #50512)
2025-11-19 14:18:12 +05:30
rohitwaghchaure
99aeb8ecd1 Merge pull request #50606 from frappe/mergify/bp/version-15-hotfix/pr-50486
fix: validate sabb autocreation when disabled (backport #50486)
2025-11-19 14:18:00 +05:30
Mihir Kandoi
371030f8d4 Merge pull request #50615 from frappe/mergify/bp/version-15-hotfix/pr-50614
fix: redundant message on bom save (backport #50614)
2025-11-19 12:53:50 +05:30
Mihir Kandoi
2550b44db8 chore: resolve conflicts 2025-11-19 12:38:47 +05:30
Mihir Kandoi
5b1674018b fix: redundant message on bom save
(cherry picked from commit 074f07694f)

# Conflicts:
#	erpnext/manufacturing/doctype/bom/bom.py
2025-11-19 07:06:11 +00:00
Frappe PR Bot
d8dab986fa chore(release): Bumped to Version 15.89.0
# [15.89.0](https://github.com/frappe/erpnext/compare/v15.88.1...v15.89.0) (2025-11-19)

### Bug Fixes

* add cancelled option in status field ([623a0a9](623a0a932e))
* add condition for allow negative stock in pos (backport [#50369](https://github.com/frappe/erpnext/issues/50369)) ([#50600](https://github.com/frappe/erpnext/issues/50600)) ([2d6640a](2d6640ac61))
* add doctype parameter to lead details for correct company details ([f0eac47](f0eac47037))
* **asset repair:** validate pi status ([2db91ee](2db91ee67e))
* back calcalute total amount from rate and tax_amount in tax withholding details report ([5728299](57282999ad))
* construct batch_nos and serial_nos to avoid NoneType error ([0a0177c](0a0177cb9e))
* correct profit after tax calculation by reducing expenses from income ([627b34a](627b34a120))
* current qty in stock reco ([b4b8459](b4b8459f2c))
* enable allow_negative_stock settings ([2a5c9b4](2a5c9b469c))
* **financial reports:** set fiscal year associated with the default company ([ac40b59](ac40b59665))
* first and last name in supplier quick entry (backport [#50510](https://github.com/frappe/erpnext/issues/50510)) ([#50514](https://github.com/frappe/erpnext/issues/50514)) ([3b636d5](3b636d5db7))
* **general_ledger:** add translation for accounting dimension ([799119a](799119ad3e))
* handle NoneType object error for product bundle ([2b7abfb](2b7abfb34b))
* improve precision in tax amount calculations in tax withholding details report ([c150e57](c150e5795e))
* on changes of paid from/to account fetch company bank account ([3d8a344](3d8a344173))
* **period closing voucher:** add title to error log ([#50498](https://github.com/frappe/erpnext/issues/50498)) ([33962ac](33962ac995))
* prevent pos opening entry creation for disabled pos profile ([68747b5](68747b5818))
* **stock-entry:** prevent default warehouse from overriding parent warehouse ([a5ec0e4](a5ec0e4f50))
* unintended backported depends_on expression ([#50529](https://github.com/frappe/erpnext/issues/50529)) ([81a1628](81a16286a1))
* use dynamic account type to get average ratio balance ([a2c82b4](a2c82b4dc3))

### Features

* Add first and last name fields to quick entry customer creation (backport [#46281](https://github.com/frappe/erpnext/issues/46281)) ([#50522](https://github.com/frappe/erpnext/issues/50522)) ([8c98f16](8c98f1692a))
* **Company:** allow setting default sales contact, fetch into sales transaction (backport [#50159](https://github.com/frappe/erpnext/issues/50159)) ([#50599](https://github.com/frappe/erpnext/issues/50599)) ([f8294f1](f8294f1754))
* **Item Price:** validate UOM ([376da8d](376da8df0a))
* **pos:** prevent disabling POS Profile when open POS sessions exist ([87e8305](87e8305753))
2025-11-19 02:58:17 +00:00
Diptanil Saha
f25e2295d0 Merge pull request #50595 from frappe/version-15-hotfix 2025-11-19 08:26:48 +05:30
ruthra kumar
b4fd4812cd Merge pull request #50527 from aerele/default-report-fiscal-year-v15
fix(financial reports): set fiscal year associated with the default company
2025-11-18 18:12:21 +05:30
rohitwaghchaure
876dec5077 chore: fix conflicts 2025-11-18 18:05:08 +05:30
rohitwaghchaure
36e9aae9d0 chore: fix conflicts 2025-11-18 18:04:29 +05:30
Pugazhendhi Velu
8ccb9a5ad2 fix: add return status for purchase receipt
(cherry picked from commit 3a0e1e8ef9)
2025-11-18 12:33:18 +00:00
Kavin
85c0c16964 fix: validate sabb autocreation when disabled
(cherry picked from commit 3ca1940881)

# Conflicts:
#	erpnext/stock/doctype/stock_entry/stock_entry.py
2025-11-18 12:29:01 +00:00
ruthra kumar
6a46045804 Merge pull request #50603 from frappe/mergify/bp/version-15-hotfix/pr-50524
fix: use dynamic account type to get average ratio balance (backport #50524)
2025-11-18 17:44:31 +05:30
ruthra kumar
befa4bef0d Merge pull request #50601 from frappe/mergify/bp/version-15-hotfix/pr-50516
fix(general_ledger): add translation for accounting dimension (backport #50516)
2025-11-18 17:13:34 +05:30
mergify[bot]
f8294f1754 feat(Company): allow setting default sales contact, fetch into sales transaction (backport #50159) (#50599)
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2025-11-18 17:05:58 +05:30
mergify[bot]
2d6640ac61 fix: add condition for allow negative stock in pos (backport #50369) (#50600)
Co-authored-by: Logesh Periyasamy <logeshperiyasamy24@gmail.com>
fix: add condition for allow negative stock in pos (#50369)
2025-11-18 17:05:47 +05:30
Navin-S-R
627b34a120 fix: correct profit after tax calculation by reducing expenses from income
(cherry picked from commit f420371a7e)
2025-11-18 11:22:38 +00:00
Navin-S-R
a2c82b4dc3 fix: use dynamic account type to get average ratio balance
(cherry picked from commit 9118f08e7b)
2025-11-18 11:22:38 +00:00
Logesh Periyasamy
799119ad3e fix(general_ledger): add translation for accounting dimension
(cherry picked from commit 113ff17c71)
2025-11-18 11:15:37 +00:00
ruthra kumar
a4a0a2a0fb Merge pull request #50554 from frappe/mergify/bp/version-15-hotfix/pr-50540
fix(stock-entry): prevent default warehouse from overriding parent warehouse (backport #50540)
2025-11-18 15:09:08 +05:30
ruthra kumar
35fb2b8ede Merge pull request #50573 from frappe/mergify/bp/version-15-hotfix/pr-50496
fix: back calcalute total amount from rate and tax_amount in tax withholding details report (backport #50496)
2025-11-18 15:08:26 +05:30
ruthra kumar
c844bf5547 Merge pull request #50574 from frappe/mergify/bp/version-15-hotfix/pr-50439
fix: add doctype parameter to lead details for correct company details (backport #50439)
2025-11-18 15:07:15 +05:30
Kavin
81a16286a1 fix: unintended backported depends_on expression (#50529)
Co-authored-by: Kavin <78342682+kavin0411@users.noreply.github.com>
2025-11-18 10:07:26 +02:00
Khushi Rawat
3c8534c4cc Merge pull request #50571 from aerele/fix/support-52685
fix: add cancelled option in status field
2025-11-18 11:15:53 +05:30
ravibharathi656
ac40b59665 fix(financial reports): set fiscal year associated with the default company 2025-11-18 11:14:40 +05:30
ravibharathi656
3f2081b440 fix: prevent pi status from changing on asset repair 2025-11-18 11:09:25 +05:30
Pugazhendhi Velu
2db91ee67e fix(asset repair): validate pi status 2025-11-17 14:06:26 +00:00
ljain112
f0eac47037 fix: add doctype parameter to lead details for correct company details
(cherry picked from commit 0b91338771)
2025-11-17 13:39:09 +00:00
ljain112
4df80c5b53 chore: typo in comment
(cherry picked from commit e056c0327d)
2025-11-17 13:36:08 +00:00
ljain112
c150e5795e fix: improve precision in tax amount calculations in tax withholding details report
(cherry picked from commit 7c5f5405cc)
2025-11-17 13:36:08 +00:00
ljain112
57282999ad fix: back calcalute total amount from rate and tax_amount in tax withholding details report
(cherry picked from commit d3751d9bb4)
2025-11-17 13:36:08 +00:00
Pugazhendhi Velu
623a0a932e fix: add cancelled option in status field 2025-11-17 13:09:38 +00:00
rohitwaghchaure
9b06eaab78 Merge pull request #50535 from aerele/support-53360
fix: construct batch_nos and serial_nos to avoid NoneType error
2025-11-17 16:24:20 +05:30
Kavin
2a5c9b469c fix: enable allow_negative_stock settings 2025-11-17 13:53:55 +05:30
Kavin
0a0177cb9e fix: construct batch_nos and serial_nos to avoid NoneType error 2025-11-17 12:35:16 +05:30
Mihir Kandoi
eed144d7c9 Merge pull request #50231 from frappe/mergify/bp/version-15-hotfix/pr-40586 2025-11-17 10:26:43 +05:30
Pugazhendhi Velu
a5ec0e4f50 fix(stock-entry): prevent default warehouse from overriding parent warehouse
(cherry picked from commit 8b38578914)
2025-11-17 04:41:27 +00:00
mergify[bot]
8c98f1692a feat: Add first and last name fields to quick entry customer creation (backport #46281) (#50522)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
Co-authored-by: maasanto <73234812+maasanto@users.noreply.github.com>
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2025-11-13 21:58:34 +05:30
Diptanil Saha
182e84e94c Merge pull request #50521 from frappe/mergify/bp/version-15-hotfix/pr-50498
fix(period closing voucher): add title to error log (backport #50498)
2025-11-13 21:50:21 +05:30
PUGAZHENDHI V
33962ac995 fix(period closing voucher): add title to error log (#50498)
(cherry picked from commit 4f720b3969)
2025-11-13 15:56:37 +00:00
mergify[bot]
3b636d5db7 fix: first and last name in supplier quick entry (backport #50510) (#50514)
Co-authored-by: ljain112 <ljain112@gmail.com>
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2025-11-13 15:37:50 +05:30
Frappe PR Bot
70b8b3bb9e chore(release): Bumped to Version 15.88.1
## [15.88.1](https://github.com/frappe/erpnext/compare/v15.88.0...v15.88.1) (2025-11-12)

### Bug Fixes

* handle NoneType object error for product bundle ([eab6d69](eab6d69ec9))
2025-11-12 18:26:04 +00:00
rohitwaghchaure
c42954bec7 Merge pull request #50500 from frappe/mergify/bp/version-15/pr-50488
fix: handle NoneType object error for packed_items (backport #50488)
2025-11-12 23:54:34 +05:30
Kavin
eab6d69ec9 fix: handle NoneType object error for product bundle
(cherry picked from commit 2b7abfb34b)
2025-11-12 17:21:25 +00:00
rohitwaghchaure
3f0bea2d9f Merge pull request #50488 from aerele/support-53076
fix: handle NoneType object error for packed_items
2025-11-12 22:50:37 +05:30
rohitwaghchaure
34ed9b455f Merge pull request #50491 from frappe/mergify/bp/version-15-hotfix/pr-50487
fix: current qty in stock reconciliation  (backport #50487)
2025-11-12 22:49:44 +05:30
Kavin
2b7abfb34b fix: handle NoneType object error for product bundle 2025-11-12 18:26:19 +05:30
Diptanil Saha
2ba1731d3f Merge pull request #50484 from frappe/mergify/bp/version-15-hotfix/pr-50409 2025-11-12 15:14:53 +05:30
Rohit Waghchaure
b4b8459f2c fix: current qty in stock reco
(cherry picked from commit 58315bc963)
2025-11-12 08:26:01 +00:00
Diptanil Saha
d5160c4c86 test: delete outdated pos opening entry 2025-11-12 12:26:26 +05:30
Diptanil Saha
af19b81343 chore: resolve conflict 2025-11-12 11:35:02 +05:30
Diptanil Saha
650d2f74ba chore: resolve conflict 2025-11-12 11:33:56 +05:30
diptanilsaha
68747b5818 fix: prevent pos opening entry creation for disabled pos profile
(cherry picked from commit e35e8968f0)

# Conflicts:
#	erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
2025-11-12 05:44:01 +00:00
diptanilsaha
38848ff43b test: added test to validate disabled pos profile
(cherry picked from commit 69016a284f)

# Conflicts:
#	erpnext/accounts/doctype/pos_profile/test_pos_profile.py
2025-11-12 05:44:00 +00:00
diptanilsaha
87e8305753 feat(pos): prevent disabling POS Profile when open POS sessions exist
(cherry picked from commit c5219278fb)
2025-11-12 05:44:00 +00:00
Diptanil Saha
a2345d467e Merge pull request #50483 from frappe/mergify/bp/version-15-hotfix/pr-50323
fix(payment entry): on changes of paid from/to account fetch company bank account (backport #50323)
2025-11-12 11:11:37 +05:30
Abdeali Chharchhoda
3d8a344173 fix: on changes of paid from/to account fetch company bank account
(cherry picked from commit 4901dc2531)
2025-11-12 05:38:56 +00:00
Frappe PR Bot
e112290728 chore(release): Bumped to Version 15.88.0
# [15.88.0](https://github.com/frappe/erpnext/compare/v15.87.2...v15.88.0) (2025-11-11)

### Bug Fixes

* add company filter for default warehouse for sales return ([32d3fbf](32d3fbf1e8))
* add is_group filter in task for timesheet ([0f00581](0f00581f83))
* add missing stock entry UOM filtering based on item master ([#50135](https://github.com/frappe/erpnext/issues/50135)) ([8f2002d](8f2002d419))
* add validation to reject empty readings ([ac0375f](ac0375fc2e))
* apply company,is_group filter for cost center ([b181686](b1816864de))
* automatically append taxes if taxes_and_charges is set in Buying controller ([25f5fb7](25f5fb7637))
* **buying:** fetch Cost Center from Project ([e8e26a9](e8e26a91bb))
* change fieldtype from link to data for document_type in producti… (backport [#50443](https://github.com/frappe/erpnext/issues/50443)) ([#50455](https://github.com/frappe/erpnext/issues/50455)) ([a3ddc95](a3ddc9533a))
* change fieldtype from link to data for document_type in production plan summary ([9012a72](9012a72185))
* check warehouse account before accessing ([79b3af6](79b3af6d3e))
* ensure that additional discount amount is not mapped repeatedly ([44539f0](44539f0944))
* handle partial dn against reserved stock ([9d979e3](9d979e34ab))
* handle returns as well ([9ed40cc](9ed40cc17d))
* hide total row in general ledger report ([56bb88d](56bb88d281))
* ignore Department doctype ([32182d7](32182d7cc7))
* include cost_center and project upon accounting dimension fetch ([3f490f1](3f490f11d5))
* material request item quantity validation against sales order with over-receipt allowance ([f2fef54](f2fef54b83))
* **material request:** set default buying price list if not exists ([670c6dc](670c6dcdd7))
* Nonetype error if reserved stock is not present ([b8ec3ae](b8ec3ae23a))
* Pass stock_qty and picked_qty in transfer entry ([95ea9ca](95ea9ca66b))
* removed the validation ([080e9a3](080e9a3d73))
* reset billing and shipping address when company changes ([73b8a29](73b8a294cf))
* resolve conflict ([7d593dd](7d593dd3db))
* set company before creating asset movement to avoid permission error ([3fad90e](3fad90ebb9))
* show only stock items in delivered items to be billed and received items to be billed reports ([3dbc90a](3dbc90a0b4))
* state_to_state_province for translation ([#50244](https://github.com/frappe/erpnext/issues/50244)) ([d4f6ca3](d4f6ca3564))
* **stock:** ignore current voucher in reserved stock validation ([0e7f971](0e7f9711e1))
* **Timesheet:** don't use billing_hours for costing amount ([#50394](https://github.com/frappe/erpnext/issues/50394)) ([29c976e](29c976e9ae))
* trends report total mismatch with group filters ([7e3f30b](7e3f30baad))
* Update pick list locations quantity ([ce7ab8d](ce7ab8df9a))
* update uom when item changes ([2a2ae9a](2a2ae9a20c))
* validate is_group for parent task ([3380dea](3380deab02))
* validate that discount amount cannot exceed total before discount ([e559faf](e559fafa83))

### Features

* **account settings:** add checkbox to show balances in payment entry ([90500f0](90500f0ffc))
* add asset name column ([c486471](c48647100f))
* make material transfer warehouse validation optional (backport [#50461](https://github.com/frappe/erpnext/issues/50461)) ([#50462](https://github.com/frappe/erpnext/issues/50462)) ([1747e83](1747e83cb1))
* process period closing voucher ([c8e3da0](c8e3da0a71))

### Performance Improvements

* serial no creation ([6ba2491](6ba24912c3))
2025-11-11 14:49:50 +00:00
Diptanil Saha
3149785960 Merge pull request #50473 from frappe/resolve-payment-entry-settings-conflict 2025-11-11 20:18:23 +05:30
Diptanil Saha
736cff84f2 Merge branch 'version-15' into resolve-payment-entry-settings-conflict 2025-11-11 20:04:20 +05:30
rohitwaghchaure
0023476500 Merge pull request #50470 from frappe/mergify/bp/version-15-hotfix/pr-50187
fix: Update pick list locations quantity (backport #50187)
2025-11-11 16:11:03 +05:30
ruthra kumar
0c4295fb6f Merge pull request #50472 from frappe/mergify/bp/version-15-hotfix/pr-50469
fix: automatically append taxes if taxes_and_charges is set in Buying controller (backport #50469)
2025-11-11 15:57:52 +05:30
Sagar Vora
13371275db Merge pull request #50471 from frappe/mergify/bp/version-15-hotfix/pr-50155
fix: ensure that additional discount amount is not mapped repeatedly (backport #50155)
2025-11-11 15:13:48 +05:30
Sagar Vora
313e6af528 chore: resolve conflicts 2025-11-11 15:11:52 +05:30
ljain112
e2a0d6e5f6 test: add automatic tax addition for buying controller
(cherry picked from commit 3d0a668c50)
2025-11-11 09:34:16 +00:00
ljain112
25f5fb7637 fix: automatically append taxes if taxes_and_charges is set in Buying controller
(cherry picked from commit d171dc7328)
2025-11-11 09:34:16 +00:00
Sagar Vora
22848eb4da chore: remove unused import
(cherry picked from commit 81ab15351e)

# Conflicts:
#	erpnext/controllers/taxes_and_totals.py
2025-11-11 09:32:59 +00:00
Sagar Vora
b4df87e545 refactor: simplify logic
(cherry picked from commit 95f604457d)
2025-11-11 09:32:56 +00:00
Sagar Vora
9ed40cc17d fix: handle returns as well
(cherry picked from commit 0e026b9ccd)
2025-11-11 09:32:56 +00:00
Sagar Vora
22b6760164 test: some tests to ensure correct discount mapping
(cherry picked from commit 0968f435d2)
2025-11-11 09:32:56 +00:00
Sagar Vora
e559fafa83 fix: validate that discount amount cannot exceed total before discount
(cherry picked from commit f4f79d99e4)

# Conflicts:
#	erpnext/controllers/taxes_and_totals.py
2025-11-11 09:32:56 +00:00
Sagar Vora
44539f0944 fix: ensure that additional discount amount is not mapped repeatedly
(cherry picked from commit feb62102d9)
2025-11-11 09:32:55 +00:00
Kavin
a0d94c38c1 test: add test for pending qty calculation in Pick List
(cherry picked from commit 3f7a60d56c)
2025-11-11 09:24:34 +00:00
Kavin
95ea9ca66b fix: Pass stock_qty and picked_qty in transfer entry
(cherry picked from commit 6db605c443)
2025-11-11 09:24:34 +00:00
Kavin
ce7ab8df9a fix: Update pick list locations quantity
(cherry picked from commit bd9e240ca5)
2025-11-11 09:24:34 +00:00
rohitwaghchaure
798858bd4f Merge pull request #50467 from aerele/fix/update-uom-value
fix: update uom when item changes
2025-11-11 13:43:01 +05:30
ruthra kumar
c6774e35f2 Merge pull request #50465 from frappe/mergify/bp/version-15-hotfix/pr-50366
refactor: enqueue exchange rate revaluation per company (backport #50366)
2025-11-11 13:29:25 +05:30
Kavin
2a2ae9a20c fix: update uom when item changes 2025-11-11 13:17:21 +05:30
ravibharathi656
f039bfe35a refactor: enqueue exchange rate revaluation per company
(cherry picked from commit b10e7bf7b5)
2025-11-11 07:34:57 +00:00
mergify[bot]
1747e83cb1 feat: make material transfer warehouse validation optional (backport #50461) (#50462)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2025-11-11 07:18:41 +00:00
rohitwaghchaure
de14c0838c Merge pull request #50445 from frappe/mergify/bp/version-15-hotfix/pr-50436
perf: serial no creation (backport #50436)
2025-11-11 11:45:59 +05:30
ruthra kumar
3788d0f4f0 Merge pull request #50396 from aerele/show-party-and-account-balances
feat(account settings): add checkbox to show balances in payment entry
2025-11-11 11:14:25 +05:30
Mihir Kandoi
ba98a00c6c Merge pull request #50459 from frappe/mergify/bp/version-15-hotfix/pr-50418
fix: show only stock items in delivered items to be billed and received items to be billed reports (backport #50418)
2025-11-11 10:57:58 +05:30
Mihir Kandoi
2c4510ed1e Merge pull request #50458 from frappe/mergify/bp/version-15-hotfix/pr-50244
fix: state_to_state_province for translation (backport #50244)
2025-11-11 10:52:26 +05:30
rohitwaghchaure
87f3ba5794 chore: fix linters issue 2025-11-11 10:51:19 +05:30
Mihir Kandoi
197d09b90a Merge pull request #50460 from frappe/mergify/bp/version-15-hotfix/pr-50446
fix: add company filter for default warehouse for sales return (backport #50446)
2025-11-11 10:49:48 +05:30
Pugazhendhi Velu
32d3fbf1e8 fix: add company filter for default warehouse for sales return
(cherry picked from commit 0b614007bb)
2025-11-11 05:17:53 +00:00
rohitwaghchaure
4ec25ac82e chore: fix conflicts
Removed unused voucher_no and posting_date retrieval.
2025-11-11 10:47:06 +05:30
ravibharathi656
3dbc90a0b4 fix: show only stock items in delivered items to be billed and received items to be billed reports
(cherry picked from commit 1b2e5c9706)
2025-11-11 05:12:50 +00:00
Mihir Kandoi
f00236e669 Merge pull request #50456 from frappe/mergify/bp/version-15-hotfix/pr-50322
fix typo "show_disables_items" to "show_disabled_items" (backport #50322)
2025-11-11 10:41:20 +05:30
mahsem
d4f6ca3564 fix: state_to_state_province for translation (#50244)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
(cherry picked from commit e148a38353)
2025-11-11 05:08:42 +00:00
Mihir Kandoi
10e7ae4dd3 Merge pull request #50457 from frappe/mergify/bp/version-15-hotfix/pr-50320
fix: add is_group filter in task for timesheet (backport #50320)
2025-11-11 10:37:44 +05:30
Pugazhendhi Velu
0f00581f83 fix: add is_group filter in task for timesheet
(cherry picked from commit 5bac896329)
2025-11-11 04:58:38 +00:00
Mihir Kandoi
a3ddc9533a fix: change fieldtype from link to data for document_type in producti… (backport #50443) (#50455)
Co-authored-by: Pugazhendhi Velu <pugazhendhi720@gmail.com>
2025-11-11 10:26:47 +05:30
rethik
2b766bca97 chore: fix typo "show_disables_items" to "show_disabled_items"
(cherry picked from commit d26c598daa)
2025-11-11 04:56:33 +00:00
Mihir Kandoi
38c2633594 Merge pull request #50454 from frappe/mergify/bp/version-15-hotfix/pr-50399
fix: mr item quantity validation against so over-receipt allowance (backport #50399)
2025-11-11 10:25:45 +05:30
Pugazhendhi Velu
9012a72185 fix: change fieldtype from link to data for document_type in production plan summary
(cherry picked from commit 462deb3755)
2025-11-11 04:41:26 +00:00
Pugazhendhi Velu
249d14b072 test: add test for validate mr item qty against so with over-receipt allowance
(cherry picked from commit 55f531bad6)
2025-11-11 04:40:25 +00:00
Pugazhendhi Velu
f2fef54b83 fix: material request item quantity validation against sales order with over-receipt allowance
(cherry picked from commit 8d7e31e3f2)
2025-11-11 04:40:25 +00:00
Mihir Kandoi
1b1e4e4688 Merge pull request #50453 from frappe/mergify/bp/version-15-hotfix/pr-50135
fix: add missing stock entry UOM filtering based on item master (backport #50135)
2025-11-11 10:05:05 +05:30
Rehan Ansari
8f2002d419 fix: add missing stock entry UOM filtering based on item master (#50135)
Co-authored-by: rehansari26 <rehan.ansari@cloverinfotech.com>
(cherry picked from commit 7baf6ec3d6)
2025-11-11 04:29:34 +00:00
Assem Bahnasy
5b643433e5 Fix: Product Bundle Purchase Order Creation Logic (#49831)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
2025-11-11 09:53:25 +05:30
Diptanil Saha
e02aaa9f1b Merge pull request #50449 from frappe/mergify/bp/version-15-hotfix/pr-50339
fix: include cost_center and project upon accounting dimension fetch (backport #50339)
2025-11-11 00:10:52 +05:30
l0gesh29
b1816864de fix: apply company,is_group filter for cost center
(cherry picked from commit dcdc1c6a89)
2025-11-10 17:47:08 +00:00
l0gesh29
3f490f11d5 fix: include cost_center and project upon accounting dimension fetch
(cherry picked from commit 4680295303)
2025-11-10 17:47:07 +00:00
Diptanil Saha
b545b69e4b Merge pull request #50444 from frappe/mergify/bp/version-15-hotfix/pr-50361
fix: reset billing and shipping address when company changes (backport #50361)
2025-11-10 20:59:05 +05:30
Rohit Waghchaure
6ba24912c3 perf: serial no creation
(cherry picked from commit 19a9497273)

# Conflicts:
#	erpnext/stock/serial_batch_bundle.py
2025-11-10 15:11:27 +00:00
Pugazhendhi Velu
73b8a294cf fix: reset billing and shipping address when company changes
(cherry picked from commit 0510f7e13f)
2025-11-10 15:08:13 +00:00
ruthra kumar
b5485dc909 Merge pull request #50393 from frappe/mergify/bp/version-15-hotfix/pr-50340
fix: ignore Department doctype (backport #50340)
2025-11-10 16:37:43 +05:30
rohitwaghchaure
5ed4fea3e3 Merge pull request #50431 from aerele/fix/reserved-stock-negative
fix(stock): ignore current voucher in reserved stock validation
2025-11-10 15:57:37 +05:30
Kavin
b8ec3ae23a fix: Nonetype error if reserved stock is not present 2025-11-10 14:51:35 +05:30
Kavin
0e7f9711e1 fix(stock): ignore current voucher in reserved stock validation 2025-11-10 14:29:04 +05:30
rohitwaghchaure
3cad1304a0 Merge pull request #50427 from frappe/mergify/bp/version-15-hotfix/pr-50374
fix: add validation to reject empty readings (backport #50374)
2025-11-10 14:04:23 +05:30
ruthra kumar
9dc1f5f649 Merge pull request #50405 from frappe/mergify/bp/version-15-hotfix/pr-50326
fix: validate is_group for parent task (backport #50326)
2025-11-10 12:58:34 +05:30
ruthra kumar
df6ca3af57 chore: resolve conflicts 2025-11-10 12:43:05 +05:30
ruthra kumar
95db1677e2 Merge pull request #50408 from aerele/support-52573
fix: check warehouse account before accessing
2025-11-10 12:39:14 +05:30
ruthra kumar
ca9f1b6c7b Merge pull request #50429 from frappe/mergify/bp/version-15-hotfix/pr-50423
fix(buying): fetch Cost Center from Project (backport #50423)
2025-11-10 12:35:29 +05:30
barredterra
e8e26a91bb fix(buying): fetch Cost Center from Project
(cherry picked from commit bdabcb081a)
2025-11-10 07:03:04 +00:00
Pugazhendhi Velu
dc88f7b30b refactor: add default reading value when creating a quality inspection
(cherry picked from commit 63fb9f55e7)
2025-11-10 05:38:42 +00:00
Pugazhendhi Velu
ac0375fc2e fix: add validation to reject empty readings
(cherry picked from commit 405d901514)
2025-11-10 05:38:42 +00:00
rohitwaghchaure
5bb2e8a8ff Merge pull request #50401 from aerele/support-52103
fix: handle partial dn against reserved stock
2025-11-07 20:53:43 +05:30
rohitwaghchaure
3989a7ede6 Merge pull request #50412 from frappe/mergify/bp/version-15-hotfix/pr-50411
fix: removed the validation (backport #50411)
2025-11-07 19:16:37 +05:30
Kavin
ef719fe729 test: add test for partial dn against reserved stock 2025-11-07 19:09:23 +05:30
Kavin
9d979e34ab fix: handle partial dn against reserved stock 2025-11-07 19:09:11 +05:30
Rohit Waghchaure
080e9a3d73 fix: removed the validation
(cherry picked from commit 10131333b2)
2025-11-07 12:33:11 +00:00
Kavin
79b3af6d3e fix: check warehouse account before accessing 2025-11-07 15:49:59 +05:30
Patrick Eißler
29c976e9ae fix(Timesheet): don't use billing_hours for costing amount (#50394) 2025-11-07 13:26:44 +05:30
Pugazhendhi Velu
635fe427fe refactor(task): use get_link_to_form for validation error messages
(cherry picked from commit 4cf02b4d78)
2025-11-07 07:28:59 +00:00
Pugazhendhi Velu
dc5b8367c5 test: add test for parent task is_group validation
(cherry picked from commit 291f0c7161)

# Conflicts:
#	erpnext/projects/doctype/task/test_task.py
2025-11-07 07:28:59 +00:00
Pugazhendhi Velu
3380deab02 fix: validate is_group for parent task
(cherry picked from commit ed1a1099cb)

# Conflicts:
#	erpnext/projects/doctype/task/task.py
2025-11-07 07:28:59 +00:00
Diptanil Saha
8e199af118 Merge pull request #50403 from frappe/mergify/bp/version-15-hotfix/pr-50402
fix: trends report total mismatch with group by filters (backport #50402)
2025-11-07 12:50:49 +05:30
diptanilsaha
7e3f30baad fix: trends report total mismatch with group filters
(cherry picked from commit f7d09f8760)
2025-11-07 07:03:51 +00:00
ravibharathi656
90500f0ffc feat(account settings): add checkbox to show balances in payment entry 2025-11-06 18:35:56 +05:30
rethik
32182d7cc7 fix: ignore Department doctype
(cherry picked from commit fff6f1fb23)
2025-11-06 11:14:55 +00:00
ruthra kumar
4f02677d6f Merge pull request #50387 from frappe/mergify/bp/version-15-hotfix/pr-50364
fix: hide total row in general ledger report (backport #50364)
2025-11-06 16:02:53 +05:30
Pugazhendhi Velu
56bb88d281 fix: hide total row in general ledger report
(cherry picked from commit ef38b26a73)
2025-11-06 10:11:46 +00:00
Khushi Rawat
124a0fe45d Merge pull request #50379 from frappe/mergify/bp/version-15-hotfix/pr-50367
fix: set company before creating asset movement to avoid permission error (backport #50367)
2025-11-06 10:03:20 +05:30
rehansari26
3fad90ebb9 fix: set company before creating asset movement to avoid permission error
(cherry picked from commit 8c49c9e500)
2025-11-05 21:50:22 +00:00
Khushi Rawat
99b6dc508e Merge pull request #50377 from frappe/mergify/bp/version-15-hotfix/pr-50342
feat: add asset name column (backport #50342)
2025-11-06 01:29:57 +05:30
Khushi Rawat
7d593dd3db fix: resolve conflict 2025-11-06 00:51:41 +05:30
Rehan Ansari
c48647100f feat: add asset name column
(cherry picked from commit f3eda02972)

# Conflicts:
#	erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
2025-11-05 18:52:50 +00:00
ruthra kumar
c54d995354 Merge pull request #50368 from frappe/mergify/bp/version-15-hotfix/pr-50144
refactor: period closing voucher to handle large data volumes (backport #50144)
2025-11-05 17:42:52 +05:30
ruthra kumar
5c6cc1ea2a chore: resolve conflicts 2025-11-05 17:27:14 +05:30
ruthra kumar
e09ee63d32 refactor: add paused to select option
(cherry picked from commit fca7abf4d6)
2025-11-05 11:28:44 +00:00
ruthra kumar
d8e5075424 refactor: minor changes on status
1. set to 'In Progress' on start of both legacy and new controller
2. force delete to avoid permission issues
3. default to 1hr timeout

(cherry picked from commit 9c13edc0b9)
2025-11-05 11:28:43 +00:00
ruthra kumar
d5a36fe8aa refactor: enable legacy controller by default for pcv
(cherry picked from commit fe39ce03bb)

# Conflicts:
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.json
#	erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
2025-11-05 11:28:43 +00:00
ruthra kumar
10df192275 chore: progress bar
(cherry picked from commit 0b88f98a86)
2025-11-05 11:28:43 +00:00
ruthra kumar
4ebddc591f chore: remove scaffolding
(cherry picked from commit 191c0e65a1)
2025-11-05 11:28:42 +00:00
ruthra kumar
5cc6a1771d refactor: abort processing of all tasks upon cancellation
(cherry picked from commit 090e155fd0)
2025-11-05 11:28:42 +00:00
ruthra kumar
29e8801b7f refactor: more changes
1. 'Accounts Manager' has access to submit, cancel and delete
2. cancel and delete operation of PCV is linked with Proces PCV

(cherry picked from commit cae1237859)
2025-11-05 11:28:42 +00:00
ruthra kumar
d94000fecf refactor: smaller methods
(cherry picked from commit fa3bd6f5a7)
2025-11-05 11:28:42 +00:00
ruthra kumar
5071cad161 refactor: utility to consolidate results from all dates
(cherry picked from commit 7406d83260)
2025-11-05 11:28:41 +00:00
ruthra kumar
0151f5f191 refactor: utility to convert tuple key to str
(cherry picked from commit 5b464ae4c1)
2025-11-05 11:28:41 +00:00
ruthra kumar
d139db296a refactor: cleanup and for better readability
(cherry picked from commit 653ae84b3e)
2025-11-05 11:28:41 +00:00
ruthra kumar
3406e44b03 refactor: make Accounts Closing Balance as well
(cherry picked from commit 6e32769e37)
2025-11-05 11:28:41 +00:00
ruthra kumar
449fa05d7d refactor: store closing balance for Balnace sheet accounts
(cherry picked from commit 09e37bc98c)
2025-11-05 11:28:40 +00:00
ruthra kumar
55222468f9 refactor: calculate both balances from single queue
(cherry picked from commit 643e1fdce8)
2025-11-05 11:28:40 +00:00
ruthra kumar
f381b99b14 refactor: populate opening balances calculation table
(cherry picked from commit 86edacb781)
2025-11-05 11:28:40 +00:00
ruthra kumar
2c880dd609 chore: rename closing balance field
(cherry picked from commit cef879bb3b)
2025-11-05 11:28:39 +00:00
ruthra kumar
87e297e899 refactor: balances for both P&L and Balance sheet accounts
(cherry picked from commit 324bebfd44)
2025-11-05 11:28:39 +00:00
ruthra kumar
6c94ca664f refactor: maintain report type on each date
(cherry picked from commit 186d540502)
2025-11-05 11:28:39 +00:00
ruthra kumar
d911e1dab2 refactor: more stable pause and resume
(cherry picked from commit 9e93298f12)
2025-11-05 11:28:39 +00:00
ruthra kumar
908f8ed462 refactor: process on submit
(cherry picked from commit c738b6d356)
2025-11-05 11:28:38 +00:00
ruthra kumar
633ccef2ff refactor: for better readability
(cherry picked from commit 8ba199016a)
2025-11-05 11:28:38 +00:00
ruthra kumar
e8f8abd685 refactor: store results as is and convert at the end
(cherry picked from commit f25ee3c53f)
2025-11-05 11:28:38 +00:00
ruthra kumar
b6b5524228 refactor: build and post gl entries
(cherry picked from commit e88074ddec)
2025-11-05 11:28:38 +00:00
ruthra kumar
76bdf7944c refactor: store daily balances based on dimensions key
dimensions key is manually converted to string

(cherry picked from commit 1846de0d49)
2025-11-05 11:28:37 +00:00
ruthra kumar
1999de0b75 refactor: store closing balance as JSON
(cherry picked from commit 1a31825409)
2025-11-05 11:28:37 +00:00
ruthra kumar
43acfdff82 refactor: stable start, pause, resume and completion stages
(cherry picked from commit c839ebf593)
2025-11-05 11:28:37 +00:00
ruthra kumar
19b911120c refactor: barebones functions
(cherry picked from commit 1c92b01542)
2025-11-05 11:28:37 +00:00
ruthra kumar
bc07de8c12 refactor: temporarily save balances in JSON
(cherry picked from commit f44c908a8d)
2025-11-05 11:28:36 +00:00
ruthra kumar
b484db3ffd refactor: child table in process pcv
(cherry picked from commit 0d09d21d2e)
2025-11-05 11:28:36 +00:00
ruthra kumar
902ce45a36 refactor: more data structure changes
(cherry picked from commit a15578f8f4)
2025-11-05 11:28:36 +00:00
ruthra kumar
bfc0044d23 refactor: checkbox for pcv controller
(cherry picked from commit 4888461be2)

# Conflicts:
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.json
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.py
2025-11-05 11:28:36 +00:00
ruthra kumar
c8e3da0a71 feat: process period closing voucher
(cherry picked from commit 7a93630629)
2025-11-05 11:28:35 +00:00
rohitwaghchaure
2eed8ee343 Merge pull request #50362 from frappe/mergify/bp/version-15-hotfix/pr-50335
fix(material request): set default buying price list if not exists (backport #50335)
2025-11-05 14:44:21 +05:30
ravibharathi656
670c6dcdd7 fix(material request): set default buying price list if not exists
(cherry picked from commit 9c0ff14060)
2025-11-05 08:42:09 +00:00
Raffael Meyer
7d607b82f1 chore: resolve conflicts 2025-10-29 15:37:04 +01:00
barredterra
376da8df0a feat(Item Price): validate UOM
(cherry picked from commit 69824eff80)

# Conflicts:
#	erpnext/stock/doctype/item_price/item_price.py
2025-10-27 06:32:01 +00:00
126 changed files with 1797 additions and 544 deletions

View File

@@ -4,7 +4,7 @@ import inspect
import frappe
from frappe.utils.user import is_website_user
__version__ = "15.87.2"
__version__ = "15.90.0"
def get_default_company(user=None):

View File

@@ -309,8 +309,8 @@ def get_dimensions(with_cost_center_and_project=False):
if with_cost_center_and_project:
dimension_filters.extend(
[
{"fieldname": "cost_center", "document_type": "Cost Center"},
{"fieldname": "project", "document_type": "Project"},
frappe._dict({"fieldname": "cost_center", "document_type": "Cost Center"}),
frappe._dict({"fieldname": "project", "document_type": "Project"}),
]
)

View File

@@ -56,6 +56,9 @@
"reconciliation_queue_size",
"column_break_resa",
"exchange_gain_loss_posting_date",
"payment_entry_settings",
"show_account_balance",
"show_party_balance",
"invoicing_settings_tab",
"accounts_transactions_settings_section",
"over_billing_allowance",
@@ -95,7 +98,8 @@
"legacy_section",
"ignore_is_opening_check_for_reporting",
"payment_request_settings",
"create_pr_in_draft_status"
"create_pr_in_draft_status",
"column_break_xrnd"
],
"fields": [
{
@@ -636,6 +640,23 @@
"fieldname": "use_legacy_controller_for_pcv",
"fieldtype": "Check",
"label": "Use Legacy Controller For Period Closing Voucher"
},
{
"fieldname": "payment_entry_settings",
"fieldtype": "Section Break",
"label": "Payment Entry Settings"
},
{
"default": "0",
"fieldname": "show_account_balance",
"fieldtype": "Check",
"label": "Show Account Balance"
},
{
"default": "0",
"fieldname": "show_party_balance",
"fieldtype": "Check",
"label": "Show Party Balance"
}
],
"icon": "icon-cog",
@@ -643,7 +664,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-10-20 14:06:08.870427",
"modified": "2025-11-06 17:48:07.682837",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
@@ -668,8 +689,9 @@
}
],
"quick_entry": 1,
"row_format": "Dynamic",
"sort_field": "modified",
"sort_order": "ASC",
"states": [],
"track_changes": 1
}
}

View File

@@ -65,8 +65,10 @@ class AccountsSettings(Document):
role_allowed_to_over_bill: DF.Link | None
role_to_override_stop_action: DF.Link | None
round_row_wise_tax: DF.Check
show_account_balance: DF.Check
show_balance_in_coa: DF.Check
show_inclusive_tax_in_print: DF.Check
show_party_balance: DF.Check
show_payment_schedule_in_print: DF.Check
show_taxes_as_table_in_print: DF.Check
stale_days: DF.Int
@@ -105,6 +107,7 @@ class AccountsSettings(Document):
frappe.clear_cache()
self.validate_and_sync_auto_reconcile_config()
self.hide_or_show_party_and_account_balance()
def validate_stale_days(self):
if not self.allow_stale and cint(self.stale_days) <= 0:
@@ -112,6 +115,18 @@ class AccountsSettings(Document):
_("Stale Days should start from 1."), title="Error", indicator="red", raise_exception=1
)
def hide_or_show_party_and_account_balance(self):
def set_property(fieldname, value):
make_property_setter("Payment Entry", fieldname, "hidden", value, "Check")
if self.has_value_changed("show_party_balance"):
set_property("party_balance", not self.show_party_balance)
if self.has_value_changed("show_account_balance"):
account_fields = ["paid_from_account_balance", "paid_to_account_balance"]
for field in account_fields:
set_property(field, not self.show_account_balance)
def enable_payment_schedule_in_print(self):
show_in_print = cint(self.show_payment_schedule_in_print)
for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):

View File

@@ -19,7 +19,7 @@ frappe.ui.form.on("Currency Exchange Settings", {
to: "{to_currency}",
};
add_param(frm, r.message, params, result);
} else if (frm.doc.service_provider == "frankfurter.app") {
} else if (frm.doc.service_provider == "frankfurter.dev") {
let result = ["rates", "{to_currency}"];
let params = {
base: "{from_currency}",

View File

@@ -78,7 +78,7 @@
"fieldname": "service_provider",
"fieldtype": "Select",
"label": "Service Provider",
"options": "frankfurter.app\nexchangerate.host\nCustom",
"options": "frankfurter.dev\nexchangerate.host\nCustom",
"reqd": 1
},
{
@@ -104,7 +104,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-03-18 08:32:26.895076",
"modified": "2025-11-25 13:03:41.896424",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Currency Exchange Settings",
@@ -141,8 +141,9 @@
"write": 1
}
],
"sort_field": "modified",
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}

View File

@@ -29,7 +29,7 @@ class CurrencyExchangeSettings(Document):
disabled: DF.Check
req_params: DF.Table[CurrencyExchangeSettingsDetails]
result_key: DF.Table[CurrencyExchangeSettingsResult]
service_provider: DF.Literal["frankfurter.app", "exchangerate.host", "Custom"]
service_provider: DF.Literal["frankfurter.dev", "exchangerate.host", "Custom"]
url: DF.Data | None
use_http: DF.Check
# end: auto-generated types
@@ -60,7 +60,7 @@ class CurrencyExchangeSettings(Document):
self.append("req_params", {"key": "date", "value": "{transaction_date}"})
self.append("req_params", {"key": "from", "value": "{from_currency}"})
self.append("req_params", {"key": "to", "value": "{to_currency}"})
elif self.service_provider == "frankfurter.app":
elif self.service_provider == "frankfurter.dev":
self.set("result_key", [])
self.set("req_params", [])
@@ -105,11 +105,11 @@ class CurrencyExchangeSettings(Document):
@frappe.whitelist()
def get_api_endpoint(service_provider: str | None = None, use_http: bool = False):
if service_provider and service_provider in ["exchangerate.host", "frankfurter.app"]:
if service_provider and service_provider in ["exchangerate.host", "frankfurter.dev"]:
if service_provider == "exchangerate.host":
api = "api.exchangerate.host/convert"
elif service_provider == "frankfurter.app":
api = "api.frankfurter.app/{transaction_date}"
elif service_provider == "frankfurter.dev":
api = "api.frankfurter.dev/v1/{transaction_date}"
protocol = "https://"
if use_http:

View File

@@ -592,6 +592,8 @@ frappe.ui.form.on("Payment Entry", {
paid_from: function (frm) {
if (frm.set_party_account_based_on_party) return;
frm.events.set_company_bank_account(frm);
frm.events.set_account_currency_and_balance(
frm,
frm.doc.paid_from,
@@ -609,6 +611,8 @@ frappe.ui.form.on("Payment Entry", {
paid_to: function (frm) {
if (frm.set_party_account_based_on_party) return;
frm.events.set_company_bank_account(frm);
frm.events.set_account_currency_and_balance(
frm,
frm.doc.paid_to,
@@ -1350,6 +1354,8 @@ frappe.ui.form.on("Payment Entry", {
},
bank_account: function (frm) {
if (frm.set_company_bank_account_based_on_coa) return;
const field = frm.doc.payment_type == "Pay" ? "paid_from" : "paid_to";
if (frm.doc.bank_account && ["Pay", "Receive"].includes(frm.doc.payment_type)) {
frappe.call({
@@ -1388,6 +1394,34 @@ frappe.ui.form.on("Payment Entry", {
}
},
set_company_bank_account: function (frm) {
if (!["Pay", "Receive"].includes(frm.doc.payment_type)) return;
const field = frm.doc.payment_type == "Pay" ? "paid_from" : "paid_to";
if (!frm.doc.company || !frm.doc[field]) return;
frm.set_company_bank_account_based_on_coa = true;
frappe.call({
method: "frappe.client.get_value",
args: {
doctype: "Bank Account",
filters: {
company: frm.doc.company,
account: frm.doc[field],
disabled: 0,
},
fieldname: ["name"],
},
callback: async function (r) {
if (r.message) await frm.set_value("bank_account", r.message.name);
frm.set_company_bank_account_based_on_coa = false;
},
});
},
sales_taxes_and_charges_template: function (frm) {
frm.trigger("fetch_taxes_from_template");
},

View File

@@ -449,7 +449,7 @@ class PaymentEntry(AccountsController):
self.contact_person = get_default_contact(self.party_type, self.party)
complete_contact_details(self)
if not self.party_balance:
if not self.party_balance and frappe.get_single_value("Accounts Settings", "show_party_balance"):
self.party_balance = get_balance_on(
party_type=self.party_type, party=self.party, date=self.posting_date, company=self.company
)
@@ -1800,7 +1800,7 @@ class PaymentEntry(AccountsController):
else:
self.total_taxes_and_charges += current_tax_amount
self.base_total_taxes_and_charges += tax.base_tax_amount
self.base_total_taxes_and_charges += current_tax_amount
if self.get("taxes"):
self.paid_amount_after_tax = self.get("taxes")[-1].base_total
@@ -2684,11 +2684,17 @@ def get_party_details(company, party_type, party, date, cost_center=None):
party_account = get_party_account(party_type, party, company)
account_currency = get_account_currency(party_account)
account_balance = get_balance_on(party_account, date, cost_center=cost_center)
account_balance = (
get_balance_on(party_account, date, cost_center=cost_center)
if frappe.get_single_value("Accounts Settings", "show_account_balance")
else 0
)
_party_name = "title" if party_type == "Shareholder" else party_type.lower() + "_name"
party_name = frappe.db.get_value(party_type, party, _party_name)
party_balance = get_balance_on(
party_type=party_type, party=party, company=company, cost_center=cost_center
party_balance = (
get_balance_on(party_type=party_type, party=party, company=company, cost_center=cost_center)
if frappe.get_single_value("Accounts Settings", "show_party_balance")
else 0
)
if party_type in ["Customer", "Supplier"]:
party_bank_account = get_party_bank_account(party_type, party)
@@ -2717,7 +2723,11 @@ def get_account_details(account, date, cost_center=None):
if not account_list:
frappe.throw(_("Account: {0} is not permitted under Payment Entry").format(account))
account_balance = get_balance_on(account, date, cost_center=cost_center, ignore_account_permission=True)
account_balance = (
get_balance_on(account, date, cost_center=cost_center, ignore_account_permission=True)
if frappe.get_single_value("Accounts Settings", "show_account_balance")
else 0
)
return frappe._dict(
{
@@ -3529,11 +3539,18 @@ def get_paid_amount(dt, dn, party_type, party, account, due_date):
def get_party_and_account_balance(
company, date, paid_from=None, paid_to=None, ptype=None, pty=None, cost_center=None
):
show_account_balance = frappe.get_single_value("Accounts Settings", "show_account_balance")
return frappe._dict(
{
"party_balance": get_balance_on(party_type=ptype, party=pty, cost_center=cost_center),
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center),
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center),
"party_balance": get_balance_on(party_type=ptype, party=pty, cost_center=cost_center)
if frappe.get_single_value("Accounts Settings", "show_party_balance")
else 0,
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center)
if show_account_balance
else 0,
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center)
if show_account_balance
else 0,
}
)

View File

@@ -61,6 +61,22 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo
},
};
});
this.frm.set_query("cost_center", "payments", () => {
return {
filters: {
company: this.frm.doc.company,
is_group: 0,
},
};
});
this.frm.set_query("cost_center", "allocation", () => {
return {
filters: {
company: this.frm.doc.company,
is_group: 0,
},
};
});
}
refresh() {

View File

@@ -72,7 +72,7 @@ class PaymentReconciliation(Document):
self.common_filter_conditions = []
self.accounting_dimension_filter_conditions = []
self.ple_posting_date_filter = []
self.dimensions = get_dimensions()[0]
self.dimensions = get_dimensions(with_cost_center_and_project=True)[0]
def load_from_db(self):
# 'modified' attribute is required for `run_doc_method` to work properly.

View File

@@ -475,8 +475,15 @@ def process_gl_and_closing_entries(doc):
frappe.db.set_value(doc.doctype, doc.name, "gle_processing_status", "Completed")
except Exception as e:
frappe.db.rollback()
frappe.log_error(e)
frappe.db.set_value(doc.doctype, doc.name, "gle_processing_status", "Failed")
frappe.log_error(title=_("Period Closing Voucher {0} GL Entry Processing Failed").format(doc.name))
frappe.db.set_value(
doc.doctype,
doc.name,
{
"error_message": str(e),
"gle_processing_status": "Failed",
},
)
def process_cancellation(voucher_type, voucher_no):
@@ -488,8 +495,17 @@ def process_cancellation(voucher_type, voucher_no):
frappe.db.set_value("Period Closing Voucher", voucher_no, "gle_processing_status", "Completed")
except Exception as e:
frappe.db.rollback()
frappe.log_error(e)
frappe.db.set_value("Period Closing Voucher", voucher_no, "gle_processing_status", "Failed")
frappe.log_error(
title=_("Period Closing Voucher {0} GL Entry Cancellation Failed").format(voucher_no)
)
frappe.db.set_value(
voucher_type,
voucher_no,
{
"error_message": str(e),
"gle_processing_status": "Failed",
},
)
def delete_closing_entries(voucher_no):

View File

@@ -189,6 +189,9 @@ class POSInvoice(SalesInvoice):
super().__init__(*args, **kwargs)
def validate(self):
if not self.customer:
frappe.throw(_("Please select Customer first"))
if not cint(self.is_pos):
frappe.throw(
_("POS Invoice should have the field {0} checked.").format(frappe.bold(_("Include Payment")))
@@ -345,14 +348,14 @@ class POSInvoice(SalesInvoice):
):
return
from erpnext.stock.stock_ledger import is_negative_stock_allowed
for d in self.get("items"):
if not d.serial_and_batch_bundle:
if is_negative_stock_allowed(item_code=d.item_code):
return
available_stock, is_stock_item, is_negative_stock_allowed = get_stock_availability(
d.item_code, d.warehouse
)
available_stock, is_stock_item = get_stock_availability(d.item_code, d.warehouse)
if is_negative_stock_allowed:
continue
item_code, warehouse, _qty = (
frappe.bold(d.item_code),
@@ -760,20 +763,22 @@ class POSInvoice(SalesInvoice):
@frappe.whitelist()
def get_stock_availability(item_code, warehouse):
from erpnext.stock.stock_ledger import is_negative_stock_allowed
if frappe.db.get_value("Item", item_code, "is_stock_item"):
is_stock_item = True
bin_qty = get_bin_qty(item_code, warehouse)
pos_sales_qty = get_pos_reserved_qty(item_code, warehouse)
return bin_qty - pos_sales_qty, is_stock_item
return bin_qty - pos_sales_qty, is_stock_item, is_negative_stock_allowed(item_code=item_code)
else:
is_stock_item = True
if frappe.db.exists("Product Bundle", {"name": item_code, "disabled": 0}):
return get_bundle_availability(item_code, warehouse), is_stock_item
return get_bundle_availability(item_code, warehouse), is_stock_item, False
else:
is_stock_item = False
# Is a service item or non_stock item
return 0, is_stock_item
return 0, is_stock_item, False
def get_bundle_availability(bundle_item_code, warehouse):

View File

@@ -41,9 +41,19 @@ class POSOpeningEntry(StatusUpdater):
self.set_status()
def validate_pos_profile_and_cashier(self):
if self.company != frappe.db.get_value("POS Profile", self.pos_profile, "company"):
if not frappe.db.exists("POS Profile", self.pos_profile):
frappe.throw(_("POS Profile {} does not exist.").format(self.pos_profile))
pos_profile_company, pos_profile_disabled = frappe.db.get_value(
"POS Profile", self.pos_profile, ["company", "disabled"]
)
if pos_profile_disabled:
frappe.throw(_("POS Profile {} is disabled.").format(frappe.bold(self.pos_profile)))
if self.company != pos_profile_company:
frappe.throw(
_("POS Profile {} does not belongs to company {}").format(self.pos_profile, self.company)
_("POS Profile {} does not belong to company {}").format(self.pos_profile, self.company)
)
if not cint(frappe.db.get_value("User", self.user, "enabled")):

View File

@@ -70,6 +70,7 @@ class POSProfile(Document):
# end: auto-generated types
def validate(self):
self.validate_disabled()
self.validate_default_profile()
self.validate_all_link_fields()
self.validate_duplicate_groups()
@@ -94,6 +95,21 @@ class POSProfile(Document):
title=_("Mandatory Accounting Dimension"),
)
def validate_disabled(self):
old_doc = self.get_doc_before_save()
if (
old_doc
and self.disabled
and old_doc.disabled != self.disabled
and frappe.db.exists("POS Opening Entry", {"pos_profile": self.name, "status": "Open"})
):
frappe.throw(
_("POS Profile {0} cannot be disabled as there are ongoing POS sessions.").format(
frappe.bold(self.name)
)
)
def validate_default_profile(self):
for row in self.applicable_for_users:
res = frappe.db.sql(

View File

@@ -4,6 +4,7 @@
import unittest
import frappe
from frappe.utils import cint
from erpnext.accounts.doctype.pos_profile.pos_profile import (
get_child_nodes,
@@ -38,6 +39,51 @@ class TestPOSProfile(unittest.TestCase):
frappe.db.sql("delete from `tabPOS Profile`")
def test_disabled_pos_profile_creation(self):
make_pos_profile(name="_Test POS Profile 001", disabled=1)
pos_profile = frappe.get_doc("POS Profile", "_Test POS Profile 001")
if pos_profile:
self.assertEqual(pos_profile.disabled, 1)
def test_disabled_pos_profile_after_opening(self):
from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry
test_user, pos_profile = init_user_and_profile()
if pos_profile:
create_opening_entry(pos_profile, test_user.name)
self.assertEqual(pos_profile.disabled, 0)
pos_profile.disabled = 1
self.assertRaises(frappe.ValidationError, pos_profile.save)
def test_disabled_pos_profile_after_completing_session(self):
from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import (
make_closing_entry_from_opening,
)
from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import (
create_opening_entry,
)
test_user, pos_profile = init_user_and_profile()
frappe.db.delete("POS Opening Entry", {"pos_profile": pos_profile.name})
if pos_profile:
opening_entry = create_opening_entry(pos_profile, test_user.name)
closing_entry = make_closing_entry_from_opening(opening_entry)
closing_entry.submit()
pos_profile.disabled = 1
pos_profile.save()
pos_profile.reload()
self.assertEqual(pos_profile.disabled, 1)
def get_customers_list(pos_profile=None):
if pos_profile is None:
@@ -117,6 +163,7 @@ def make_pos_profile(**args):
"write_off_account": args.write_off_account or "_Test Write Off - _TC",
"write_off_cost_center": args.write_off_cost_center or "_Test Write Off Cost Center - _TC",
"location": "Block 1" if not args.do_not_set_accounting_dimension else None,
"disabled": cint(args.disabled) or 0,
}
)

View File

@@ -243,10 +243,13 @@ def get_other_conditions(conditions, values, args):
if group_condition:
conditions += " and " + group_condition
if args.get("transaction_date"):
date = args.get("transaction_date") or frappe.get_value(
args.get("doctype"), args.get("name"), "posting_date", ignore=True
)
if date:
conditions += """ and %(transaction_date)s between ifnull(`tabPricing Rule`.valid_from, '2000-01-01')
and ifnull(`tabPricing Rule`.valid_upto, '2500-12-31')"""
values["transaction_date"] = args.get("transaction_date")
values["transaction_date"] = date
if args.get("doctype") in [
"Quotation",

View File

@@ -12,6 +12,7 @@ erpnext.buying.setup_buying_controller();
erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.BuyingController {
setup(doc) {
this.setup_accounting_dimension_triggers();
this.setup_posting_date_time_check();
super.setup(doc);

View File

@@ -14,6 +14,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
erpnext.selling.SellingController
) {
setup(doc) {
this.setup_accounting_dimension_triggers();
this.setup_posting_date_time_check();
super.setup(doc);
this.frm.make_methods = {

View File

@@ -26,16 +26,13 @@ frappe.query_reports["Accounts Payable"] = {
{
fieldname: "cost_center",
label: __("Cost Center"),
fieldtype: "Link",
options: "Cost Center",
get_query: () => {
var company = frappe.query_report.get_filter_value("company");
return {
filters: {
company: company,
},
};
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Cost Center", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Cost Center",
},
{
fieldname: "party_account",

View File

@@ -45,16 +45,13 @@ frappe.query_reports["Accounts Payable Summary"] = {
{
fieldname: "cost_center",
label: __("Cost Center"),
fieldtype: "Link",
options: "Cost Center",
get_query: () => {
var company = frappe.query_report.get_filter_value("company");
return {
filters: {
company: company,
},
};
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Cost Center", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Cost Center",
},
{
fieldname: "party_type",

View File

@@ -28,16 +28,13 @@ frappe.query_reports["Accounts Receivable"] = {
{
fieldname: "cost_center",
label: __("Cost Center"),
fieldtype: "Link",
options: "Cost Center",
get_query: () => {
var company = frappe.query_report.get_filter_value("company");
return {
filters: {
company: company,
},
};
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Cost Center", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Cost Center",
},
{
fieldname: "party_type",

View File

@@ -15,6 +15,7 @@ from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions,
get_dimension_with_children,
)
from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
from erpnext.accounts.utils import (
build_qb_match_conditions,
get_advance_payment_doctypes,
@@ -994,11 +995,7 @@ class ReceivablePayableReport:
self.add_accounting_dimensions_filters()
def get_cost_center_conditions(self):
lft, rgt = frappe.db.get_value("Cost Center", self.filters.cost_center, ["lft", "rgt"])
cost_center_list = [
center.name
for center in frappe.get_list("Cost Center", filters={"lft": (">=", lft), "rgt": ("<=", rgt)})
]
cost_center_list = get_cost_centers_with_children(self.filters.cost_center)
self.qb_selection_filter.append(self.ple.cost_center.isin(cost_center_list))
def add_common_filters(self):

View File

@@ -45,16 +45,13 @@ frappe.query_reports["Accounts Receivable Summary"] = {
{
fieldname: "cost_center",
label: __("Cost Center"),
fieldtype: "Link",
options: "Cost Center",
get_query: () => {
var company = frappe.query_report.get_filter_value("company");
return {
filters: {
company: company,
},
};
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Cost Center", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Cost Center",
},
{
fieldname: "party_type",

View File

@@ -119,6 +119,7 @@ def get_assets_details(assets):
fields = [
"name as asset",
"asset_name",
"gross_purchase_amount",
"opening_accumulated_depreciation",
"asset_category",
@@ -143,6 +144,12 @@ def get_columns():
"options": "Asset",
"width": 120,
},
{
"label": _("Asset Name"),
"fieldname": "asset_name",
"fieldtype": "Data",
"width": 140,
},
{
"label": _("Depreciation Date"),
"fieldname": "depreciation_date",

View File

@@ -69,12 +69,18 @@ class PartyLedgerSummaryReport:
party_type = self.filters.party_type
doctype = qb.DocType(party_type)
party_details_fields = [
doctype.name.as_("party"),
f"{scrub(party_type)}_name",
f"{scrub(party_type)}_group",
]
if party_type == "Customer":
party_details_fields.append(doctype.territory)
conditions = self.get_party_conditions(doctype)
query = (
qb.from_(doctype)
.select(doctype.name.as_("party"), f"{scrub(party_type)}_name")
.where(Criterion.all(conditions))
)
query = qb.from_(doctype).select(*party_details_fields).where(Criterion.all(conditions))
from frappe.desk.reportview import build_match_conditions
@@ -153,6 +159,31 @@ class PartyLedgerSummaryReport:
credit_or_debit_note = "Credit Note" if self.filters.party_type == "Customer" else "Debit Note"
if self.filters.party_type == "Customer":
columns += [
{
"label": _("Customer Group"),
"fieldname": "customer_group",
"fieldtype": "Link",
"options": "Customer Group",
},
{
"label": _("Territory"),
"fieldname": "territory",
"fieldtype": "Link",
"options": "Territory",
},
]
else:
columns += [
{
"label": _("Supplier Group"),
"fieldname": "supplier_group",
"fieldtype": "Link",
"options": "Supplier Group",
}
]
columns += [
{
"label": _("Opening Balance"),
@@ -213,35 +244,6 @@ class PartyLedgerSummaryReport:
},
]
# Hidden columns for handling 'User Permissions'
if self.filters.party_type == "Customer":
columns += [
{
"label": _("Territory"),
"fieldname": "territory",
"fieldtype": "Link",
"options": "Territory",
"hidden": 1,
},
{
"label": _("Customer Group"),
"fieldname": "customer_group",
"fieldtype": "Link",
"options": "Customer Group",
"hidden": 1,
},
]
else:
columns += [
{
"label": _("Supplier Group"),
"fieldname": "supplier_group",
"fieldtype": "Link",
"options": "Supplier Group",
"hidden": 1,
}
]
return columns
def get_data(self):

View File

@@ -174,7 +174,7 @@ def add_solvency_ratios(
return_on_equity_ratio = {"ratio": _("Return on Equity Ratio")}
for year in years:
profit_after_tax = flt(total_income.get(year)) + flt(total_expense.get(year))
profit_after_tax = flt(total_income.get(year)) - flt(total_expense.get(year))
share_holder_fund = flt(total_asset.get(year)) - flt(total_liability.get(year))
debt_equity_ratio[year] = calculate_ratio(total_liability.get(year), share_holder_fund, precision)
@@ -199,7 +199,7 @@ def add_turnover_ratios(data, years, period_list, filters, total_asset, net_sale
avg_data = {}
for d in ["Receivable", "Payable", "Stock"]:
avg_data[frappe.scrub(d)] = avg_ratio_balance("Receivable", period_list, precision, filters)
avg_data[frappe.scrub(d)] = avg_ratio_balance(d, period_list, precision, filters)
avg_debtors, avg_creditors, avg_stock = (
avg_data.get("receivable"),

View File

@@ -1,5 +1,5 @@
{
"add_total_row": 1,
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-12-06 13:22:23",
@@ -10,7 +10,7 @@
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-08-13 12:47:27.645023",
"modified": "2025-11-05 15:47:59.597853",
"modified_by": "Administrator",
"module": "Accounts",
"name": "General Ledger",

View File

@@ -566,6 +566,13 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map, tot
else:
update_value_in_dict(consolidated_gle, key, gle)
if filters.get("include_dimensions"):
dimensions = [*accounting_dimensions, "cost_center", "project"]
for dimension in dimensions:
if val := gle.get(dimension):
gle[dimension] = _(val)
for value in consolidated_gle.values():
update_value_in_dict(totals, "total", value)
update_value_in_dict(totals, "closing", value)

View File

@@ -21,6 +21,7 @@ def get_ordered_to_be_billed_data(args, filters=None):
doctype = frappe.qb.DocType(doctype)
child_doctype = frappe.qb.DocType(child_tab)
item = frappe.qb.DocType("Item")
docname = filters.get(args.get("reference_field"), None)
project_field = get_project_field(doctype, child_doctype, party)
@@ -29,6 +30,8 @@ def get_ordered_to_be_billed_data(args, filters=None):
frappe.qb.from_(doctype)
.inner_join(child_doctype)
.on(doctype.name == child_doctype.parent)
.join(item)
.on(item.name == child_doctype.item_code)
.select(
doctype.name,
doctype[args.get("date")].as_("date"),
@@ -54,6 +57,7 @@ def get_ordered_to_be_billed_data(args, filters=None):
& (doctype.company == filters.get("company"))
& (doctype.posting_date <= filters.get("posting_date"))
& (child_doctype.amount > 0)
& (item.is_stock_item == 1)
& (
child_doctype.base_amount
- Round(child_doctype.billed_amt * IfNull(doctype.conversion_rate, 1), precision)

View File

@@ -1,32 +1,37 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-06-13 18:46:55",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2018-02-21 01:28:31.261299",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Trends",
"owner": "Administrator",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Invoice Trends",
"report_type": "Script Report",
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-06-13 18:46:55",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-11-05 11:55:49.950442",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Trends",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Invoice Trends",
"report_type": "Script Report",
"roles": [
{
"role": "Accounts User"
},
},
{
"role": "Purchase User"
},
},
{
"role": "Accounts Manager"
},
},
{
"role": "Auditor"
}
]
}
],
"timeout": 0
}

View File

@@ -1,26 +1,31 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-06-13 18:44:21",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2018-02-21 01:28:03.622485",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Trends",
"owner": "Administrator",
"ref_doctype": "Sales Invoice",
"report_name": "Sales Invoice Trends",
"report_type": "Script Report",
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-06-13 18:44:21",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-11-05 11:55:50.070651",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Trends",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Sales Invoice",
"report_name": "Sales Invoice Trends",
"report_type": "Script Report",
"roles": [
{
"role": "Accounts Manager"
},
},
{
"role": "Accounts User"
}
]
}
],
"timeout": 0
}

View File

@@ -4,7 +4,9 @@
import frappe
from frappe import _
from frappe.utils import getdate
from frappe.utils import flt, getdate
from erpnext.accounts.utils import get_currency_precision
def execute(filters=None):
@@ -43,6 +45,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
party_map = get_party_pan_map(filters.get("party_type"))
tax_rate_map = get_tax_rate_map(filters)
gle_map = get_gle_map(tds_docs)
precision = get_currency_precision()
out = []
entries = {}
@@ -72,17 +75,28 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
tax_withholding_category = party_map.get(party, {}).get("tax_withholding_category")
rate = get_tax_withholding_rates(tax_rate_map.get(tax_withholding_category, []), posting_date)
if net_total_map.get((voucher_type, name)):
values = net_total_map.get((voucher_type, name))
if values:
if voucher_type == "Journal Entry" and tax_amount and rate:
# back calcalute total amount from rate and tax_amount
base_total = min(tax_amount / (rate / 100), net_total_map.get((voucher_type, name))[0])
# back calculate total amount from rate and tax_amount
base_total = min(flt(tax_amount / (rate / 100), precision=precision), values[0])
total_amount = grand_total = base_total
elif voucher_type == "Purchase Invoice":
total_amount, grand_total, base_total, bill_no, bill_date = net_total_map.get(
(voucher_type, name)
)
else:
total_amount, grand_total, base_total = net_total_map.get((voucher_type, name))
if tax_amount and rate:
# back calculate total amount from rate and tax_amount
total_amount = flt((tax_amount * 100) / rate, precision=precision)
else:
total_amount = values[0]
grand_total = values[1]
base_total = values[2]
if voucher_type == "Purchase Invoice":
bill_no = values[3]
bill_date = values[4]
else:
total_amount += entry.credit

View File

@@ -47,22 +47,23 @@ frappe.query_reports["Trial Balance"] = {
{
fieldname: "cost_center",
label: __("Cost Center"),
fieldtype: "Link",
options: "Cost Center",
get_query: function () {
var company = frappe.query_report.get_filter_value("company");
return {
doctype: "Cost Center",
filters: {
company: company,
},
};
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Cost Center", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Cost Center",
},
{
fieldname: "project",
label: __("Project"),
fieldtype: "Link",
fieldtype: "MultiSelectList",
get_data: function (txt) {
return frappe.db.get_link_options("Project", txt, {
company: frappe.query_report.get_filter_value("company"),
});
},
options: "Project",
},
{

View File

@@ -15,6 +15,7 @@ from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
from erpnext.accounts.report.financial_statements import (
filter_accounts,
filter_out_zero_value_rows,
get_cost_centers_with_children,
set_gl_entries_by_account,
)
from erpnext.accounts.report.utils import convert_to_presentation_currency, get_currency
@@ -103,10 +104,6 @@ def get_data(filters):
opening_balances = get_opening_balances(filters, ignore_is_opening)
# add filter inside list so that the query in financial_statements.py doesn't break
if filters.project:
filters.project = [filters.project]
set_gl_entries_by_account(
filters.company,
filters.from_date,
@@ -270,18 +267,12 @@ def get_opening_balance(
opening_balance = opening_balance.where(closing_balance.voucher_type != "Period Closing Voucher")
if filters.cost_center:
lft, rgt = frappe.db.get_value("Cost Center", filters.cost_center, ["lft", "rgt"])
cost_center = frappe.qb.DocType("Cost Center")
opening_balance = opening_balance.where(
closing_balance.cost_center.isin(
frappe.qb.from_(cost_center)
.select("name")
.where((cost_center.lft >= lft) & (cost_center.rgt <= rgt))
)
closing_balance.cost_center.isin(get_cost_centers_with_children(filters.get("cost_center")))
)
if filters.project:
opening_balance = opening_balance.where(closing_balance.project == filters.project)
opening_balance = opening_balance.where(closing_balance.project.isin(filters.project))
if frappe.db.count("Finance Book"):
if filters.get("include_default_book_entries"):

View File

@@ -1755,24 +1755,22 @@ def check_and_delete_linked_reports(report):
frappe.delete_doc("Desktop Icon", icon)
def create_err_and_its_journals(companies: list | None = None) -> None:
if companies:
for company in companies:
err = frappe.new_doc("Exchange Rate Revaluation")
err.company = company.name
err.posting_date = nowdate()
err.rounding_loss_allowance = 0.0
def create_err_and_its_journals(company: dict) -> None:
err = frappe.new_doc("Exchange Rate Revaluation")
err.company = company.name
err.posting_date = nowdate()
err.rounding_loss_allowance = 0.0
err.fetch_and_calculate_accounts_data()
if err.accounts:
err.save().submit()
response = err.make_jv_entries()
err.fetch_and_calculate_accounts_data()
if err.accounts:
err.save().submit()
response = err.make_jv_entries()
if company.submit_err_jv:
jv = response.get("revaluation_jv", None)
jv and frappe.get_doc("Journal Entry", jv).submit()
jv = response.get("zero_balance_jv", None)
jv and frappe.get_doc("Journal Entry", jv).submit()
if company.submit_err_jv:
jv = response.get("revaluation_jv", None)
jv and frappe.get_doc("Journal Entry", jv).submit()
jv = response.get("zero_balance_jv", None)
jv and frappe.get_doc("Journal Entry", jv).submit()
def _auto_create_exchange_rate_revaluation_for(frequency: str) -> None:
@@ -1785,7 +1783,14 @@ def _auto_create_exchange_rate_revaluation_for(frequency: str) -> None:
filters={"auto_exchange_rate_revaluation": 1, "auto_err_frequency": frequency},
fields=["name", "submit_err_jv"],
)
create_err_and_its_journals(companies)
if companies:
for company in companies:
frappe.enqueue(
"erpnext.accounts.utils.create_err_and_its_journals",
company=company,
queue="long",
)
def auto_create_exchange_rate_revaluation_daily() -> None:

View File

@@ -202,7 +202,7 @@ frappe.ui.form.on("Asset", {
callback: function (r) {
if (!r.message) {
$(".primary-action").prop("hidden", true);
$(".form-message").text("Capitalize this asset to confirm");
$(".form-message").text(__("Capitalize this asset to confirm"));
frm.add_custom_button(__("Capitalize Asset"), function () {
frm.trigger("create_asset_capitalization");

View File

@@ -371,7 +371,6 @@
"label": "Other Details"
},
{
"allow_on_submit": 1,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
@@ -379,7 +378,7 @@
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
"options": "Draft\nSubmitted\nPartially Depreciated\nFully Depreciated\nSold\nScrapped\nIn Maintenance\nOut of Order\nIssue\nReceipt\nCapitalized\nWork In Progress",
"options": "Draft\nSubmitted\nCancelled\nPartially Depreciated\nFully Depreciated\nSold\nScrapped\nIn Maintenance\nOut of Order\nIssue\nReceipt\nCapitalized\nWork In Progress",
"read_only": 1
},
{
@@ -597,7 +596,7 @@
"link_fieldname": "target_asset"
}
],
"modified": "2025-10-23 22:43:33.634452",
"modified": "2025-11-17 18:01:51.417942",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",

View File

@@ -103,6 +103,7 @@ class Asset(AccountsController):
status: DF.Literal[
"Draft",
"Submitted",
"Cancelled",
"Partially Depreciated",
"Fully Depreciated",
"Sold",
@@ -458,6 +459,7 @@ class Asset(AccountsController):
"asset_name": self.asset_name,
"target_location": self.location,
"to_employee": self.custodian,
"company": self.company,
}
]
asset_movement = frappe.get_doc(

View File

@@ -139,7 +139,7 @@
"fieldtype": "Link",
"in_list_view": 1,
"label": "Asset",
"link_filters": "[[\"Asset\",\"status\",\"not in\",[\"Work In Progress\",\"Capitalized\",\"Fully Depreciated\",\"Sold\",\"Scrapped\",null]]]",
"link_filters": "[[\"Asset\",\"status\",\"not in\",[\"Work In Progress\",\"Capitalized\",\"Fully Depreciated\",\"Sold\",\"Scrapped\",\"Cancelled\",null]]]",
"options": "Asset",
"reqd": 1
},
@@ -250,7 +250,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2025-07-29 15:14:34.044564",
"modified": "2025-11-17 18:35:54.575265",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Repair",

View File

@@ -60,6 +60,17 @@ class AssetRepair(AccountsController):
if self.get("stock_items"):
self.set_stock_items_cost()
self.calculate_total_repair_cost()
self.validate_purchase_invoice_status()
def validate_purchase_invoice_status(self):
if self.purchase_invoice:
docstatus = frappe.db.get_value("Purchase Invoice", self.purchase_invoice, "docstatus")
if docstatus == 0:
frappe.throw(
_("{0} is still in Draft. Please submit it before saving the Asset Repair.").format(
get_link_to_form("Purchase Invoice", self.purchase_invoice)
)
)
def validate_asset(self):
if self.asset_doc.status in ("Sold", "Fully Depreciated", "Scrapped"):
@@ -305,7 +316,6 @@ class AssetRepair(AccountsController):
"cost_center": self.cost_center,
"posting_date": self.completion_date,
"against_voucher_type": "Purchase Invoice",
"against_voucher": self.purchase_invoice,
"company": self.company,
},
item=self,

View File

@@ -36,6 +36,7 @@
"backflush_raw_materials_of_subcontract_based_on",
"column_break_11",
"over_transfer_allowance",
"validate_consumed_qty",
"section_break_xcug",
"auto_create_subcontracting_order",
"column_break_izrr",
@@ -270,6 +271,14 @@
"label": "Fixed Outgoing Email Account",
"link_filters": "[[\"Email Account\",\"enable_outgoing\",\"=\",1]]",
"options": "Email Account"
},
{
"default": "0",
"depends_on": "eval:doc.backflush_raw_materials_of_subcontract_based_on == \"Material Transferred for Subcontract\"",
"description": "Raw materials consumed qty will be validated based on FG BOM required qty",
"fieldname": "validate_consumed_qty",
"fieldtype": "Check",
"label": "Validate Consumed Qty (as per BOM)"
}
],
"grid_page_length": 50,
@@ -278,7 +287,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-08-20 22:13:38.506889",
"modified": "2025-11-20 12:59:09.925862",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",

View File

@@ -44,6 +44,7 @@ class BuyingSettings(Document):
supp_master_name: DF.Literal["Supplier Name", "Naming Series", "Auto Name"]
supplier_group: DF.Link | None
use_transaction_date_exchange_rate: DF.Check
validate_consumed_qty: DF.Check
# end: auto-generated types
def validate(self):

View File

@@ -303,6 +303,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
erpnext.buying.BuyingController
) {
setup() {
this.setup_accounting_dimension_triggers();
this.frm.custom_make_buttons = {
"Purchase Receipt": "Purchase Receipt",
"Purchase Invoice": "Purchase Invoice",

View File

@@ -76,6 +76,46 @@ class TestRequestforQuotation(FrappeTestCase):
self.assertEqual(sq1.get("items")[0].item_code, "_Test Item")
self.assertEqual(sq1.get("items")[0].qty, 5)
def test_make_supplier_quotation_with_taxes(self):
"""Test automatic tax addition when supplier quotation is created from RFQ taxes_and_charges are set"""
# Create a Purchase Taxes and Charges Template for testing
tax_template = frappe.new_doc("Purchase Taxes and Charges Template")
tax_template.doctype = "Purchase Taxes and Charges Template"
tax_template.title = "_Test Purchase Taxes Template for RFQ"
tax_template.company = "_Test Company"
tax_template.append(
"taxes",
{
"charge_type": "On Net Total",
"account_head": "_Test Account Service Tax - _TC",
"description": "VAT",
"rate": 10,
},
)
tax_template.save()
rfq = make_request_for_quotation()
supplier = rfq.get("suppliers")[0].supplier
tax_rule = frappe.new_doc("Tax Rule")
tax_rule.company = "_Test Company"
tax_rule.tax_type = "Purchase"
tax_rule.supplier = supplier
tax_rule.purchase_tax_template = tax_template.name
tax_rule.save()
sq = make_supplier_quotation_from_rfq(rfq.name, for_supplier=supplier)
# Verify that taxes_and_charges is set from get_party_details
self.assertEqual(sq.taxes_and_charges, tax_template.name)
# Verify that taxes are automatically added
self.assertGreaterEqual(len(sq.get("taxes")), 1)
tax_rule.delete()
tax_template.delete()
def test_make_supplier_quotation_with_special_characters(self):
frappe.delete_doc_if_exists("Supplier", "_Test Supplier '1", force=1)
supplier = frappe.new_doc("Supplier")

View File

@@ -41,18 +41,20 @@ frappe.ui.form.on("Supplier", {
frm.set_query("supplier_primary_contact", function (doc) {
return {
query: "erpnext.buying.doctype.supplier.supplier.get_supplier_primary_contact",
query: "erpnext.buying.doctype.supplier.supplier.get_supplier_primary",
filters: {
supplier: doc.name,
type: "Contact",
},
};
});
frm.set_query("supplier_primary_address", function (doc) {
return {
query: "erpnext.buying.doctype.supplier.supplier.get_supplier_primary",
filters: {
link_doctype: "Supplier",
link_name: doc.name,
supplier: doc.name,
type: "Address",
},
};
});

View File

@@ -215,19 +215,25 @@ class Supplier(TransactionBase):
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters):
def get_supplier_primary(doctype, txt, searchfield, start, page_len, filters):
supplier = filters.get("supplier")
contact = frappe.qb.DocType("Contact")
type = filters.get("type")
type_doctype = frappe.qb.DocType(type)
dynamic_link = frappe.qb.DocType("Dynamic Link")
return (
frappe.qb.from_(contact)
query = (
frappe.qb.from_(type_doctype)
.join(dynamic_link)
.on(contact.name == dynamic_link.parent)
.select(contact.name, contact.email_id)
.on(type_doctype.name == dynamic_link.parent)
.select(type_doctype.name)
.where(
(dynamic_link.link_name == supplier)
& (dynamic_link.link_doctype == "Supplier")
& (contact.name.like(f"%{txt}%"))
& (type_doctype.name.like(f"%{txt}%"))
)
).run(as_dict=False)
)
if type == "Contact":
query = query.select(type_doctype.email_id)
return query.run()

View File

@@ -1,29 +1,34 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-06-13 18:45:01",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2018-02-21 01:28:37.416562",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Trends",
"owner": "Administrator",
"ref_doctype": "Purchase Order",
"report_name": "Purchase Order Trends",
"report_type": "Script Report",
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-06-13 18:45:01",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-11-05 11:55:50.058154",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Trends",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Purchase Order",
"report_name": "Purchase Order Trends",
"report_type": "Script Report",
"roles": [
{
"role": "Stock User"
},
},
{
"role": "Purchase Manager"
},
},
{
"role": "Purchase User"
}
]
}
],
"timeout": 0
}

View File

@@ -39,6 +39,8 @@ from erpnext.accounts.doctype.pricing_rule.utils import (
)
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
from erpnext.accounts.party import (
PURCHASE_TRANSACTION_TYPES,
SALES_TRANSACTION_TYPES,
get_party_account,
get_party_account_currency,
get_party_gle_currency,
@@ -2918,6 +2920,104 @@ class AccountsController(TransactionBase):
x["transaction_currency"] = self.currency
x["transaction_exchange_rate"] = self.get("conversion_rate") or 1
def after_mapping(self, source_doc):
self.set_discount_amount_after_mapping(source_doc)
def set_discount_amount_after_mapping(self, source_doc):
"""
Ensures that Additional Discount Amount is not copied repeatedly
for multiple mappings of a single source transaction.
"""
# source and target doctypes should both be buying / selling
for transaction_types in (PURCHASE_TRANSACTION_TYPES, SALES_TRANSACTION_TYPES):
if self.doctype in transaction_types and source_doc.doctype in transaction_types:
break
else:
return
# ensure both doctypes have discount_amount field
if not self.meta.get_field("discount_amount") or not source_doc.meta.get_field("discount_amount"):
return
# ensure discount_amount is set in source doc
if not source_doc.discount_amount:
return
# ensure additional_discount_percentage is not set in the source doc
if source_doc.get("additional_discount_percentage"):
return
item_doctype = self.meta.get_field("items").options
doctype_table = frappe.qb.DocType(self.doctype)
item_table = frappe.qb.DocType(item_doctype)
is_same_doctype = self.doctype == source_doc.doctype
is_return = self.get("is_return") and is_same_doctype
if is_same_doctype and not is_return:
# should never happen
# you don't map to the same doctype without it being a return
return
query = (
frappe.qb.from_(doctype_table)
.where(doctype_table.docstatus == 1)
.where(doctype_table.discount_amount != 0)
.select(Sum(doctype_table.discount_amount))
)
if is_return:
query = query.where(doctype_table.is_return == 1).where(
doctype_table.return_against == source_doc.name
)
else:
item_meta = frappe.get_meta(item_doctype)
reference_fieldname = next(
(
row.fieldname
for row in item_meta.fields
if row.fieldtype == "Link"
and row.options == source_doc.doctype
and not row.get("is_custom_field")
),
None,
)
if not reference_fieldname:
return
query = query.where(
doctype_table.name.isin(
frappe.qb.from_(item_table)
.select(item_table.parent)
.where(item_table[reference_fieldname] == source_doc.name)
.distinct()
)
)
result = query.run()
if not result:
return
discount_already_applied = result[0][0]
if not discount_already_applied:
return
if is_return:
# returns have negative discount
discount_already_applied *= -1
discount_amount = max(source_doc.discount_amount - discount_already_applied, 0)
if discount_amount and is_return:
discount_amount *= -1
self.discount_amount = flt(discount_amount, self.precision("discount_amount"))
self.calculate_taxes_and_totals()
@frappe.whitelist()
def get_tax_rate(account_head):

View File

@@ -13,6 +13,7 @@ from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import g
from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
from erpnext.accounts.party import get_party_details
from erpnext.buying.utils import update_last_purchase_rate, validate_for_items
from erpnext.controllers.accounts_controller import get_taxes_and_charges
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
from erpnext.controllers.subcontracting_controller import SubcontractingController
from erpnext.stock.get_item_details import get_conversion_factor
@@ -180,6 +181,12 @@ class BuyingController(SubcontractingController):
self.set_missing_item_details(for_validate)
if self.meta.get_field("taxes"):
if self.get("taxes_and_charges") and not self.get("taxes") and not for_validate:
taxes = get_taxes_and_charges("Purchase Taxes and Charges Template", self.taxes_and_charges)
for tax in taxes:
self.append("taxes", tax)
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.supplier:
for d in self.get("items"):

View File

@@ -95,6 +95,7 @@ class SellingController(StockController):
# set contact and address details for customer, if they are not mentioned
self.set_missing_lead_customer_details(for_validate=for_validate)
self.set_price_list_and_item_details(for_validate=for_validate)
self.set_company_contact_person()
def set_missing_lead_customer_details(self, for_validate=False):
customer, lead = None, None
@@ -137,6 +138,7 @@ class SellingController(StockController):
lead,
posting_date=self.get("transaction_date") or self.get("posting_date"),
company=self.company,
doctype=self.doctype,
)
)
@@ -149,6 +151,13 @@ class SellingController(StockController):
self.set_price_list_currency("Selling")
self.set_missing_item_details(for_validate=for_validate)
def set_company_contact_person(self):
"""Set the Company's Default Sales Contact as Company Contact Person."""
if self.company and self.meta.has_field("company_contact_person") and not self.company_contact_person:
self.company_contact_person = frappe.get_cached_value(
"Company", self.company, "default_sales_contact"
)
def remove_shipping_charge(self):
if self.shipping_rule:
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)

View File

@@ -93,6 +93,7 @@ status_map = {
["Draft", None],
["To Bill", "eval:self.per_billed == 0 and self.docstatus == 1"],
["Partly Billed", "eval:self.per_billed > 0 and self.per_billed < 100 and self.docstatus == 1"],
["Return", "eval:self.is_return == 1 and self.per_billed == 0 and self.docstatus == 1"],
["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"],
[
"Completed",

View File

@@ -505,7 +505,7 @@ class SubcontractingController(StockController):
if item.get("serial_and_batch_bundle"):
frappe.delete_doc("Serial and Batch Bundle", item.serial_and_batch_bundle, force=True)
def __get_materials_from_bom(self, item_code, bom_no, exploded_item=0):
def _get_materials_from_bom(self, item_code, bom_no, exploded_item=0):
doctype = "BOM Item" if not exploded_item else "BOM Explosion Item"
fields = [f"`tab{doctype}`.`stock_qty` / `tabBOM`.`quantity` as qty_consumed_per_unit"]
@@ -849,7 +849,7 @@ class SubcontractingController(StockController):
if self.doctype == self.subcontract_data.order_doctype or (
self.backflush_based_on == "BOM" or self.is_return
):
for bom_item in self.__get_materials_from_bom(
for bom_item in self._get_materials_from_bom(
row.item_code, row.bom, row.get("include_exploded_items")
):
qty = flt(bom_item.qty_consumed_per_unit) * flt(row.qty) * row.conversion_factor

View File

@@ -682,6 +682,25 @@ class calculate_taxes_and_totals:
self.doc.precision("discount_amount"),
)
discount_amount = self.doc.discount_amount or 0
grand_total = self.doc.grand_total
# validate that discount amount cannot exceed the total before discount
if (
(grand_total >= 0 and discount_amount > grand_total)
or (grand_total < 0 and discount_amount < grand_total) # returns
):
frappe.throw(
_(
"Additional Discount Amount ({discount_amount}) cannot exceed "
"the total before such discount ({total_before_discount})"
).format(
discount_amount=self.doc.get_formatted("discount_amount"),
total_before_discount=self.doc.get_formatted("grand_total"),
),
title=_("Invalid Discount Amount"),
)
def apply_discount_amount(self):
if self.doc.discount_amount:
if not self.doc.apply_discount_on:

View File

@@ -2258,3 +2258,173 @@ class TestAccountsController(FrappeTestCase):
self.assertRaises(frappe.ValidationError, si.save)
si.contact_person = customer_contact.name
si.save()
def test_discount_amount_not_mapped_repeatedly_for_sales_transactions(self):
"""
Test that additional discount amount is not copied repeatedly
when creating multiple delivery notes from a single sales order with discount_amount set
"""
from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
# Create a sales order with discount amount
so = make_sales_order(qty=10, rate=100, do_not_submit=True)
so.apply_discount_on = "Net Total"
so.discount_amount = 100
so.save()
so.submit()
# Create first delivery note from sales order (partial qty)
dn1 = make_delivery_note(so.name)
dn1.items[0].qty = 5
dn1.save()
dn1.submit()
# First delivery note should have full discount amount
self.assertEqual(dn1.discount_amount, 100)
self.assertEqual(dn1.grand_total, 400)
# Create second delivery note from the same sales order (remaining qty)
dn2 = make_delivery_note(so.name)
dn2.items[0].qty = 5
dn2.save()
dn2.submit()
# Second delivery note should have discount_amount set to 0
# because discount was already fully applied in first delivery note
self.assertEqual(dn2.discount_amount, 0)
self.assertEqual(dn2.grand_total, 500)
def test_discount_amount_not_mapped_repeatedly_for_purchase_transactions(self):
"""
Test that additional discount amount is not copied repeatedly
when creating multiple purchase receipts from a single purchase order with discount_amount set
"""
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
# Create a purchase order with discount amount
po = create_purchase_order(qty=10, rate=100, do_not_submit=True)
po.apply_discount_on = "Net Total"
po.discount_amount = 100
po.save()
po.submit()
# Create first purchase receipt from purchase order (partial qty)
pr1 = make_purchase_receipt(po.name)
pr1.items[0].qty = 5
pr1.save()
pr1.submit()
# First purchase receipt should have full discount amount
self.assertEqual(pr1.discount_amount, 100)
self.assertEqual(pr1.grand_total, 400)
# Create second purchase receipt from the same purchase order (remaining qty)
pr2 = make_purchase_receipt(po.name)
pr2.items[0].qty = 5
pr2.save()
pr2.submit()
# Second purchase receipt should have discount_amount set to 0
# because discount was already fully applied in first purchase receipt
self.assertEqual(pr2.discount_amount, 0)
self.assertEqual(pr2.grand_total, 500)
def test_discount_amount_partial_application_in_mapped_transactions(self):
"""
Test that discount amount is partially applied when some discount
has already been used in previous mapped transactions
"""
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
# Create a sales order with discount amount
so = make_sales_order(qty=10, rate=100, do_not_submit=True)
so.apply_discount_on = "Net Total"
so.discount_amount = 200
so.save()
so.submit()
self.assertEqual(so.discount_amount, 200)
self.assertEqual(so.grand_total, 800)
# Create first invoice with partial discount (manually set lower discount)
si1 = make_sales_invoice(so.name)
si1.items[0].qty = 5
si1.discount_amount = 50 # Partial discount application
si1.save()
si1.submit()
self.assertEqual(si1.discount_amount, 50)
self.assertEqual(si1.grand_total, 450)
# Create second invoice from the same sales order
si2 = make_sales_invoice(so.name)
si2.items[0].qty = 5
si2.save()
si2.submit()
# Second invoice should have remaining discount (200 - 50 = 150)
self.assertEqual(si2.discount_amount, 150)
self.assertEqual(si2.grand_total, 350)
def test_discount_amount_not_mapped_when_percentage_is_set(self):
"""
Test that discount amount is not adjusted when additional_discount_percentage
is set in the source document (as it will be recalculated based on percentage)
"""
from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
# Create a sales order with discount percentage instead of amount
so = make_sales_order(qty=10, rate=100, do_not_submit=True)
so.apply_discount_on = "Net Total"
so.additional_discount_percentage = 10 # 10% discount
so.save()
so.submit()
self.assertEqual(so.discount_amount, 100) # 10% of 1000
self.assertEqual(so.grand_total, 900)
# Create delivery note from sales order
dn = make_delivery_note(so.name)
dn.items[0].qty = 5
dn.save()
# Delivery note should have discount amount recalculated based on percentage
# and not affected by the repeated mapping logic
self.assertEqual(dn.additional_discount_percentage, 10)
self.assertEqual(dn.discount_amount, 50) # 10% of 500
def test_discount_amount_for_multiple_returns(self):
"""
Test that discount amount is correctly adjusted when multiple return invoices
are created against the same original invoice to prevent over-returning discount
"""
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return
# Create original sales invoice with discount
si = create_sales_invoice(qty=10, rate=100, do_not_submit=True)
si.apply_discount_on = "Net Total"
si.discount_amount = 100
si.save()
si.submit()
# Create first return - Frappe will copy full discount by default, we need to adjust it
return_si_1 = make_sales_return(si.name)
return_si_1.items[0].qty = -6 # Return 6 out of 10 items
# Manually set discount to match the proportion (60% of discount)
return_si_1.discount_amount = -60
return_si_1.save()
return_si_1.submit()
self.assertEqual(return_si_1.discount_amount, -60)
# Create second return for remaining items
return_si_2 = make_sales_return(si.name)
return_si_2.items[0].qty = -4 # Return remaining 4 out of 10 items
return_si_2.save()
# Second return should only get remaining discount (100 - 60 = 40)
self.assertEqual(return_si_2.discount_amount, -40)

View File

@@ -191,6 +191,9 @@ def get_data(filters, conditions):
des[j + inc] = row1[0][j]
data.append(des)
total_row = calculate_total_row(data1, conditions["columns"])
data.append(total_row)
else:
data = frappe.db.sql(
""" select {} from `tab{}` t1, `tab{} Item` t2 {}
@@ -214,9 +217,32 @@ def get_data(filters, conditions):
as_list=1,
)
total_row = calculate_total_row(data, conditions["columns"])
data.append(total_row)
return data
def calculate_total_row(data, columns):
def wrap_in_quotes(label):
return f"'{label}'"
total_values = {}
for i, col in enumerate(columns):
if "Float" in col or "Currency/currency" in col:
total_values[i] = 0
for row in data:
for i in total_values.keys():
total_values[i] += row[i] if row[i] is not None else 0
total_row = [wrap_in_quotes(_("Total"))]
for i in range(1, len(columns)):
total_row.append(total_values.get(i, None))
return total_row
def get_mon(dt):
return getdate(dt).strftime("%b")

View File

@@ -432,7 +432,7 @@ def _set_missing_values(source, target):
@frappe.whitelist()
def get_lead_details(lead, posting_date=None, company=None):
def get_lead_details(lead, posting_date=None, company=None, doctype=None):
if not lead:
return {}
@@ -454,7 +454,7 @@ def get_lead_details(lead, posting_date=None, company=None):
}
)
set_address_details(out, lead, "Lead", company=company)
set_address_details(out, lead, "Lead", doctype=doctype, company=company)
taxes_and_charges = set_taxes(
None,

View File

@@ -548,12 +548,14 @@
{
"fieldname": "process_loss_percentage",
"fieldtype": "Percent",
"label": "% Process Loss"
"label": "% Process Loss",
"non_negative": 1
},
{
"fieldname": "process_loss_qty",
"fieldtype": "Float",
"label": "Process Loss Qty",
"non_negative": 1,
"read_only": 1
},
{
@@ -591,7 +593,6 @@
},
{
"default": "0",
"depends_on": "eval:doc.track_semi_finished_goods === 0",
"fieldname": "fg_based_operating_cost",
"fieldtype": "Check",
"label": "Finished Goods based Operating Cost"
@@ -640,7 +641,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2025-10-29 17:43:12.966753",
"modified": "2025-11-19 16:17:15.925156",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",

View File

@@ -465,7 +465,7 @@ class BOM(WebsiteGenerator):
)
)
def get_rm_rate(self, arg):
def get_rm_rate(self, arg, notify=True):
"""Get raw material rate as per selected method, if bom exists takes bom cost"""
rate = 0
if not self.rm_cost_as_per:
@@ -491,7 +491,7 @@ class BOM(WebsiteGenerator):
),
alert=True,
)
else:
elif notify:
frappe.msgprint(
_("{0} not found for item {1}").format(self.rm_cost_as_per, arg["item_code"]),
alert=True,
@@ -796,11 +796,14 @@ class BOM(WebsiteGenerator):
"stock_uom": d.stock_uom,
"conversion_factor": d.conversion_factor,
"sourced_by_supplier": d.sourced_by_supplier,
}
},
notify=False,
)
d.base_rate = flt(d.rate) * flt(self.conversion_rate)
d.amount = flt(d.rate, d.precision("rate")) * flt(d.qty, d.precision("qty"))
d.amount = flt(
flt(d.rate, d.precision("rate")) * flt(d.qty, d.precision("qty")), d.precision("amount")
)
d.base_amount = d.amount * flt(self.conversion_rate)
d.qty_consumed_per_unit = flt(d.stock_qty, d.precision("stock_qty")) / flt(
self.quantity, self.precision("quantity")
@@ -823,7 +826,10 @@ class BOM(WebsiteGenerator):
d.base_rate = flt(d.rate, d.precision("rate")) * flt(
self.conversion_rate, self.precision("conversion_rate")
)
d.amount = flt(d.rate, d.precision("rate")) * flt(d.stock_qty, d.precision("stock_qty"))
d.amount = flt(
flt(d.rate, d.precision("rate")) * flt(d.stock_qty, d.precision("stock_qty")),
d.precision("amount"),
)
d.base_amount = flt(d.amount, d.precision("amount")) * flt(
self.conversion_rate, self.precision("conversion_rate")
)

View File

@@ -38,6 +38,15 @@ frappe.ui.form.on("Job Card", {
return doc.status === "Complete" ? "green" : "orange";
}
});
frm.set_query("employee", () => {
return {
filters: {
company: frm.doc.company,
status: "Active",
},
};
});
},
refresh: function (frm) {

View File

@@ -151,10 +151,9 @@ def get_column(filters):
},
{
"label": _("Document Type"),
"fieldtype": "Link",
"fieldtype": "Data",
"fieldname": "document_type",
"width": 150,
"options": "DocType",
},
{
"label": _("Document Name"),

View File

@@ -318,7 +318,7 @@
"type": "Link"
}
],
"modified": "2024-10-21 14:13:38.777556",
"modified": "2025-11-24 11:11:28.343568",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing",
@@ -336,7 +336,7 @@
"doc_view": "List",
"label": "Learn Manufacturing",
"type": "URL",
"url": "https://school.frappe.io/lms/courses/manufacturing?utm_source=in_app"
"url": "https://school.frappe.io/lms/courses/production-planning-and-execution"
},
{
"color": "Grey",

View File

@@ -424,3 +424,6 @@ erpnext.patches.v15_0.update_uae_zero_rated_fetch
erpnext.patches.v15_0.update_fieldname_in_accounting_dimension_filter
erpnext.patches.v15_0.set_asset_status_if_not_already_set
erpnext.patches.v15_0.toggle_legacy_controller_for_period_closing
execute:frappe.db.set_single_value("Accounts Settings", "show_party_balance", 1)
execute:frappe.db.set_single_value("Accounts Settings", "show_account_balance", 1)
erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter

View File

@@ -0,0 +1,12 @@
import frappe
def execute():
settings = frappe.get_doc("Currency Exchange Settings")
if settings.service_provider != "frankfurter.app":
return
settings.service_provider = "frankfurter.dev"
settings.set_parameters_and_result()
settings.flags.ignore_validate = True
settings.save()

View File

@@ -17,6 +17,10 @@ class CircularReferenceError(frappe.ValidationError):
pass
class ParentIsGroupError(frappe.ValidationError):
pass
class Task(NestedSet):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
@@ -83,6 +87,7 @@ class Task(NestedSet):
self.update_depends_on()
self.validate_dependencies_for_template_task()
self.validate_completed_on()
self.validate_parent_is_group()
def validate_dates(self):
self.validate_from_to_dates("exp_start_date", "exp_end_date")
@@ -153,20 +158,36 @@ class Task(NestedSet):
def validate_parent_template_task(self):
if self.parent_task:
if not frappe.db.get_value("Task", self.parent_task, "is_template"):
parent_task_format = f"""<a href="/app/task/{self.parent_task}">{self.parent_task}</a>"""
frappe.throw(_("Parent Task {0} is not a Template Task").format(parent_task_format))
frappe.throw(
_("Parent Task {0} is not a Template Task").format(
get_link_to_form("Task", self.parent_task)
)
)
def validate_depends_on_tasks(self):
if self.depends_on:
for task in self.depends_on:
if not frappe.db.get_value("Task", task.task, "is_template"):
dependent_task_format = f"""<a href="/app/task/{task.task}">{task.task}</a>"""
frappe.throw(_("Dependent Task {0} is not a Template Task").format(dependent_task_format))
frappe.throw(
_("Dependent Task {0} is not a Template Task").format(
get_link_to_form("Task", task.task)
)
)
def validate_completed_on(self):
if self.completed_on and getdate(self.completed_on) > getdate():
frappe.throw(_("Completed On cannot be greater than Today"))
def validate_parent_is_group(self):
if self.parent_task:
if not frappe.db.get_value("Task", self.parent_task, "is_group"):
frappe.throw(
_("Parent Task {0} must be a Group Task").format(
get_link_to_form("Task", self.parent_task)
),
ParentIsGroupError,
)
def update_depends_on(self):
depends_on_tasks = ""
for d in self.depends_on:

View File

@@ -6,7 +6,7 @@ import unittest
import frappe
from frappe.utils import add_days, getdate, nowdate
from erpnext.projects.doctype.task.task import CircularReferenceError
from erpnext.projects.doctype.task.task import CircularReferenceError, ParentIsGroupError
class TestTask(unittest.TestCase):
@@ -109,6 +109,20 @@ class TestTask(unittest.TestCase):
self.assertEqual(frappe.db.get_value("Task", task.name, "status"), "Overdue")
def test_parent_task_must_be_group(self):
parent_task = create_task(
subject="_Test Parent Task Non Group",
is_group=0,
)
child_task = create_task(
subject="_Test Child Task",
parent_task=parent_task.name,
save=False,
)
self.assertRaises(ParentIsGroupError, child_task.save)
def create_task(
subject,

View File

@@ -21,6 +21,7 @@ frappe.ui.form.on("Timesheet", {
filters: {
project: child.project,
status: ["!=", "Cancelled"],
is_group: 0,
},
};
};

View File

@@ -285,7 +285,7 @@ class Timesheet(Document):
if data.activity_type or data.is_billable:
rate = get_activity_cost(self.employee, data.activity_type)
hours = data.billing_hours or 0
costing_hours = data.billing_hours or data.hours or 0
costing_hours = data.hours or 0
if rate:
data.billing_rate = (
flt(rate.get("billing_rate")) if flt(data.billing_rate) == 0 else data.billing_rate

View File

@@ -2,7 +2,6 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.buying");
// cur_frm.add_fetch('project', 'cost_center', 'cost_center');
erpnext.buying = {
setup_buying_controller: function() {
@@ -11,6 +10,7 @@ erpnext.buying = {
super.setup();
this.toggle_enable_for_stock_uom("allow_to_edit_stock_uom_qty_for_purchase");
this.frm.email_field = "contact_email";
this.frm.add_fetch("project", "cost_center", "cost_center");
}
onload(doc, cdt, cdn) {
@@ -171,15 +171,13 @@ erpnext.buying = {
shipping_address: this.frm.doc.shipping_address
},
callback: (r) => {
if (!this.frm.doc.billing_address)
this.frm.set_value("billing_address", r.message.primary_address || "");
if (!r.message) return;
if (
!frappe.meta.has_field(this.frm.doc.doctype, "shipping_address") ||
this.frm.doc.shipping_address
)
return;
this.frm.set_value("shipping_address", r.message.shipping_address || "");
this.frm.set_value("billing_address", r.message.primary_address || "");
if (frappe.meta.has_field(this.frm.doc.doctype, "shipping_address")) {
this.frm.set_value("shipping_address", r.message.shipping_address || "");
}
},
});
erpnext.utils.set_letter_head(this.frm)

View File

@@ -558,6 +558,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
item.weight_per_unit = 0;
item.weight_uom = '';
item.uom = null // make UOM blank to update the existing UOM when item changes
item.conversion_factor = 0;
if(['Sales Invoice', 'Purchase Invoice'].includes(this.frm.doc.doctype)) {
@@ -2748,6 +2749,23 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
]);
}
}
setup_accounting_dimension_triggers() {
frappe.call({
method: "erpnext.accounts.doctype.accounting_dimension.accounting_dimension.get_dimensions",
callback: function (r) {
if (r.message && r.message[0]) {
let dimensions = r.message[0].map((d) => d.fieldname);
dimensions.forEach((dim) => {
// nosemgrep: frappe-semgrep-rules.rules.frappe-cur-frm-usage
cur_frm.cscript[dim] = function (doc, cdt, cdn) {
erpnext.utils.copy_value_in_all_rows(doc, cdt, cdn, "items", dim);
};
});
}
},
});
}
};
erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close, show_dialog) {

View File

@@ -79,18 +79,35 @@ erpnext.financial_statements = {
},
open_general_ledger: function (data) {
if (!data.account && !data.accounts) return;
let project = $.grep(frappe.query_report.filters, function (e) {
let filters = frappe.query_report.filters;
let project = $.grep(filters, function (e) {
return e.df.fieldname == "project";
});
let cost_center = $.grep(filters, function (e) {
return e.df.fieldname == "cost_center";
});
frappe.route_options = {
account: data.account || data.accounts,
company: frappe.query_report.get_filter_value("company"),
from_date: data.from_date || data.year_start_date,
to_date: data.to_date || data.year_end_date,
project: project && project.length > 0 ? project[0].$input.val() : "",
project: project && project.length > 0 ? project[0].get_value() : "",
cost_center: cost_center && cost_center.length > 0 ? cost_center[0].get_value() : "",
};
filters.forEach((f) => {
if (f.df.fieldtype == "MultiSelectList") {
if (f.df.fieldname in frappe.route_options) return;
let value = f.get_value();
if (value && value.length > 0) {
frappe.route_options[f.df.fieldname] = value;
}
}
});
let report = "General Ledger";
if (["Payable", "Receivable"].includes(data.account_type)) {

View File

@@ -420,25 +420,36 @@ $.extend(erpnext.utils, {
if (!frappe.boot.setup_complete) {
return;
}
const today = frappe.datetime.get_today();
if (!date) {
date = frappe.datetime.get_today();
date = today;
}
let fiscal_year = "";
frappe.call({
method: "erpnext.accounts.utils.get_fiscal_year",
args: {
date: date,
boolean: boolean,
},
async: false,
callback: function (r) {
if (r.message) {
if (with_dates) fiscal_year = r.message;
else fiscal_year = r.message[0];
}
},
});
if (
frappe.boot.current_fiscal_year &&
date >= frappe.boot.current_fiscal_year[1] &&
date <= frappe.boot.current_fiscal_year[2]
) {
if (with_dates) fiscal_year = frappe.boot.current_fiscal_year;
else fiscal_year = frappe.boot.current_fiscal_year[0];
} else if (today != date) {
frappe.call({
method: "erpnext.accounts.utils.get_fiscal_year",
type: "GET", // make it cacheable
args: {
date: date,
boolean: boolean,
},
async: false,
callback: function (r) {
if (r.message) {
if (with_dates) fiscal_year = r.message;
else fiscal_year = r.message[0];
}
},
});
}
return fiscal_year;
},

View File

@@ -16,11 +16,13 @@ frappe.ui.form.ContactAddressQuickEntryForm = class ContactAddressQuickEntryForm
insert() {
/**
* Using alias fieldnames because the doctype definition define "email_id" and "mobile_no" as readonly fields.
* Therefor, resulting in the fields being "hidden".
* This results in the fields being "hidden".
*/
const map_field_names = {
email_address: "email_id",
mobile_number: "mobile_no",
map_to_first_name: "first_name",
map_to_last_name: "last_name",
};
Object.entries(map_field_names).forEach(([fieldname, new_fieldname]) => {
@@ -38,15 +40,27 @@ frappe.ui.form.ContactAddressQuickEntryForm = class ContactAddressQuickEntryForm
label: __("Primary Contact Details"),
collapsible: 1,
},
{
label: __("First Name"),
fieldname: "map_to_first_name",
fieldtype: "Data",
depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'",
},
{
label: __("Last Name"),
fieldname: "map_to_last_name",
fieldtype: "Data",
depends_on: "eval:doc.customer_type=='Company' || doc.supplier_type=='Company'",
},
{
fieldtype: "Column Break",
},
{
label: __("Email Id"),
fieldname: "email_address",
fieldtype: "Data",
options: "Email",
},
{
fieldtype: "Column Break",
},
{
label: __("Mobile Number"),
fieldname: "mobile_number",

View File

@@ -115,6 +115,10 @@ erpnext.sales_common = {
company() {
super.company();
this.set_default_company_address();
if (!this.is_onload) {
// we don't want to override the mapped contact from prevdoc
this.set_default_company_contact_person();
}
}
set_default_company_address() {
@@ -139,6 +143,24 @@ erpnext.sales_common = {
}
}
set_default_company_contact_person() {
if (!frappe.meta.has_field(this.frm.doc.doctype, "company_contact_person")) {
return;
}
if (this.frm.doc.company) {
frappe.db
.get_value("Company", this.frm.doc.company, "default_sales_contact")
.then((r) => {
if (r.message?.default_sales_contact) {
this.frm.set_value("company_contact_person", r.message.default_sales_contact);
} else {
this.frm.set_value("company_contact_person", "");
}
});
}
}
customer() {
var me = this;
erpnext.utils.get_party_details(this.frm, null, null, function () {

View File

@@ -55,17 +55,20 @@ frappe.ui.form.on("Customer", {
frm.set_query("customer_primary_contact", function (doc) {
return {
query: "erpnext.selling.doctype.customer.customer.get_customer_primary_contact",
query: "erpnext.selling.doctype.customer.customer.get_customer_primary",
filters: {
customer: doc.name,
type: "Contact",
},
};
});
frm.set_query("customer_primary_address", function (doc) {
return {
query: "erpnext.selling.doctype.customer.customer.get_customer_primary",
filters: {
link_doctype: "Customer",
link_name: doc.name,
customer: doc.name,
type: "Address",
},
};
});

View File

@@ -56,6 +56,8 @@
"customer_primary_contact",
"mobile_no",
"email_id",
"first_name",
"last_name",
"tax_tab",
"taxation_section",
"tax_id",
@@ -581,6 +583,20 @@
"no_copy": 1,
"options": "Prospect",
"print_hide": 1
},
{
"fetch_from": "customer_primary_contact.first_name",
"fieldname": "first_name",
"fieldtype": "Read Only",
"hidden": 1,
"label": "First Name"
},
{
"fetch_from": "customer_primary_contact.last_name",
"fieldname": "last_name",
"fieldtype": "Read Only",
"hidden": 1,
"label": "Last Name"
}
],
"icon": "fa fa-user",
@@ -594,7 +610,7 @@
"link_fieldname": "party"
}
],
"modified": "2024-06-17 03:24:59.612974",
"modified": "2025-11-25 09:35:56.772949",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
@@ -672,6 +688,7 @@
}
],
"quick_entry": 1,
"row_format": "Dynamic",
"search_fields": "customer_group,territory, mobile_no,primary_address",
"show_name_in_global_search": 1,
"sort_field": "modified",

View File

@@ -61,12 +61,14 @@ class Customer(TransactionBase):
disabled: DF.Check
dn_required: DF.Check
email_id: DF.ReadOnly | None
first_name: DF.ReadOnly | None
gender: DF.Link | None
image: DF.AttachImage | None
industry: DF.Link | None
is_frozen: DF.Check
is_internal_customer: DF.Check
language: DF.Link | None
last_name: DF.ReadOnly | None
lead_name: DF.Link | None
loyalty_program: DF.Link | None
loyalty_program_tier: DF.Data | None
@@ -230,7 +232,7 @@ class Customer(TransactionBase):
self.update_lead_status()
if self.flags.is_new_doc:
self.link_lead_address_and_contact()
self.link_address_and_contact()
self.copy_communication()
self.update_customer_groups()
@@ -248,7 +250,7 @@ class Customer(TransactionBase):
def create_primary_contact(self):
if not self.customer_primary_contact and not self.lead_name:
if self.mobile_no or self.email_id:
if self.mobile_no or self.email_id or self.first_name or self.last_name:
contact = make_contact(self)
self.db_set("customer_primary_contact", contact.name)
self.db_set("mobile_no", self.mobile_no)
@@ -270,15 +272,23 @@ class Customer(TransactionBase):
if self.lead_name:
frappe.db.set_value("Lead", self.lead_name, "status", "Converted")
def link_lead_address_and_contact(self):
if self.lead_name:
# assign lead address and contact to customer (if already not set)
def link_address_and_contact(self):
linked_documents = {
"Lead": self.lead_name,
"Opportunity": self.opportunity_name,
"Prospect": self.prospect_name,
}
for doctype, docname in linked_documents.items():
# assign lead, opportunity and prospect address and contact to customer (if already not set)
if not docname:
continue
linked_contacts_and_addresses = frappe.get_all(
"Dynamic Link",
filters=[
["parenttype", "in", ["Contact", "Address"]],
["link_doctype", "=", "Lead"],
["link_name", "=", self.lead_name],
["link_doctype", "=", doctype],
["link_name", "=", docname],
],
fields=["parent as name", "parenttype as doctype"],
)
@@ -736,6 +746,10 @@ def make_contact(args, is_primary_contact=1):
contact.add_email(args.get("email_id"), is_primary=True)
if args.get("mobile_no"):
contact.add_phone(args.get("mobile_no"), is_primary_mobile_no=True)
if args.get("first_name"):
contact.first_name = args.get("first_name")
if args.get("last_name"):
contact.last_name = args.get("last_name")
if flags := args.get("flags"):
contact.insert(ignore_permissions=flags.get("ignore_permissions"))
@@ -786,21 +800,29 @@ def make_address(args, is_primary_address=1, is_shipping_address=1):
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_customer_primary_contact(doctype, txt, searchfield, start, page_len, filters):
def get_customer_primary(doctype, txt, searchfield, start, page_len, filters):
customer = filters.get("customer")
con = qb.DocType("Contact")
type = filters.get("type")
type_doctype = qb.DocType(type)
dlink = qb.DocType("Dynamic Link")
return (
qb.from_(con)
query = (
qb.from_(type_doctype)
.join(dlink)
.on(con.name == dlink.parent)
.select(con.name, con.email_id)
.where((dlink.link_name == customer) & (con.name.like(f"%{txt}%")))
.run()
.on(type_doctype.name == dlink.parent)
.select(type_doctype.name)
.where(
(dlink.link_name == customer)
& (type_doctype.name.like(f"%{txt}%"))
& (dlink.link_doctype == "Customer")
)
)
if type == "Contact":
query = query.select(type_doctype.email_id)
return query.run()
def parse_full_name(full_name: str) -> tuple[str, str | None, str | None]:
"""Parse full name into first name, middle name and last name"""

View File

@@ -252,6 +252,7 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext.
lead: this.frm.doc.party_name,
posting_date: this.frm.doc.transaction_date,
company: this.frm.doc.company,
doctype: this.frm.doc.doctype,
},
callback: function (r) {
if (r.message) {

View File

@@ -574,6 +574,9 @@ frappe.ui.form.on("Sales Order Item", {
});
erpnext.selling.SalesOrderController = class SalesOrderController extends erpnext.selling.SellingController {
setup() {
this.setup_accounting_dimension_triggers();
}
onload(doc, dt, dn) {
super.onload(doc, dt, dn);
}
@@ -1179,7 +1182,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
make_purchase_order() {
let pending_items = this.frm.doc.items.some((item) => {
let pending_qty = flt(item.stock_qty) - flt(item.ordered_qty);
const pending_qty = flt(item.stock_qty) - this.get_ordered_qty(item, this.frm.doc);
return pending_qty > 0;
});
if (!pending_items) {
@@ -1333,8 +1336,10 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
// calculate ordered qty based on packed items in case of product bundle
let packed_items = so.packed_items.filter((pi) => pi.parent_detail_docname == item.name);
if (packed_items && packed_items.length) {
ordered_qty = packed_items.reduce((sum, pi) => sum + flt(pi.ordered_qty), 0);
ordered_qty = ordered_qty / packed_items.length;
const all_packed_items_ordered = packed_items.every(
(pi) => flt(pi.ordered_qty) >= flt(pi.qty)
);
ordered_qty = all_packed_items_ordered ? item.stock_qty : 0;
}
}
return ordered_qty;

View File

@@ -1465,7 +1465,8 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t
"pricing_rules",
],
"postprocess": update_item_for_packed_item,
"condition": lambda doc: doc.parent_item in items_to_map,
"condition": lambda doc: doc.parent_item in items_to_map
and flt(doc.ordered_qty) < flt(doc.qty),
},
},
target_doc,
@@ -1603,7 +1604,8 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
"pricing_rules",
],
"postprocess": update_item_for_packed_item,
"condition": lambda doc: doc.parent_item in items_to_map,
"condition": lambda doc: doc.parent_item in items_to_map
and flt(doc.ordered_qty) < flt(doc.qty),
},
},
target_doc,

View File

@@ -55,7 +55,7 @@ def search_by_term(search_term, warehouse, price_list):
}
)
item_stock_qty, is_stock_item = get_stock_availability(item_code, warehouse)
item_stock_qty, is_stock_item, is_negative_stock_allowed = get_stock_availability(item_code, warehouse)
item_stock_qty = item_stock_qty // item.get("conversion_factor", 1)
item.update({"actual_qty": item_stock_qty})
@@ -198,7 +198,7 @@ def get_items(start, page_length, price_list, item_group, pos_profile, search_te
current_date = frappe.utils.today()
for item in items_data:
item.actual_qty, _ = get_stock_availability(item.item_code, warehouse)
item.actual_qty, _, is_negative_stock_allowed = get_stock_availability(item.item_code, warehouse)
item_prices = frappe.get_all(
"Item Price",

View File

@@ -759,12 +759,16 @@ erpnext.PointOfSale.Controller = class {
const resp = (await this.get_available_stock(item_row.item_code, warehouse)).message;
const available_qty = resp[0];
const is_stock_item = resp[1];
const is_negative_stock_allowed = resp[2];
frappe.dom.unfreeze();
const bold_uom = item_row.stock_uom.bold();
const bold_item_code = item_row.item_code.bold();
const bold_warehouse = warehouse.bold();
const bold_available_qty = available_qty.toString().bold();
if (is_negative_stock_allowed) return;
if (!(available_qty > 0)) {
if (is_stock_item) {
frappe.model.clear_doc(item_row.doctype, item_row.name);

View File

@@ -1,32 +1,37 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-06-07 16:01:16",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2018-02-21 01:28:14.928929",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Trends",
"owner": "Administrator",
"ref_doctype": "Quotation",
"report_name": "Quotation Trends",
"report_type": "Script Report",
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-06-07 16:01:16",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-11-05 11:55:50.127020",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Trends",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Quotation",
"report_name": "Quotation Trends",
"report_type": "Script Report",
"roles": [
{
"role": "Sales User"
},
},
{
"role": "Sales Manager"
},
},
{
"role": "Maintenance Manager"
},
},
{
"role": "Maintenance User"
}
]
}
],
"timeout": 0
}

View File

@@ -1,35 +1,40 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-06-13 18:43:30",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 3,
"is_standard": "Yes",
"modified": "2018-02-20 08:05:46.191588",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Trends",
"owner": "Administrator",
"ref_doctype": "Sales Order",
"report_name": "Sales Order Trends",
"report_type": "Script Report",
"add_total_row": 0,
"add_translate_data": 0,
"columns": [],
"creation": "2013-06-13 18:43:30",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 3,
"is_standard": "Yes",
"letterhead": null,
"modified": "2025-11-05 11:55:50.096303",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Trends",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Sales Order",
"report_name": "Sales Order Trends",
"report_type": "Script Report",
"roles": [
{
"role": "Sales User"
},
},
{
"role": "Sales Manager"
},
},
{
"role": "Maintenance User"
},
},
{
"role": "Accounts User"
},
},
{
"role": "Stock User"
}
]
}
],
"timeout": 0
}

View File

@@ -37,6 +37,13 @@ frappe.ui.form.on("Company", {
return { filters: { selling: 1 } };
});
frm.set_query("default_sales_contact", function (doc) {
return {
query: "frappe.contacts.doctype.contact.contact.contact_query",
filters: { link_doctype: "Company", link_name: doc.name },
};
});
frm.set_query("default_buying_terms", function () {
return { filters: { buying: 1 } };
});
@@ -50,6 +57,15 @@ frappe.ui.form.on("Company", {
},
};
});
frm.set_query("default_warehouse_for_sales_return", function () {
return {
filters: {
company: frm.doc.name,
is_group: 0,
},
};
});
},
company_name: function (frm) {

View File

@@ -103,6 +103,7 @@
"total_monthly_sales",
"column_break_goals",
"default_selling_terms",
"default_sales_contact",
"default_warehouse_for_sales_return",
"credit_limit",
"transactions_annual_history",
@@ -851,6 +852,12 @@
"fieldtype": "Select",
"label": "Reconciliation Takes Effect On",
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
},
{
"fieldname": "default_sales_contact",
"fieldtype": "Link",
"label": "Default Sales Contact",
"options": "Contact"
}
],
"icon": "fa fa-building",
@@ -858,7 +865,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2025-08-25 18:34:03.602046",
"modified": "2025-11-16 16:51:27.624096",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@@ -66,6 +66,7 @@ class Company(NestedSet):
default_payable_account: DF.Link | None
default_provisional_account: DF.Link | None
default_receivable_account: DF.Link | None
default_sales_contact: DF.Link | None
default_selling_terms: DF.Link | None
default_warehouse_for_sales_return: DF.Link | None
depreciation_cost_center: DF.Link | None

View File

@@ -68,9 +68,9 @@ def patched_requests_get(*args, **kwargs):
if kwargs["params"].get("date") and kwargs["params"].get("from") and kwargs["params"].get("to"):
if test_exchange_values.get(kwargs["params"]["date"]):
return PatchResponse({"result": test_exchange_values[kwargs["params"]["date"]]}, 200)
elif args[0].startswith("https://api.frankfurter.app") and kwargs.get("params"):
elif args[0].startswith("https://api.frankfurter.dev") and kwargs.get("params"):
if kwargs["params"].get("base") and kwargs["params"].get("symbols"):
date = args[0].replace("https://api.frankfurter.app/", "")
date = args[0].replace("https://api.frankfurter.dev/v1/", "")
if test_exchange_values.get(date):
return PatchResponse(
{"rates": {kwargs["params"].get("symbols"): test_exchange_values.get(date)}}, 200
@@ -149,7 +149,7 @@ class TestCurrencyExchange(unittest.TestCase):
self.assertEqual(flt(exchange_rate, 3), 65.1)
settings = frappe.get_single("Currency Exchange Settings")
settings.service_provider = "frankfurter.app"
settings.service_provider = "frankfurter.dev"
settings.save()
def test_exchange_rate_strict(self, mock_get):

View File

@@ -474,6 +474,7 @@ def get_doctypes_to_be_ignored():
"Item Default",
"Customer",
"Supplier",
"Department",
]
doctypes_to_be_ignored.extend(frappe.get_hooks("company_data_to_be_ignored") or [])

View File

@@ -93,7 +93,7 @@ def setup_currency_exchange():
ces.set("result_key", [])
ces.set("req_params", [])
ces.api_endpoint = "https://api.frankfurter.app/{transaction_date}"
ces.api_endpoint = "https://api.frankfurter.dev/v1/{transaction_date}"
ces.append("result_key", {"key": "rates"})
ces.append("result_key", {"key": "{to_currency}"})
ces.append("req_params", {"key": "base", "value": "{from_currency}"})

View File

@@ -3,8 +3,11 @@
import frappe
from frappe.defaults import get_user_default
from frappe.utils import cint
from erpnext.accounts.utils import get_fiscal_years
def boot_session(bootinfo):
"""boot session - send website info if guest"""
@@ -53,6 +56,11 @@ def boot_session(bootinfo):
)
party_account_types = frappe.db.sql(""" select name, ifnull(account_type, '') from `tabParty Type`""")
fiscal_year = get_fiscal_years(
frappe.utils.nowdate(), company=get_user_default("company"), boolean=True
)
if fiscal_year:
bootinfo.current_fiscal_year = fiscal_year[0]
bootinfo.party_account_types = frappe._dict(party_account_types)
bootinfo.sysdefaults.demo_company = frappe.db.get_single_value("Global Defaults", "demo_company")

View File

@@ -140,6 +140,7 @@ erpnext.stock.DeliveryNoteController = class DeliveryNoteController extends (
erpnext.selling.SellingController
) {
setup(doc) {
this.setup_accounting_dimension_triggers();
this.setup_posting_date_time_check();
super.setup(doc);
this.frm.make_methods = {

View File

@@ -55,6 +55,11 @@ class ItemPrice(Document):
if not frappe.db.exists("Item", self.item_code):
frappe.throw(_("Item {0} not found.").format(self.item_code))
if self.uom and not frappe.db.exists(
"UOM Conversion Detail", {"parenttype": "Item", "parent": self.item_code, "uom": self.uom}
):
frappe.throw(_("UOM {0} not found in Item {1}").format(self.uom, self.item_code))
def update_price_list_details(self):
if self.price_list:
price_list_details = frappe.db.get_value(

View File

@@ -79,7 +79,9 @@ frappe.ui.form.on("Material Request", {
});
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
frm.doc.buying_price_list = frappe.defaults.get_default("buying_price_list");
if (!frm.doc.buying_price_list) {
frm.doc.buying_price_list = frappe.defaults.get_default("buying_price_list");
}
},
company: function (frm) {
@@ -330,6 +332,9 @@ frappe.ui.form.on("Material Request", {
label: __("For Warehouse"),
options: "Warehouse",
reqd: 1,
get_query: function () {
return { filters: { company: frm.doc.company } };
},
},
{ fieldname: "qty", fieldtype: "Float", label: __("Quantity"), reqd: 1, default: 1 },
{

View File

@@ -75,6 +75,21 @@ class MaterialRequest(BuyingController):
work_order: DF.Link | None
# end: auto-generated types
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.status_updater = [
{
"source_dt": "Material Request Item",
"target_dt": "Sales Order Item",
"target_field": "ordered_qty",
"target_parent_dt": "Sales Order",
"target_parent_field": "",
"join_field": "sales_order_item",
"target_ref_field": "stock_qty",
"source_field": "stock_qty",
}
]
def check_if_already_pulled(self):
pass
@@ -175,10 +190,10 @@ class MaterialRequest(BuyingController):
def on_submit(self):
self.update_requested_qty_in_production_plan()
self.update_requested_qty()
if self.material_request_type == "Purchase" and frappe.db.exists(
"Budget", {"applicable_on_material_request": 1, "docstatus": 1}
):
self.validate_budget()
if self.material_request_type == "Purchase":
self.update_prevdoc_status()
if frappe.db.exists("Budget", {"applicable_on_material_request": 1, "docstatus": 1}):
self.validate_budget()
def before_save(self):
self.set_status(update=True)
@@ -816,6 +831,16 @@ def raise_work_orders(material_request):
@frappe.whitelist()
def create_pick_list(source_name, target_doc=None):
def update_item(obj, target, source_parent):
qty = (
flt(flt(obj.stock_qty) - flt(obj.ordered_qty)) / target.conversion_factor
if flt(obj.stock_qty) > flt(obj.ordered_qty)
else 0
)
target.qty = qty
target.stock_qty = qty * obj.conversion_factor
target.conversion_factor = obj.conversion_factor
doc = get_mapped_doc(
"Material Request",
source_name,
@@ -828,6 +853,11 @@ def create_pick_list(source_name, target_doc=None):
"Material Request Item": {
"doctype": "Pick List Item",
"field_map": {"name": "material_request_item", "stock_qty": "stock_qty"},
"postprocess": update_item,
"condition": lambda doc: (
flt(doc.ordered_qty, doc.precision("ordered_qty"))
< flt(doc.stock_qty, doc.precision("ordered_qty"))
),
},
},
target_doc,

View File

@@ -12,6 +12,7 @@ from frappe.utils import flt, today
from erpnext.controllers.accounts_controller import InvalidQtyError
from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.material_request.material_request import (
create_pick_list,
make_in_transit_stock_entry,
make_purchase_order,
make_stock_entry,
@@ -883,6 +884,48 @@ class TestMaterialRequest(FrappeTestCase):
self.assertEqual(mr.per_ordered, 100)
self.assertEqual(mr.status, "Ordered")
def test_material_request_qty_over_sales_order_limit(self):
from erpnext.controllers.status_updater import OverAllowanceError
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
so = make_sales_order()
mr = make_material_request(qty=100, do_not_submit=True)
mr.items[0].sales_order = so.name
mr.items[0].sales_order_item = so.items[0].name
mr.save()
self.assertRaises(OverAllowanceError, mr.submit)
def test_pending_qty_in_pick_list(self):
"""Test for pick list mapped doc qty from partially received Material Request Transfer"""
import json
from erpnext.stock.doctype.pick_list.pick_list import create_stock_entry
mr = make_material_request(material_request_type="Material Transfer")
pl = create_pick_list(mr.name)
pl.save()
pl.locations[0].qty = 5
pl.locations[0].stock_qty = 5
pl.submit()
to_warehouse = create_warehouse("Test To Warehouse")
se_data = create_stock_entry(json.dumps(pl.as_dict()))
se = frappe.get_doc(se_data)
se.items[0].t_warehouse = to_warehouse
se.save()
se.submit()
pl.load_from_db()
self.assertEqual(pl.locations[0].picked_qty, se.items[0].qty)
mr.load_from_db()
self.assertEqual(mr.status, "Partially Received")
pl_for_pending = create_pick_list(mr.name)
self.assertEqual(pl_for_pending.locations[0].qty, 5)
def get_in_transit_warehouse(company):
if not frappe.db.exists("Warehouse Type", "Transit"):

View File

@@ -108,7 +108,12 @@ def get_indexed_packed_items_table(doc):
"""
indexed_table = {}
for packed_item in doc.get("packed_items"):
key = (packed_item.parent_item, packed_item.item_code, packed_item.parent_detail_docname)
key = (
packed_item.parent_item,
packed_item.item_code,
packed_item.idx if doc.is_new() else packed_item.parent_detail_docname,
)
indexed_table[key] = packed_item
return indexed_table
@@ -169,7 +174,11 @@ def add_packed_item_row(doc, packing_item, main_item_row, packed_items_table, re
exists, pi_row = False, {}
# check if row already exists in packed items table
key = (main_item_row.item_code, packing_item.item_code, main_item_row.name)
key = (
main_item_row.item_code,
packing_item.item_code,
main_item_row.idx if doc.is_new() else main_item_row.name,
)
if packed_items_table.get(key):
pi_row, exists = packed_items_table.get(key), True

View File

@@ -7,7 +7,7 @@ from itertools import groupby
import frappe
from frappe import _, bold
from frappe.model.mapper import get_mapped_doc, map_child_doc
from frappe.model.mapper import map_child_doc
from frappe.query_builder import Case
from frappe.query_builder.custom import GROUP_CONCAT
from frappe.query_builder.functions import Coalesce, Locate, Replace, Sum
@@ -646,8 +646,8 @@ class PickList(TransactionBase):
product_bundles = self._get_product_bundles()
product_bundle_qty_map = self._get_product_bundle_qty_map(product_bundles.values())
for so_row, item_code in product_bundles.items():
picked_qty = self._compute_picked_qty_for_bundle(so_row, product_bundle_qty_map[item_code])
for so_row, value in product_bundles.items():
picked_qty = self._compute_picked_qty_for_bundle(so_row, product_bundle_qty_map[value.item_code])
item_table = "Sales Order Item"
already_picked = frappe.db.get_value(item_table, so_row, "picked_qty", for_update=True)
frappe.db.set_value(
@@ -770,19 +770,23 @@ class PickList(TransactionBase):
if not item.product_bundle_item:
continue
product_bundles[item.sales_order_item] = frappe.db.get_value(
"Sales Order Item",
item.sales_order_item,
"item_code",
product_bundles[item.sales_order_item] = frappe._dict(
{
"item_code": frappe.db.get_value(
"Sales Order Item",
item.sales_order_item,
"item_code",
),
"pick_list_item": item.name,
}
)
return product_bundles
def _get_product_bundle_qty_map(self, bundles: list[str]) -> dict[str, dict[str, float]]:
# bundle_item_code: Dict[component, qty]
def _get_product_bundle_qty_map(self, bundles) -> dict[str, dict[str, float]]:
product_bundle_qty_map = {}
for bundle_item_code in bundles:
bundle = frappe.get_last_doc("Product Bundle", {"new_item_code": bundle_item_code, "disabled": 0})
product_bundle_qty_map[bundle_item_code] = {item.item_code: item.qty for item in bundle.items}
for data in bundles:
bundle = frappe.get_last_doc("Product Bundle", {"new_item_code": data.item_code, "disabled": 0})
product_bundle_qty_map[data.item_code] = {item.item_code: item.qty for item in bundle.items}
return product_bundle_qty_map
def _compute_picked_qty_for_bundle(self, bundle_row, bundle_items) -> int:
@@ -1388,15 +1392,16 @@ def add_product_bundles_to_delivery_note(
product_bundles = pick_list._get_product_bundles()
product_bundle_qty_map = pick_list._get_product_bundle_qty_map(product_bundles.values())
for so_row, item_code in product_bundles.items():
for so_row, value in product_bundles.items():
sales_order_item = frappe.get_doc("Sales Order Item", so_row)
if sales_order and sales_order_item.parent != sales_order:
continue
dn_bundle_item = map_child_doc(sales_order_item, delivery_note, item_mapper)
dn_bundle_item.qty = pick_list._compute_picked_qty_for_bundle(
so_row, product_bundle_qty_map[item_code]
so_row, product_bundle_qty_map[value.item_code]
)
dn_bundle_item.pick_list_item = value.pick_list_item
dn_bundle_item.against_pick_list = pick_list.name
update_delivery_note_item(sales_order_item, dn_bundle_item, delivery_note)
@@ -1560,8 +1565,8 @@ def update_stock_entry_items_with_no_reference(pick_list, stock_entry):
def update_common_item_properties(item, location):
item.item_code = location.item_code
item.s_warehouse = location.warehouse
item.qty = location.picked_qty * location.conversion_factor
item.transfer_qty = location.picked_qty
item.qty = location.qty
item.uom = location.uom
item.conversion_factor = location.conversion_factor
item.stock_uom = location.stock_uom

View File

@@ -195,6 +195,7 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
erpnext.buying.BuyingController
) {
setup(doc) {
this.setup_accounting_dimension_triggers();
this.setup_posting_date_time_check();
super.setup(doc);
}

View File

@@ -893,7 +893,7 @@
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nDraft\nPartly Billed\nTo Bill\nCompleted\nReturn Issued\nCancelled\nClosed",
"options": "\nDraft\nPartly Billed\nTo Bill\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
@@ -1300,7 +1300,7 @@
"idx": 261,
"is_submittable": 1,
"links": [],
"modified": "2025-08-06 16:41:02.690658",
"modified": "2025-11-12 19:53:48.173096",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",

Some files were not shown because too many files have changed in this diff Show More