mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 16:15:02 +00:00
fix: fetch from parent optional in inventory dimension
(cherry picked from commit 8aac6a6b18)
# Conflicts:
# erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
This commit is contained in:
committed by
Mergify
parent
711e06b537
commit
bb901cab88
@@ -75,7 +75,9 @@ frappe.ui.form.on("Inventory Dimension", {
|
||||
|
||||
set_parent_fields(frm) {
|
||||
if (frm.doc.apply_to_all_doctypes) {
|
||||
frm.set_df_property("fetch_from_parent", "options", frm.doc.reference_document);
|
||||
let options = ["\n", frm.doc.reference_document];
|
||||
|
||||
frm.set_df_property("fetch_from_parent", "options", options);
|
||||
} else if (frm.doc.document_type && frm.doc.istable) {
|
||||
frappe.call({
|
||||
method: "erpnext.stock.doctype.inventory_dimension.inventory_dimension.get_parent_fields",
|
||||
@@ -85,7 +87,7 @@ frappe.ui.form.on("Inventory Dimension", {
|
||||
},
|
||||
callback: (r) => {
|
||||
if (r.message && r.message.length) {
|
||||
frm.set_df_property("fetch_from_parent", "options", [""].concat(r.message));
|
||||
frm.set_df_property("fetch_from_parent", "options", ["\n"].concat(r.message));
|
||||
} else {
|
||||
frm.set_df_property("fetch_from_parent", "hidden", 1);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,6 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.apply_to_all_doctypes",
|
||||
"description": "Set fieldname from which you want to fetch the data from the parent form.",
|
||||
"fieldname": "fetch_from_parent",
|
||||
"fieldtype": "Select",
|
||||
@@ -189,7 +188,11 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
<<<<<<< HEAD
|
||||
"modified": "2023-10-05 12:52:18.705431",
|
||||
=======
|
||||
"modified": "2025-07-07 15:51:29.329064",
|
||||
>>>>>>> 8aac6a6b18 (fix: fetch from parent optional in inventory dimension)
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Inventory Dimension",
|
||||
@@ -233,7 +236,12 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
<<<<<<< HEAD
|
||||
"sort_field": "modified",
|
||||
=======
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
>>>>>>> 8aac6a6b18 (fix: fetch from parent optional in inventory dimension)
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,16 +40,11 @@ class InventoryDimension(Document):
|
||||
self.reset_value()
|
||||
self.set_source_and_target_fieldname()
|
||||
self.set_type_of_transaction()
|
||||
self.set_fetch_value_from()
|
||||
|
||||
def set_type_of_transaction(self):
|
||||
if self.apply_to_all_doctypes:
|
||||
self.type_of_transaction = "Both"
|
||||
|
||||
def set_fetch_value_from(self):
|
||||
if self.apply_to_all_doctypes:
|
||||
self.fetch_from_parent = self.reference_document
|
||||
|
||||
def do_not_update_document(self):
|
||||
if self.is_new() or not self.has_stock_ledger():
|
||||
return
|
||||
|
||||
@@ -154,6 +154,8 @@ class TestInventoryDimension(FrappeTestCase):
|
||||
reference_document="Rack", dimension_name="Rack", apply_to_all_doctypes=1
|
||||
)
|
||||
|
||||
inv_dimension.db_set("fetch_from_parent", "Rack")
|
||||
|
||||
self.assertEqual(inv_dimension.type_of_transaction, "Both")
|
||||
self.assertEqual(inv_dimension.fetch_from_parent, "Rack")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user