refactor: brand js and allow quick entry (backport #42829) (#42830)

* refactor: brand js and allow quick entry (#42829)

* refactor: brand js and allow quick entry

* refactor: brand js and allow quick entry --prettier

* refactor: brand js and allow quick entry --prettier

(cherry picked from commit a1183f0165)

# Conflicts:
#	erpnext/setup/doctype/brand/brand.json

* refactor: brand js and allow quick entry --refactor

---------

Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2024-08-20 15:03:23 +05:30
committed by GitHub
parent 69878b7847
commit ae6c1a30ac
2 changed files with 17 additions and 44 deletions

View File

@@ -3,22 +3,14 @@
frappe.ui.form.on("Brand", {
setup: (frm) => {
frm.fields_dict["brand_defaults"].grid.get_field("default_warehouse").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("default_warehouse", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: { company: row.company },
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("default_discount_account").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("default_discount_account", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: {
@@ -27,13 +19,9 @@ frappe.ui.form.on("Brand", {
is_group: 0,
},
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("buying_cost_center").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("buying_cost_center", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: {
@@ -41,25 +29,17 @@ frappe.ui.form.on("Brand", {
company: row.company,
},
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("expense_account").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("expense_account", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
query: "erpnext.controllers.queries.get_expense_account",
filters: { company: row.company },
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("default_provisional_account").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("default_provisional_account", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: {
@@ -68,13 +48,9 @@ frappe.ui.form.on("Brand", {
is_group: 0,
},
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("selling_cost_center").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("selling_cost_center", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
filters: {
@@ -82,18 +58,14 @@ frappe.ui.form.on("Brand", {
company: row.company,
},
};
};
});
frm.fields_dict["brand_defaults"].grid.get_field("income_account").get_query = function (
doc,
cdt,
cdn
) {
frm.set_query("income_account", "brand_defaults", function (doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
query: "erpnext.controllers.queries.get_income_account",
filters: { company: row.company },
};
};
});
},
});

View File

@@ -56,10 +56,11 @@
"idx": 1,
"image_field": "image",
"links": [],
"modified": "2021-03-01 15:57:30.005783",
"modified": "2024-08-20 14:10:21.377962",
"modified_by": "Administrator",
"module": "Setup",
"name": "Brand",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
@@ -108,4 +109,4 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "ASC"
}
}