mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-25 17:48:30 +00:00
feat: allow UOMs to select for which converstion rate defined in item master
(cherry picked from commit b1dfbbe85e)
# Conflicts:
# erpnext/stock/doctype/stock_settings/stock_settings.json
This commit is contained in:
committed by
Mergify
parent
a60acbc592
commit
288aad6f5d
@@ -898,3 +898,32 @@ def get_filtered_child_rows(doctype, txt, searchfield, start, page_len, filters)
|
|||||||
)
|
)
|
||||||
|
|
||||||
return query.run(as_dict=False)
|
return query.run(as_dict=False)
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
@frappe.validate_and_sanitize_search_inputs
|
||||||
|
def get_item_uom_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
if frappe.db.get_single_value("Stock Settings", "allow_uom_with_conversion_rate_defined_in_item"):
|
||||||
|
query_filters = {"parent": filters.get("item_code")}
|
||||||
|
|
||||||
|
if txt:
|
||||||
|
query_filters["uom"] = ["like", f"%{txt}%"]
|
||||||
|
|
||||||
|
return frappe.get_all(
|
||||||
|
"UOM Conversion Detail",
|
||||||
|
filters=query_filters,
|
||||||
|
fields=["uom", "conversion_factor"],
|
||||||
|
limit_start=start,
|
||||||
|
limit_page_length=page_len,
|
||||||
|
order_by="idx",
|
||||||
|
as_list=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
return frappe.get_all(
|
||||||
|
"UOM",
|
||||||
|
filters={"name": ["like", f"%{txt}%"]},
|
||||||
|
fields=["name"],
|
||||||
|
limit_start=start,
|
||||||
|
limit_page_length=page_len,
|
||||||
|
as_list=1,
|
||||||
|
)
|
||||||
|
|||||||
@@ -150,6 +150,19 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.frm.fields_dict["items"].grid.get_field("uom")) {
|
||||||
|
this.frm.set_query("uom", "items", function(doc, cdt, cdn) {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
|
||||||
|
return {
|
||||||
|
query: "erpnext.controllers.queries.get_item_uom_query",
|
||||||
|
filters: {
|
||||||
|
"item_code": row.item_code
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(
|
if(
|
||||||
this.frm.docstatus < 2
|
this.frm.docstatus < 2
|
||||||
&& this.frm.fields_dict["payment_terms_template"]
|
&& this.frm.fields_dict["payment_terms_template"]
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
"allow_to_edit_stock_uom_qty_for_sales",
|
"allow_to_edit_stock_uom_qty_for_sales",
|
||||||
"column_break_lznj",
|
"column_break_lznj",
|
||||||
"allow_to_edit_stock_uom_qty_for_purchase",
|
"allow_to_edit_stock_uom_qty_for_purchase",
|
||||||
|
"section_break_ylhd",
|
||||||
|
"allow_uom_with_conversion_rate_defined_in_item",
|
||||||
"stock_validations_tab",
|
"stock_validations_tab",
|
||||||
"section_break_9",
|
"section_break_9",
|
||||||
"over_delivery_receipt_allowance",
|
"over_delivery_receipt_allowance",
|
||||||
@@ -490,6 +492,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_wslv",
|
"fieldname": "column_break_wslv",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_ylhd",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"description": "If enabled, the system will allow selecting UOMs in sales and purchase transactions only if the conversion rate is set in the item master.",
|
||||||
|
"fieldname": "allow_uom_with_conversion_rate_defined_in_item",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Allow UOM with Conversion Rate Defined in Item"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@@ -497,7 +510,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
|
<<<<<<< HEAD
|
||||||
"modified": "2025-02-28 16:08:35.938840",
|
"modified": "2025-02-28 16:08:35.938840",
|
||||||
|
=======
|
||||||
|
"modified": "2025-03-31 15:34:20.752065",
|
||||||
|
>>>>>>> b1dfbbe85e (feat: allow UOMs to select for which converstion rate defined in item master)
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Settings",
|
"name": "Stock Settings",
|
||||||
@@ -518,7 +535,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
|
<<<<<<< HEAD
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
=======
|
||||||
|
"row_format": "Dynamic",
|
||||||
|
"sort_field": "creation",
|
||||||
|
>>>>>>> b1dfbbe85e (feat: allow UOMs to select for which converstion rate defined in item master)
|
||||||
"sort_order": "ASC",
|
"sort_order": "ASC",
|
||||||
"states": [],
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class StockSettings(Document):
|
|||||||
allow_partial_reservation: DF.Check
|
allow_partial_reservation: DF.Check
|
||||||
allow_to_edit_stock_uom_qty_for_purchase: DF.Check
|
allow_to_edit_stock_uom_qty_for_purchase: DF.Check
|
||||||
allow_to_edit_stock_uom_qty_for_sales: DF.Check
|
allow_to_edit_stock_uom_qty_for_sales: DF.Check
|
||||||
|
allow_uom_with_conversion_rate_defined_in_item: DF.Check
|
||||||
auto_create_serial_and_batch_bundle_for_outward: DF.Check
|
auto_create_serial_and_batch_bundle_for_outward: DF.Check
|
||||||
auto_indent: DF.Check
|
auto_indent: DF.Check
|
||||||
auto_insert_price_list_rate_if_missing: DF.Check
|
auto_insert_price_list_rate_if_missing: DF.Check
|
||||||
|
|||||||
Reference in New Issue
Block a user