mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-21 10:26:30 +00:00
fix: show party type in due date exceeding message
(cherry picked from commit b6d9134014)
# Conflicts:
# erpnext/accounts/party.py
This commit is contained in:
committed by
Mergify
parent
2d77e056bc
commit
f73e99e9d2
@@ -661,6 +661,7 @@ def validate_due_date(posting_date, due_date, bill_date=None, template_name=None
|
|||||||
if getdate(due_date) < getdate(posting_date):
|
if getdate(due_date) < getdate(posting_date):
|
||||||
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
|
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
|
||||||
else:
|
else:
|
||||||
|
<<<<<<< HEAD
|
||||||
if not template_name:
|
if not template_name:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -674,6 +675,28 @@ def validate_due_date(posting_date, due_date, bill_date=None, template_name=None
|
|||||||
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 = (
|
is_credit_controller = (
|
||||||
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()
|
||||||
|
=======
|
||||||
|
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, doctype=None):
|
||||||
|
if not template_name:
|
||||||
|
return
|
||||||
|
|
||||||
|
default_due_date = format(get_due_date_from_template(template_name, posting_date, bill_date))
|
||||||
|
|
||||||
|
if not default_due_date:
|
||||||
|
return
|
||||||
|
|
||||||
|
if default_due_date != posting_date and getdate(due_date) > getdate(default_due_date):
|
||||||
|
if frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles():
|
||||||
|
party_type = "supplier" if doctype == "Purchase Invoice" else "customer"
|
||||||
|
|
||||||
|
msgprint(
|
||||||
|
_("Note: Due Date exceeds allowed {0} credit days by {1} day(s)").format(
|
||||||
|
party_type, date_diff(due_date, default_due_date)
|
||||||
|
)
|
||||||
|
>>>>>>> b6d9134014 (fix: show party type in due date exceeding message)
|
||||||
)
|
)
|
||||||
if is_credit_controller:
|
if is_credit_controller:
|
||||||
msgprint(
|
msgprint(
|
||||||
|
|||||||
Reference in New Issue
Block a user