mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 11:55:11 +00:00
fix: allow allowed roles to bypass over billing validation
(cherry picked from commit 04127019f9)
This commit is contained in:
@@ -1246,7 +1246,9 @@ def get_billed_amount_against_po(po_items):
|
|||||||
def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate=False):
|
def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate=False):
|
||||||
# Update Billing % based on pending accepted qty
|
# Update Billing % based on pending accepted qty
|
||||||
buying_settings = frappe.get_single("Buying Settings")
|
buying_settings = frappe.get_single("Buying Settings")
|
||||||
over_billing_allowance = frappe.get_single_value("Accounts Settings", "over_billing_allowance")
|
over_billing_allowance, role_allowed_to_over_bill = frappe.get_single_value(
|
||||||
|
"Accounts Settings", ["over_billing_allowance", "role_allowed_to_over_bill"]
|
||||||
|
)
|
||||||
|
|
||||||
total_amount, total_billed_amount, pi_landed_cost_amount = 0, 0, 0
|
total_amount, total_billed_amount, pi_landed_cost_amount = 0, 0, 0
|
||||||
item_wise_returned_qty = get_item_wise_returned_qty(pr_doc)
|
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
|
|||||||
item.db_set("amount_difference_with_purchase_invoice", adjusted_amt, update_modified=False)
|
item.db_set("amount_difference_with_purchase_invoice", adjusted_amt, update_modified=False)
|
||||||
elif amount and item.billed_amt > amount:
|
elif amount and item.billed_amt > amount:
|
||||||
per_over_billed = (flt(item.billed_amt / amount, 2) * 100) - 100
|
per_over_billed = (flt(item.billed_amt / amount, 2) * 100) - 100
|
||||||
if per_over_billed > over_billing_allowance:
|
if (
|
||||||
|
per_over_billed > over_billing_allowance
|
||||||
|
and role_allowed_to_over_bill not in frappe.get_roles()
|
||||||
|
):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Over Billing Allowance exceeded for Purchase Receipt Item {0} ({1}) by {2}%").format(
|
_("Over Billing Allowance exceeded for Purchase Receipt Item {0} ({1}) by {2}%").format(
|
||||||
item.name, frappe.bold(item.item_code), per_over_billed - over_billing_allowance
|
item.name, frappe.bold(item.item_code), per_over_billed - over_billing_allowance
|
||||||
|
|||||||
Reference in New Issue
Block a user