Compare commits

...

12 Commits

Author SHA1 Message Date
Lakshit Jain
cdc800e39c Merge pull request #54478 from frappe/mergify/bp/version-14-hotfix/pr-54451
refactor: use consistent report column names (backport #54451)
2026-04-23 20:14:39 +05:30
Smit Vora
83fd655042 chore: translate values correctly 2026-04-23 17:42:31 +05:30
Smit Vora
34e94d6e7a chore: resolve conflicts 2026-04-23 15:36:47 +05:30
Smit Vora
32d46b3e88 fix: use key consistently
(cherry picked from commit 8f9a5e6c0c)
2026-04-23 09:56:24 +00:00
Smit Vora
6eb2868a15 fix: add party_type for dynamic link and add it to grouping key
(cherry picked from commit a3ad1fb163)
2026-04-23 09:56:24 +00:00
Smit Vora
e1ff203f95 refactor: better label for entity type
(cherry picked from commit 8e12bda108)
2026-04-23 09:56:24 +00:00
Smit Vora
ab188c4404 refactor: use consistent report column names
(cherry picked from commit 7630c01e40)

# Conflicts:
#	erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
2026-04-23 09:56:24 +00:00
mergify[bot]
c5ed69c2c2 fix: reset base_rounded_total when rounded_total resets (backport #54241) (#54302)
* fix: reset base_rounded_total when rounded_total resets

(cherry picked from commit f8d278b733)

# Conflicts:
#	erpnext/controllers/tests/test_taxes_and_totals.py
#	erpnext/public/js/controllers/taxes_and_totals.js

* chore: spelling mistake

(cherry picked from commit e2ac476587)

* chore: resolve conflicts

---------

Co-authored-by: ljain112 <ljain112@gmail.com>
2026-04-16 10:40:27 +05:30
diptanilsaha
21311dab86 fix: added exception handling on service level agreement apply hook (#50096) (#54192)
Co-authored-by: Ankush Menat <ankush@frappe.io>
2026-04-10 17:01:25 +05:30
rohitwaghchaure
9dc88a1283 Merge pull request #53635 from rohitwaghchaure/fixed-support-62898
fix: allow zero valuation rate
2026-03-19 14:02:27 +05:30
Rohit Waghchaure
a6eadb18c9 fix: allow zero valuation rate 2026-03-19 13:56:28 +05:30
mergify[bot]
f6d3a811ed fix(help): escape query (backport #53192) (#53193)
fix(help): escape query (#53192)


(cherry picked from commit 702adda000)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2026-03-05 18:40:44 +05:30
9 changed files with 99 additions and 47 deletions

View File

@@ -52,28 +52,25 @@ def group_by_party_and_category(data, filters):
party_category_wise_map = {}
for row in data:
key = (row.get("party_type"), row.get("party"), row.get("tax_withholding_category"))
party_category_wise_map.setdefault(
(row.get("party"), row.get("section_code")),
key,
{
"pan": row.get("pan"),
"tax_id": row.get("tax_id"),
"party": row.get("party"),
"party_type": row.get("party_type"),
"party_name": row.get("party_name"),
"section_code": row.get("section_code"),
"entity_type": row.get("entity_type"),
"tax_withholding_category": row.get("tax_withholding_category"),
"party_entity_type": row.get("party_entity_type"),
"rate": row.get("rate"),
"total_amount": 0.0,
"tax_amount": 0.0,
},
)
party_category_wise_map.get((row.get("party"), row.get("section_code")))["total_amount"] += row.get(
"total_amount", 0.0
)
party_category_wise_map.get((row.get("party"), row.get("section_code")))["tax_amount"] += row.get(
"tax_amount", 0.0
)
party_category_wise_map.get(key)["total_amount"] += row.get("total_amount", 0.0)
party_category_wise_map.get(key)["tax_amount"] += row.get("tax_amount", 0.0)
final_result = get_final_result(party_category_wise_map)
@@ -114,13 +111,18 @@ def get_columns(filters):
columns.extend(
[
{
"label": _("Section Code"),
"label": _("Tax Withholding Category"),
"options": "Tax Withholding Category",
"fieldname": "section_code",
"fieldname": "tax_withholding_category",
"fieldtype": "Link",
"width": 180,
},
{"label": _("Entity Type"), "fieldname": "entity_type", "fieldtype": "Data", "width": 180},
{
"label": _("{0} Type").format(_(filters.get("party_type", "Party"))),
"fieldname": "party_entity_type",
"fieldtype": "Data",
"width": 180,
},
{
"label": _("TDS Rate %") if filters.get("party_type") == "Supplier" else _("TCS Rate %"),
"fieldname": "rate",

View File

@@ -106,8 +106,8 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
row.update(
{
"section_code": tax_withholding_category or "",
"entity_type": party_map.get(party, {}).get(party_type),
"tax_withholding_category": tax_withholding_category or "",
"party_entity_type": party_map.get(party, {}).get(party_type),
"rate": rate,
"total_amount": total_amount,
"grand_total": grand_total,
@@ -127,7 +127,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
else:
entries[key] = row
out = list(entries.values())
out.sort(key=lambda x: (x["section_code"], x["transaction_date"]))
out.sort(key=lambda x: (x["tax_withholding_category"], x["transaction_date"], x["ref_no"]))
return out
@@ -177,9 +177,9 @@ def get_columns(filters):
pan = "pan" if frappe.db.has_column(filters.party_type, "pan") else "tax_id"
columns = [
{
"label": _("Section Code"),
"label": _("Tax Withholding Category"),
"options": "Tax Withholding Category",
"fieldname": "section_code",
"fieldname": "tax_withholding_category",
"fieldtype": "Link",
"width": 90,
},
@@ -208,7 +208,12 @@ def get_columns(filters):
columns.extend(
[
{"label": _("Entity Type"), "fieldname": "entity_type", "fieldtype": "Data", "width": 100},
{
"label": _("{0} Type").format(_(filters.get("party_type", "Party"))),
"fieldname": "party_entity_type",
"fieldtype": "Data",
"width": 100,
},
]
)
if filters.party_type == "Supplier":

View File

@@ -118,7 +118,7 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase):
voucher_expected_values = expected_values[i]
voucher_actual_values = (
voucher.ref_no,
voucher.section_code,
voucher.tax_withholding_category,
voucher.rate,
voucher.base_total,
voucher.tax_amount,

View File

@@ -626,18 +626,17 @@ class calculate_taxes_and_totals:
if self.doc.meta.get_field("rounded_total"):
if self.doc.is_rounded_total_disabled():
self.doc.rounded_total = 0
self.doc.base_rounded_total = 0
self.doc.rounding_adjustment = 0
return
self.doc.rounded_total = round_based_on_smallest_currency_fraction(
self.doc.grand_total, self.doc.currency, self.doc.precision("rounded_total")
)
else:
self.doc.rounded_total = round_based_on_smallest_currency_fraction(
self.doc.grand_total, self.doc.currency, self.doc.precision("rounded_total")
)
# rounding adjustment should always be the difference vetween grand and rounded total
self.doc.rounding_adjustment = flt(
self.doc.rounded_total - self.doc.grand_total, self.doc.precision("rounding_adjustment")
)
# rounding adjustment should always be the difference between grand and rounded total
self.doc.rounding_adjustment = flt(
self.doc.rounded_total - self.doc.grand_total, self.doc.precision("rounding_adjustment")
)
self._set_in_company_currency(self.doc, ["rounding_adjustment", "rounded_total"])

View File

@@ -0,0 +1,37 @@
import frappe
from frappe.tests.utils import FrappeTestCase
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
class TestTaxesAndTotals(FrappeTestCase):
def test_disabling_rounded_total_resets_base_fields(self):
"""Disabling rounded total should also clear base rounded values."""
so = make_sales_order(do_not_save=True)
so.items[0].qty = 1
so.items[0].rate = 1000.25
so.items[0].price_list_rate = 1000.25
so.items[0].discount_percentage = 0
so.items[0].discount_amount = 0
so.set("taxes", [])
so.disable_rounded_total = 0
calculate_taxes_and_totals(so)
self.assertEqual(so.grand_total, 1000.25)
self.assertEqual(so.rounded_total, 1000.0)
self.assertEqual(so.rounding_adjustment, -0.25)
self.assertEqual(so.base_grand_total, 1000.25)
self.assertEqual(so.base_rounded_total, 1000.0)
self.assertEqual(so.base_rounding_adjustment, -0.25)
# User toggles disable_rounded_total after values are already set.
so.disable_rounded_total = 1
calculate_taxes_and_totals(so)
self.assertEqual(so.rounded_total, 0)
self.assertEqual(so.rounding_adjustment, 0)
self.assertEqual(so.base_rounded_total, 0)
self.assertEqual(so.base_rounding_adjustment, 0)

View File

@@ -609,18 +609,21 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
disable_rounded_total = frappe.sys_defaults.disable_rounded_total;
}
if (cint(disable_rounded_total)) {
this.frm.doc.rounded_total = 0;
this.frm.doc.base_rounded_total = 0;
this.frm.doc.rounding_adjustment = 0;
return;
}
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(this.frm.doc.grand_total,
this.frm.doc.currency, precision("rounded_total"));
this.frm.doc.rounding_adjustment = flt(this.frm.doc.rounded_total - this.frm.doc.grand_total,
precision("rounding_adjustment"));
if (frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
if (cint(disable_rounded_total)) {
this.frm.doc.rounded_total = 0;
this.frm.doc.rounding_adjustment = 0;
} else {
this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(
this.frm.doc.grand_total,
this.frm.doc.currency,
precision("rounded_total")
);
this.frm.doc.rounding_adjustment = flt(
this.frm.doc.rounded_total - this.frm.doc.grand_total,
precision("rounding_adjustment")
);
}
this.set_in_company_currency(this.frm.doc, ["rounding_adjustment", "rounded_total"]);
}

View File

@@ -991,7 +991,7 @@ class update_entries_after:
# else it remains the same as that of previous entry
self.wh_data.valuation_rate = new_stock_value / new_stock_qty
if not self.wh_data.valuation_rate and sle.voucher_detail_no:
if self.wh_data.valuation_rate is None and sle.voucher_detail_no:
allow_zero_rate = self.check_if_allow_zero_valuation_rate(sle.voucher_type, sle.voucher_detail_no)
if not allow_zero_rate:
self.wh_data.valuation_rate = self.get_fallback_rate(sle)

View File

@@ -449,10 +449,16 @@ def get_documents_with_active_service_level_agreement():
def set_documents_with_active_service_level_agreement():
active = [
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
]
frappe.cache().hset("service_level_agreement", "active", active)
try:
active = frozenset(
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
)
frappe.cache().hset("service_level_agreement", "active", active)
except (frappe.DoesNotExistError, frappe.db.TableMissingError):
# This happens during install / uninstall when wildcard hook for SLA intercepts some doc action.
# In both cases, the error can be safely ignored.
active = frozenset()
return active

View File

@@ -8,7 +8,7 @@
<form action="/search_help" style="display: flex;">
<input name='q' class='form-control' type='text'
style='max-width: 400px; display: inline-block; margin-right: 10px;'
value='{{ frappe.form_dict.q or ''}}'
value='{{ (frappe.form_dict.q or '') | e }}'
{% if not frappe.form_dict.q%}placeholder="{{ _("What do you need help with?") }}"{% endif %}>
<input type='submit'
class='btn btn-sm btn-light btn-search' value="{{ _("Search") }}">