feat: Role to allow over billing, delivery, receipt (#24854)

* feat: Role to allow  over billing, delivery, receipt

* fix: Typo
This commit is contained in:
Deepesh Garg
2021-04-19 13:25:15 +05:30
committed by GitHub
parent ceba5774be
commit cb718fce88
4 changed files with 28 additions and 6 deletions

View File

@@ -717,7 +717,9 @@ class AccountsController(TransactionBase):
total_billed_amt = abs(total_billed_amt)
max_allowed_amt = abs(max_allowed_amt)
if total_billed_amt - max_allowed_amt > 0.01:
role_allowed_to_over_bill = frappe.db.get_single_value('Accounts Settings', 'role_allowed_to_over_bill')
if total_billed_amt - max_allowed_amt > 0.01 and role_allowed_to_over_bill not in frappe.get_roles():
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set allowance in Accounts Settings")
.format(item.item_code, item.idx, max_allowed_amt))