@@ -1246,7 +1246,9 @@ def get_billed_amount_against_po(po_items):
12461246def 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