fix: improve labels, simplify logic
This commit is contained in:
parent
c704ad889d
commit
a6ddd86d31
@ -33,34 +33,25 @@ frappe.ui.form.on("Warehouse", {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cint(frm.doc.is_group) == 1) {
|
frm.add_custom_button(
|
||||||
frm.add_custom_button(
|
frm.doc.is_group
|
||||||
__("Group to Non-Group"),
|
? __("Convert to Ledger", null, "Warehouse")
|
||||||
function () {
|
: __("Convert to Group", null, "Warehouse"),
|
||||||
convert_to_group_or_ledger(frm);
|
function () {
|
||||||
},
|
convert_to_group_or_ledger(frm);
|
||||||
"fa fa-retweet",
|
},
|
||||||
"btn-default"
|
"fa fa-retweet",
|
||||||
);
|
"btn-default"
|
||||||
} else if (cint(frm.doc.is_group) == 0) {
|
);
|
||||||
if (frm.doc.__onload && frm.doc.__onload.account) {
|
|
||||||
frm.add_custom_button(__("General Ledger"), function () {
|
|
||||||
frappe.route_options = {
|
|
||||||
account: frm.doc.__onload.account,
|
|
||||||
company: frm.doc.company,
|
|
||||||
};
|
|
||||||
frappe.set_route("query-report", "General Ledger");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
frm.add_custom_button(
|
if (!frm.doc.is_group && frm.doc.__onload && frm.doc.__onload.account) {
|
||||||
__("Non-Group to Group"),
|
frm.add_custom_button(__("General Ledger", null, "Warehouse"), function () {
|
||||||
function () {
|
frappe.route_options = {
|
||||||
convert_to_group_or_ledger(frm);
|
account: frm.doc.__onload.account,
|
||||||
},
|
company: frm.doc.company,
|
||||||
"fa fa-retweet",
|
};
|
||||||
"btn-default"
|
frappe.set_route("query-report", "General Ledger");
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.toggle_enable(["is_group", "company"], false);
|
frm.toggle_enable(["is_group", "company"], false);
|
||||||
@ -84,7 +75,7 @@ frappe.ui.form.on("Warehouse", {
|
|||||||
filters: {
|
filters: {
|
||||||
is_group: 0,
|
is_group: 0,
|
||||||
account_type: "Stock",
|
account_type: "Stock",
|
||||||
company: frm.doc.company,
|
company: doc.company,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user