Skip to content

Commit c274b7c

Browse files
mihir-kandoimergify[bot]
authored andcommitted
fix: allow allowed roles to bypass over billing validation
(cherry picked from commit 0412701)
1 parent 1c4e20f commit c274b7c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

erpnext/stock/doctype/purchase_receipt/purchase_receipt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,9 @@ def get_billed_amount_against_po(po_items):
12461246
def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate=False):
12471247
# Update Billing % based on pending accepted qty
12481248
buying_settings = frappe.get_single("Buying Settings")
1249-
over_billing_allowance = frappe.get_single_value("Accounts Settings", "over_billing_allowance")
1249+
over_billing_allowance, role_allowed_to_over_bill = frappe.get_single_value(
1250+
"Accounts Settings", ["over_billing_allowance", "role_allowed_to_over_bill"]
1251+
)
12501252

12511253
total_amount, total_billed_amount, pi_landed_cost_amount = 0, 0, 0
12521254
item_wise_returned_qty = get_item_wise_returned_qty(pr_doc)
@@ -1304,7 +1306,10 @@ def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate
13041306
item.db_set("amount_difference_with_purchase_invoice", adjusted_amt, update_modified=False)
13051307
elif amount and item.billed_amt > amount:
13061308
per_over_billed = (flt(item.billed_amt / amount, 2) * 100) - 100
1307-
if per_over_billed > over_billing_allowance:
1309+
if (
1310+
per_over_billed > over_billing_allowance
1311+
and role_allowed_to_over_bill not in frappe.get_roles()
1312+
):
13081313
frappe.throw(
13091314
_("Over Billing Allowance exceeded for Purchase Receipt Item {0} ({1}) by {2}%").format(
13101315
item.name, frappe.bold(item.item_code), per_over_billed - over_billing_allowance

0 commit comments

Comments
 (0)