mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
fix: show party type in due date exceeding message
This commit is contained in:
@@ -670,10 +670,10 @@ def validate_due_date(posting_date, due_date, bill_date=None, template_name=None
|
|||||||
|
|
||||||
frappe.throw(_("Due Date cannot be before {0}").format(doctype_date))
|
frappe.throw(_("Due Date cannot be before {0}").format(doctype_date))
|
||||||
else:
|
else:
|
||||||
validate_due_date_with_template(posting_date, due_date, bill_date, template_name)
|
validate_due_date_with_template(posting_date, due_date, bill_date, template_name, doctype)
|
||||||
|
|
||||||
|
|
||||||
def validate_due_date_with_template(posting_date, due_date, bill_date, template_name):
|
def validate_due_date_with_template(posting_date, due_date, bill_date, template_name, doctype=None):
|
||||||
if not template_name:
|
if not template_name:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -683,13 +683,12 @@ def validate_due_date_with_template(posting_date, due_date, bill_date, template_
|
|||||||
return
|
return
|
||||||
|
|
||||||
if default_due_date != posting_date and getdate(due_date) > getdate(default_due_date):
|
if default_due_date != posting_date and getdate(due_date) > getdate(default_due_date):
|
||||||
is_credit_controller = (
|
if frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles():
|
||||||
frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles()
|
party_type = "supplier" if doctype == "Purchase Invoice" else "customer"
|
||||||
)
|
|
||||||
if is_credit_controller:
|
|
||||||
msgprint(
|
msgprint(
|
||||||
_("Note: Due Date exceeds allowed customer credit days by {0} day(s)").format(
|
_("Note: Due Date exceeds allowed {0} credit days by {1} day(s)").format(
|
||||||
date_diff(due_date, default_due_date)
|
party_type, date_diff(due_date, default_due_date)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user