Skip to content

Commit

Permalink
Merge pull request frappe#37669 from s-aga-r/FIX-37664
Browse files Browse the repository at this point in the history
refactor: rename field `Over Order Allowance` to `Blanket Order Allowance`
  • Loading branch information
s-aga-r authored Oct 25, 2023
2 parents 2bcff4c + fcfcf69 commit 787fc87
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 21 deletions.
18 changes: 9 additions & 9 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 @@
"transaction_settings_section",
"po_required",
"pr_required",
"over_order_allowance",
"blanket_order_allowance",
"column_break_12",
"maintain_same_rate",
"set_landed_cost_based_on_purchase_invoice_rate",
Expand Down Expand Up @@ -159,27 +159,27 @@
"fieldtype": "Check",
"label": "Set Landed Cost Based on Purchase Invoice Rate"
},
{
"default": "0",
"description": "Percentage you are allowed to order more against the Blanket Order Quantity. For example: If you have a Blanket Order of Quantity 100 units. and your Allowance is 10% then you are allowed to order 110 units.",
"fieldname": "over_order_allowance",
"fieldtype": "Float",
"label": "Over Order Allowance (%)"
},
{
"default": "0",
"description": "While making Purchase Invoice from Purchase Order, use Exchange Rate on Invoice's transaction date rather than inheriting it from Purchase Order. Only applies for Purchase Invoice.",
"fieldname": "use_transaction_date_exchange_rate",
"fieldtype": "Check",
"label": "Use Transaction Date Exchange Rate"
},
{
"default": "0",
"description": "Percentage you are allowed to order beyond the Blanket Order quantity.",
"fieldname": "blanket_order_allowance",
"fieldtype": "Float",
"label": "Blanket Order Allowance (%)"
}
],
"icon": "fa fa-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-10-16 16:22:03.201078",
"modified": "2023-10-25 14:03:32.520418",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def validate_against_blanket_order(order_doc):
allowance = flt(
frappe.db.get_single_value(
"Selling Settings" if order_doc.doctype == "Sales Order" else "Buying Settings",
"over_order_allowance",
"blanket_order_allowance",
)
)
for bo_name, item_data in order_data.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_purchase_order_creation(self):
po1.currency = get_company_currency(po1.company)
self.assertEqual(po1.items[0].qty, (bo.items[0].qty - bo.items[0].ordered_qty))

def test_over_order_allowance(self):
def test_blanket_order_allowance(self):
# Sales Order
bo = make_blanket_order(blanket_order_type="Selling", quantity=100)

Expand All @@ -74,7 +74,7 @@ def test_over_order_allowance(self):
so.items[0].qty = 110
self.assertRaises(frappe.ValidationError, so.submit)

frappe.db.set_single_value("Selling Settings", "over_order_allowance", 10)
frappe.db.set_single_value("Selling Settings", "blanket_order_allowance", 10)
so.submit()

# Purchase Order
Expand All @@ -87,7 +87,7 @@ def test_over_order_allowance(self):
po.items[0].qty = 110
self.assertRaises(frappe.ValidationError, po.submit)

frappe.db.set_single_value("Buying Settings", "over_order_allowance", 10)
frappe.db.set_single_value("Buying Settings", "blanket_order_allowance", 10)
po.submit()


Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,6 @@ execute:frappe.delete_doc("Page", "welcome-to-erpnext")
erpnext.patches.v15_0.delete_payment_gateway_doctypes
erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item
erpnext.patches.v15_0.update_sre_from_voucher_details
erpnext.patches.v14_0.rename_over_order_allowance_field
# below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
15 changes: 15 additions & 0 deletions erpnext/patches/v14_0/rename_over_order_allowance_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from frappe.model.utils.rename_field import rename_field


def execute():
rename_field(
"Buying Settings",
"over_order_allowance",
"blanket_order_allowance",
)

rename_field(
"Selling Settings",
"over_order_allowance",
"blanket_order_allowance",
)
16 changes: 8 additions & 8 deletions erpnext/selling/doctype/selling_settings/selling_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"so_required",
"dn_required",
"sales_update_frequency",
"over_order_allowance",
"blanket_order_allowance",
"column_break_5",
"allow_multiple_items",
"allow_against_multiple_purchase_orders",
Expand Down Expand Up @@ -183,12 +183,6 @@
"fieldtype": "Check",
"label": "Allow Sales Order Creation For Expired Quotation"
},
{
"description": "Percentage you are allowed to order more against the Blanket Order Quantity. For example: If you have a Blanket Order of Quantity 100 units. and your Allowance is 10% then you are allowed to order 110 units.",
"fieldname": "over_order_allowance",
"fieldtype": "Float",
"label": "Over Order Allowance (%)"
},
{
"default": "0",
"fieldname": "dont_reserve_sales_order_qty_on_sales_return",
Expand All @@ -200,14 +194,20 @@
"fieldname": "allow_negative_rates_for_items",
"fieldtype": "Check",
"label": "Allow Negative rates for Items"
},
{
"description": "Percentage you are allowed to sell beyond the Blanket Order quantity.",
"fieldname": "blanket_order_allowance",
"fieldtype": "Float",
"label": "Blanket Order Allowance (%)"
}
],
"icon": "fa fa-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-08-14 20:33:05.693667",
"modified": "2023-10-25 14:03:03.966701",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",
Expand Down

0 comments on commit 787fc87

Please sign in to comment.