fix(ux): better error message

Co-authored-by: Saqib <nextchamp.saqib@gmail.com>
This commit is contained in:
Ankush Menat 2021-09-20 16:58:23 +05:30 committed by Ankush Menat
parent 5e4fbba753
commit 21a955d20b
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF

View File

@ -993,8 +993,8 @@ class AccountsController(TransactionBase):
item.get(item_ref_dn), based_on), self.precision(based_on, item))
if not ref_amt:
frappe.msgprint(
_("Warning: System will not check overbilling since amount for Item {0} in {1} is zero")
.format(item.item_code, ref_dt))
_("System will not check overbilling since amount for Item {0} in {1} is zero")
.format(item.item_code, ref_dt), title=_("Warning"), indicator="orange")
continue
already_billed = frappe.db.sql("""
@ -1002,7 +1002,7 @@ class AccountsController(TransactionBase):
from `tab%s`
where %s=%s and docstatus=1 and parent != %s
""" % (based_on, self.doctype + " Item", item_ref_dn, '%s', '%s'),
(item.get(item_ref_dn), self.name))[0][0]
(item.get(item_ref_dn), self.name))[0][0]
total_billed_amt = flt(flt(already_billed) + flt(item.get(based_on)),
self.precision(based_on, item))
@ -1027,8 +1027,8 @@ class AccountsController(TransactionBase):
self.throw_overbill_exception(item, max_allowed_amt)
if role_allowed_to_over_bill in user_roles and total_overbilled_amt > 0.1:
frappe.msgprint(_("INFO: Overbilling of {} ignored because you have {} role.")
.format(total_overbilled_amt, role_allowed_to_over_bill))
frappe.msgprint(_("Overbilling of {} ignored because you have {} role.")
.format(total_overbilled_amt, role_allowed_to_over_bill), title=_("Warning"), indicator="orange")
def throw_overbill_exception(self, item, max_allowed_amt):
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set allowance in Accounts Settings")