Skip to content

Commit

Permalink
fix: renamed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Afshan committed Jun 23, 2021
1 parent 11d0032 commit e1dcfef
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions erpnext/buying/doctype/buying_settings/buying_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"pr_required",
"maintain_same_rate",
"allow_multiple_items",
"consider_rejected_quantity_in_purchase_invoice",
"bill_for_rejected_quantity_in_purchase_invoice",
"subcontract",
"backflush_raw_materials_of_subcontract_based_on",
"column_break_11",
Expand Down Expand Up @@ -112,18 +112,18 @@
},
{
"default": "1",
"description": "If checked, Rejected Quantity will be considered while making Purchase Invoice from Purchase Receipt.",
"fieldname": "consider_rejected_quantity_in_purchase_invoice",
"description": "If checked, Rejected Quantity will be included while making Purchase Invoice from Purchase Receipt.",
"fieldname": "bill_for_rejected_quantity_in_purchase_invoice",
"fieldtype": "Check",
"label": "Consider Rejected Quantity in Purchase Invoice"
"label": "Bill for Rejected Quantity in Purchase Invoice"
}
],
"icon": "fa fa-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2021-06-17 17:17:40.024658",
"modified": "2021-06-23 19:40:00.120822",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",
Expand Down
2 changes: 1 addition & 1 deletion erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield):
if total_billed_amt - max_allowed_amt > 0.01 and role_allowed_to_over_bill not in frappe.get_roles():
if self.doctype != "Purchase Invoice":
self.throw_overbill_exception(item, max_allowed_amt)
elif not cint(frappe.db.get_single_value("Buying Settings", "consider_rejected_quantity_in_purchase_invoice")):
elif not cint(frappe.db.get_single_value("Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice")):
self.throw_overbill_exception(item, max_allowed_amt)

def throw_overbill_exception(self, item, max_allowed_amt):
Expand Down
2 changes: 1 addition & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,5 @@ execute:frappe.rename_doc("Workspace", "Loan Management", "Loans", force=True)
erpnext.patches.v13_0.update_timesheet_changes
erpnext.patches.v13_0.add_doctype_to_sla #14-06-2021
erpnext.patches.v13_0.set_training_event_attendance
erpnext.patches.v13_0.consider_rejected_quantity_in_purchase_invoice
erpnext.patches.v13_0.bill_for_rejected_quantity_in_purchase_invoice
erpnext.patches.v13_0.rename_issue_status_hold_to_on_hold
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
def execute():
frappe.reload_doctype("Buying Settings")
buying_settings = frappe.get_single("Buying Settings")
buying_settings.consider_rejected_quantity_in_purchase_invoice = 0
buying_settings.bill_for_rejected_quantity_in_purchase_invoice = 0
buying_settings.save()
4 changes: 2 additions & 2 deletions erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,14 @@ def set_missing_values(source, target):

def update_item(source_doc, target_doc, source_parent):
target_doc.qty, returned_qty = get_pending_qty(source_doc)
if frappe.db.get_single_value("Buying Settings", "consider_rejected_quantity_in_purchase_invoice"):
if frappe.db.get_single_value("Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice"):
target_doc.rejected_qty = 0
target_doc.stock_qty = flt(target_doc.qty) * flt(target_doc.conversion_factor, target_doc.precision("conversion_factor"))
returned_qty_map[source_doc.name] = returned_qty

def get_pending_qty(item_row):
qty = item_row.qty
if frappe.db.get_single_value("Buying Settings", "consider_rejected_quantity_in_purchase_invoice"):
if frappe.db.get_single_value("Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice"):
qty = item_row.received_qty
pending_qty = qty - invoiced_qty_map.get(item_row.name, 0)
returned_qty = flt(returned_qty_map.get(item_row.name, 0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ def test_purchase_return_partial(self):

# Make PI against unreturned amount
buying_settings = frappe.get_single("Buying Settings")
buying_settings.consider_rejected_quantity_in_purchase_invoice = 0
buying_settings.bill_for_rejected_quantity_in_purchase_invoice = 0
buying_settings.save()

pi = make_purchase_invoice(pr.name)
pi.submit()

self.assertEqual(pi.items[0].qty, 3)

buying_settings.consider_rejected_quantity_in_purchase_invoice = 1
buying_settings.bill_for_rejected_quantity_in_purchase_invoice = 1
buying_settings.save()

pr.load_from_db()
Expand Down

0 comments on commit e1dcfef

Please sign in to comment.