Skip to content

Commit a974721

Browse files
authored
Merge pull request #54437 from frappe/version-16-hotfix
2 parents 9312781 + 5923618 commit a974721

121 files changed

Lines changed: 3716 additions & 1809 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

erpnext/accounts/doctype/account/account.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
"idx": 1,
204204
"is_tree": 1,
205205
"links": [],
206-
"modified": "2025-08-02 06:26:44.657146",
206+
"modified": "2026-04-14 18:14:42.202065",
207207
"modified_by": "Administrator",
208208
"module": "Accounts",
209209
"name": "Account",
@@ -256,6 +256,14 @@
256256
"role": "Accounts Manager",
257257
"share": 1,
258258
"write": 1
259+
},
260+
{
261+
"role": "HR User",
262+
"select": 1
263+
},
264+
{
265+
"role": "HR Manager",
266+
"select": 1
259267
}
260268
],
261269
"row_format": "Dynamic",

erpnext/accounts/doctype/account/test_account.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -321,72 +321,6 @@ def test_account_balance(self):
321321
self.assertEqual(balance, 0)
322322

323323

324-
def _make_test_records(verbose=None):
325-
from frappe.tests.utils import make_test_objects
326-
327-
accounts = [
328-
# [account_name, parent_account, is_group]
329-
["_Test Bank", "Bank Accounts", 0, "Bank", None],
330-
["_Test Bank USD", "Bank Accounts", 0, "Bank", "USD"],
331-
["_Test Bank EUR", "Bank Accounts", 0, "Bank", "EUR"],
332-
["_Test Cash", "Cash In Hand", 0, "Cash", None],
333-
["_Test Account Stock Expenses", "Direct Expenses", 1, None, None],
334-
["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
335-
["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax", None],
336-
["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
337-
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment", None],
338-
["_Test Employee Advance", "Current Liabilities", 0, None, None],
339-
["_Test Account Tax Assets", "Current Assets", 1, None, None],
340-
["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax", None],
341-
["_Test Account Service Tax", "_Test Account Tax Assets", 0, "Tax", None],
342-
["_Test Account Reserves and Surplus", "Current Liabilities", 0, None, None],
343-
["_Test Account Cost for Goods Sold", "Expenses", 0, None, None],
344-
["_Test Account Excise Duty", "_Test Account Tax Assets", 0, "Tax", None],
345-
["_Test Account Education Cess", "_Test Account Tax Assets", 0, "Tax", None],
346-
["_Test Account S&H Education Cess", "_Test Account Tax Assets", 0, "Tax", None],
347-
["_Test Account CST", "Direct Expenses", 0, "Tax", None],
348-
["_Test Account Discount", "Direct Expenses", 0, None, None],
349-
["_Test Write Off", "Indirect Expenses", 0, None, None],
350-
["_Test Exchange Gain/Loss", "Indirect Expenses", 0, None, None],
351-
["_Test Account Sales", "Direct Income", 0, None, None],
352-
# related to Account Inventory Integration
353-
["_Test Account Stock In Hand", "Current Assets", 0, None, None],
354-
# fixed asset depreciation
355-
["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None],
356-
["_Test Accumulated Depreciations", "Current Assets", 0, "Accumulated Depreciation", None],
357-
["_Test Depreciations", "Expenses", 0, "Depreciation", None],
358-
["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None],
359-
# Receivable / Payable Account
360-
["_Test Receivable", "Current Assets", 0, "Receivable", None],
361-
["_Test Payable", "Current Liabilities", 0, "Payable", None],
362-
["_Test Receivable USD", "Current Assets", 0, "Receivable", "USD"],
363-
["_Test Payable USD", "Current Liabilities", 0, "Payable", "USD"],
364-
]
365-
366-
for company, abbr in [
367-
["_Test Company", "_TC"],
368-
["_Test Company 1", "_TC1"],
369-
["_Test Company with perpetual inventory", "TCP1"],
370-
]:
371-
test_objects = make_test_objects(
372-
"Account",
373-
[
374-
{
375-
"doctype": "Account",
376-
"account_name": account_name,
377-
"parent_account": parent_account + " - " + abbr,
378-
"company": company,
379-
"is_group": is_group,
380-
"account_type": account_type,
381-
"account_currency": currency,
382-
}
383-
for account_name, parent_account, is_group, account_type, currency in accounts
384-
],
385-
)
386-
387-
return test_objects
388-
389-
390324
def get_inventory_account(company, warehouse=None):
391325
account = None
392326
if warehouse:

erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def validate_dimension_defaults(self):
8282
else:
8383
frappe.throw(_("Company {0} is added more than once").format(frappe.bold(default.company)))
8484

85-
def after_insert(self):
85+
def on_update(self):
8686
if frappe.in_test:
8787
make_dimension_in_accounting_doctypes(doc=self)
8888
else:

erpnext/accounts/doctype/accounts_settings/accounts_settings.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
// For license information, please see license.txt
33

44
frappe.ui.form.on("Accounts Settings", {
5-
refresh: function (frm) {},
5+
refresh: function (frm) {
6+
frm.set_query("document_type", "repost_allowed_types", function (doc, cdt, cdn) {
7+
return {
8+
filters: {
9+
name: ["in", frappe.boot.sysdefaults.repost_allowed_doctypes],
10+
},
11+
};
12+
});
13+
},
614
enable_immutable_ledger: function (frm) {
715
if (!frm.doc.enable_immutable_ledger) {
816
return;

erpnext/accounts/doctype/accounts_settings/accounts_settings.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
"reconciliation_queue_size",
6363
"column_break_resa",
6464
"exchange_gain_loss_posting_date",
65+
"repost_section",
66+
"repost_allowed_types",
6567
"payment_options_section",
6668
"enable_loyalty_point_program",
6769
"column_break_ctam",
@@ -702,6 +704,17 @@
702704
"fieldname": "fetch_payment_schedule_in_payment_request",
703705
"fieldtype": "Check",
704706
"label": "Fetch Payment Schedule In Payment Request"
707+
},
708+
{
709+
"fieldname": "repost_section",
710+
"fieldtype": "Section Break",
711+
"label": "Repost"
712+
},
713+
{
714+
"fieldname": "repost_allowed_types",
715+
"fieldtype": "Table",
716+
"label": "Allowed Doctypes",
717+
"options": "Repost Allowed Types"
705718
}
706719
],
707720
"grid_page_length": 50,
@@ -711,7 +724,7 @@
711724
"index_web_pages_for_search": 1,
712725
"issingle": 1,
713726
"links": [],
714-
"modified": "2026-03-30 07:32:58.182018",
727+
"modified": "2026-04-13 15:30:28.729627",
715728
"modified_by": "Administrator",
716729
"module": "Accounts",
717730
"name": "Accounts Settings",

erpnext/accounts/doctype/accounts_settings/accounts_settings.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
from frappe.model.document import Document
1111
from frappe.utils import cint
1212

13+
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
14+
get_accounting_dimensions,
15+
)
1316
from erpnext.accounts.utils import sync_auto_reconcile_config
1417

1518
SELLING_DOCTYPES = [
@@ -44,6 +47,8 @@ class AccountsSettings(Document):
4447
if TYPE_CHECKING:
4548
from frappe.types import DF
4649

50+
from erpnext.accounts.doctype.repost_allowed_types.repost_allowed_types import RepostAllowedTypes
51+
4752
add_taxes_from_item_tax_template: DF.Check
4853
add_taxes_from_taxes_and_charges_template: DF.Check
4954
allow_multi_currency_invoices_against_single_party_account: DF.Check
@@ -86,6 +91,7 @@ class AccountsSettings(Document):
8691
receivable_payable_fetch_method: DF.Literal["Buffered Cursor", "UnBuffered Cursor", "Raw SQL"]
8792
receivable_payable_remarks_length: DF.Int
8893
reconciliation_queue_size: DF.Int
94+
repost_allowed_types: DF.Table[RepostAllowedTypes]
8995
role_allowed_to_over_bill: DF.Link | None
9096
role_to_notify_on_depreciation_failure: DF.Link | None
9197
role_to_override_stop_action: DF.Link | None
@@ -140,6 +146,7 @@ def validate(self):
140146
frappe.clear_cache()
141147

142148
self.validate_and_sync_auto_reconcile_config()
149+
self.update_property_for_accounting_dimension()
143150

144151
def validate_stale_days(self):
145152
if not self.allow_stale and cint(self.stale_days) <= 0:
@@ -186,6 +193,17 @@ def validate_auto_tax_settings(self):
186193
title=_("Auto Tax Settings Error"),
187194
)
188195

196+
def update_property_for_accounting_dimension(self):
197+
doctypes = [entry.document_type for entry in self.repost_allowed_types]
198+
if not doctypes:
199+
return
200+
201+
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import get_child_docs
202+
203+
doctypes += get_child_docs(doctypes)
204+
205+
set_allow_on_submit_for_dimension_fields(doctypes)
206+
189207
@frappe.whitelist()
190208
def drop_ar_sql_procedures(self):
191209
from erpnext.accounts.report.accounts_receivable.accounts_receivable import InitSQLProceduresForAR
@@ -225,3 +243,12 @@ def create_property_setter_for_hiding_field(doctype, field_name, hide):
225243
"Check",
226244
validate_fields_for_doctype=False,
227245
)
246+
247+
248+
def set_allow_on_submit_for_dimension_fields(doctypes):
249+
for dt in doctypes:
250+
meta = frappe.get_meta(dt)
251+
for dimension in get_accounting_dimensions():
252+
df = meta.get_field(dimension)
253+
if df and not df.allow_on_submit:
254+
frappe.db.set_value("Custom Field", dt + "-" + dimension, "allow_on_submit", 1)

erpnext/accounts/doctype/cost_center/cost_center.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"idx": 1,
127127
"is_tree": 1,
128128
"links": [],
129-
"modified": "2025-01-22 10:46:42.904001",
129+
"modified": "2026-04-14 18:15:27.367298",
130130
"modified_by": "Administrator",
131131
"module": "Accounts",
132132
"name": "Cost Center",
@@ -173,11 +173,20 @@
173173
"role": "Employee",
174174
"select": 1,
175175
"share": 1
176+
},
177+
{
178+
"role": "HR User",
179+
"select": 1
180+
},
181+
{
182+
"role": "HR Manager",
183+
"select": 1
176184
}
177185
],
186+
"row_format": "Dynamic",
178187
"search_fields": "parent_cost_center, is_group",
179188
"show_name_in_global_search": 1,
180189
"sort_field": "creation",
181190
"sort_order": "ASC",
182191
"states": []
183-
}
192+
}

