mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 12:06:43 +00:00
refactor: clearer labels for the overdue billing control (#57298)
refactor: clearer labels and messages, drop "threshold" wording User-facing text only, no field or behaviour changes: - Accounts Settings toggle label -> "Restrict Customer Over Billing". - Bypass role label -> "Role Allowed to Bypass Over Billing Restriction". - Customer Credit Limit field label -> "Overdue Limit". - Rewrote the descriptions and the block message to match and to stop saying "threshold".
This commit is contained in:
@@ -278,17 +278,17 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Block submitting a new Sales Invoice when the customer's overdue amount exceeds the Overdue Billing Threshold set on the customer.",
|
||||
"description": "Block a new Sales Invoice when the customer's overdue amount exceeds the Overdue Limit set on the customer.",
|
||||
"fieldname": "enable_overdue_billing_threshold",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Overdue Billing Threshold"
|
||||
"label": "Restrict Customer Over Billing"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.enable_overdue_billing_threshold",
|
||||
"description": "Users with this role can still submit invoices for customers over their overdue billing threshold.",
|
||||
"description": "Users with this role can still submit invoices for customers who have crossed their Overdue Limit.",
|
||||
"fieldname": "role_allowed_to_bypass_overdue_billing",
|
||||
"fieldtype": "Link",
|
||||
"label": "Role allowed to bypass overdue billing limit",
|
||||
"label": "Role Allowed to Bypass Over Billing Restriction",
|
||||
"options": "Role"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"description": "Transactions are blocked when the outstanding balance exceeds the credit limit. When the overdue billing setting is enabled, new invoices are also blocked when the customer's overdue amount exceeds the overdue billing threshold.",
|
||||
"description": "Transactions are blocked when the outstanding balance exceeds the credit limit. When Restrict Customer Over Billing is enabled, new invoices are also blocked when the customer's overdue amount exceeds the Overdue Limit.",
|
||||
"fieldname": "credit_limits",
|
||||
"fieldtype": "Table",
|
||||
"label": "Credit & Overdue Limits",
|
||||
|
||||
@@ -602,19 +602,17 @@ def check_overdue_billing_threshold(customer: str, company: str) -> None:
|
||||
|
||||
company_currency = frappe.get_cached_value("Company", company, "default_currency")
|
||||
frappe.throw(
|
||||
_(
|
||||
"Customer {0} has an overdue billing limit. Overdue amount {1} exceeds the allowed threshold {2}."
|
||||
).format(
|
||||
_("Overdue Limit crossed for customer {0}. Overdue amount {1} exceeds the allowed limit {2}.").format(
|
||||
customer,
|
||||
fmt_money(overdue_amount, currency=company_currency),
|
||||
fmt_money(threshold, currency=company_currency),
|
||||
),
|
||||
title=_("Overdue Billing Limit Crossed"),
|
||||
title=_("Overdue Limit Crossed"),
|
||||
)
|
||||
|
||||
|
||||
def get_overdue_billing_threshold(customer: str, company: str) -> float:
|
||||
"""Threshold set on the customer, falling back to its customer group."""
|
||||
"""Overdue limit set on the customer, falling back to its customer group."""
|
||||
threshold = frappe.db.get_value(
|
||||
"Customer Credit Limit",
|
||||
{"parent": customer, "parenttype": "Customer", "company": company},
|
||||
@@ -652,7 +650,7 @@ def get_outstanding_invoices_for_customer(customer: str, company: str) -> list[f
|
||||
gl_entry = frappe.qb.DocType("GL Entry")
|
||||
sales_invoice = frappe.qb.DocType("Sales Invoice")
|
||||
|
||||
# debit - credit is always booked in company currency, so this is comparable to the threshold
|
||||
# debit - credit is always booked in company currency, so this is comparable to the overdue limit
|
||||
outstanding = Sum(gl_entry.debit) - Sum(gl_entry.credit)
|
||||
|
||||
return (
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
},
|
||||
{
|
||||
"columns": 3,
|
||||
"description": "New Sales Invoices are blocked when the customer's overdue amount exceeds this. Requires 'Enable Overdue Billing Threshold' in Accounts Settings.",
|
||||
"description": "New Sales Invoices are blocked when the customer's overdue amount exceeds this. Requires 'Restrict Customer Over Billing' in Accounts Settings.",
|
||||
"fieldname": "overdue_billing_threshold",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Overdue Billing Threshold"
|
||||
"label": "Overdue Limit"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_2",
|
||||
|
||||
Reference in New Issue
Block a user