erpnext/accounts/doctype/item_tax_template/item_tax_template.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,12 @@ frappe.ui.form.on("Item Tax Template", {
4747
});
4848
},
4949
});
50+
51+
frappe.ui.form.on("Item Tax Template Detail", {
52+
not_applicable: function (frm, cdt, cdn) {
53+
let row = locals[cdt][cdn];
54+
if (row.not_applicable) {
55+
frappe.model.set_value(cdt, cdn, "tax_rate", 0);
56+
}
57+
},
58+
});

erpnext/accounts/doctype/item_tax_template/item_tax_template.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ class ItemTaxTemplate(Document):
2727
# end: auto-generated types
2828

2929
def validate(self):
30+
self.set_zero_rate_for_not_applicable_tax()
3031
self.validate_tax_accounts()
3132

33+
def set_zero_rate_for_not_applicable_tax(self):
34+
"""Ensure tax_rate is 0 for any row marked as not applicable."""
35+
for row in self.get("taxes"):
36+
if row.not_applicable:
37+
row.tax_rate = 0
38+
3239
def autoname(self):
3340
if self.company and self.title:
3441
abbr = frappe.get_cached_value("Company", self.company, "abbr")

erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"engine": "InnoDB",
77
"field_order": [
88
"tax_type",
9-
"tax_rate"
9+
"tax_rate",
10+
"not_applicable"
1011
],
1112
"fields": [
1213
{
@@ -21,20 +22,30 @@
2122
"fieldname": "tax_rate",
2223
"fieldtype": "Float",
2324
"in_list_view": 1,
24-
"label": "Tax Rate"
25+
"label": "Tax Rate",
26+
"read_only_depends_on": "eval:doc.not_applicable"
27+
},
28+
{
29+
"default": "0",
30+
"description": "Check if this tax is not applicable to items (distinct from 0% rate)",
31+
"fieldname": "not_applicable",
32+
"fieldtype": "Check",
33+
"in_list_view": 1,
34+
"label": "Not Applicable"
2535
}
2636
],
2737
"istable": 1,
2838
"links": [],
29-
"modified": "2024-03-27 13:09:55.735360",
39+
"modified": "2025-12-26 17:19:18.791891",
3040
"modified_by": "Administrator",
3141
"module": "Accounts",
3242
"name": "Item Tax Template Detail",
3343
"owner": "Administrator",
3444
"permissions": [],
3545
"quick_entry": 1,
46+
"row_format": "Dynamic",
3647
"sort_field": "creation",
3748
"sort_order": "DESC",
3849
"states": [],
3950
"track_changes": 1
40-
}
51+
}

0 commit comments

Comments
 (0)