Merge pull request #31101 from alyf-de/fix-warehouse-js

fix: Improve button labels in Warehouse
This commit is contained in:
Ankush Menat 2022-05-26 18:14:49 +05:30 committed by GitHub
commit e3c0d0134e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 60 deletions

View File

@ -1,88 +1,97 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Warehouse", { frappe.ui.form.on("Warehouse", {
onload: function(frm) { setup: function (frm) {
frm.set_query("default_in_transit_warehouse", function() { frm.set_query("default_in_transit_warehouse", function (doc) {
return { return {
filters:{ filters: {
'warehouse_type' : 'Transit', warehouse_type: "Transit",
'is_group': 0, is_group: 0,
'company': frm.doc.company company: doc.company,
} },
};
});
frm.set_query("parent_warehouse", function () {
return {
filters: {
is_group: 1,
},
};
});
frm.set_query("account", function (doc) {
return {
filters: {
is_group: 0,
account_type: "Stock",
company: doc.company,
},
}; };
}); });
}, },
refresh: function(frm) { refresh: function (frm) {
frm.toggle_display('warehouse_name', frm.doc.__islocal); frm.toggle_display("warehouse_name", frm.doc.__islocal);
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal); frm.toggle_display(
["address_html", "contact_html"],
!frm.doc.__islocal
);
if (!frm.doc.__islocal) {
if(!frm.doc.__islocal) {
frappe.contacts.render_address_and_contact(frm); frappe.contacts.render_address_and_contact(frm);
} else { } else {
frappe.contacts.clear_address_and_contact(frm); frappe.contacts.clear_address_and_contact(frm);
} }
frm.add_custom_button(__("Stock Balance"), function() { frm.add_custom_button(__("Stock Balance"), function () {
frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name}); frappe.set_route("query-report", "Stock Balance", {
warehouse: frm.doc.name,
});
}); });
if (cint(frm.doc.is_group) == 1) { frm.add_custom_button(
frm.add_custom_button(__('Group to Non-Group'), frm.doc.is_group
function() { convert_to_group_or_ledger(frm); }, 'fa fa-retweet', 'btn-default') ? __("Convert to Ledger", null, "Warehouse")
} else if (cint(frm.doc.is_group) == 0) { : __("Convert to Group", null, "Warehouse"),
if(frm.doc.__onload && frm.doc.__onload.account) { function () {
frm.add_custom_button(__("General Ledger"), function() { convert_to_group_or_ledger(frm);
},
);
if (!frm.doc.is_group && frm.doc.__onload && frm.doc.__onload.account) {
frm.add_custom_button(
__("General Ledger", null, "Warehouse"),
function () {
frappe.route_options = { frappe.route_options = {
"account": frm.doc.__onload.account, account: frm.doc.__onload.account,
"company": frm.doc.company company: frm.doc.company,
} };
frappe.set_route("query-report", "General Ledger"); frappe.set_route("query-report", "General Ledger");
});
}
frm.add_custom_button(__('Non-Group to Group'),
function() { convert_to_group_or_ledger(frm); }, 'fa fa-retweet', 'btn-default')
}
frm.toggle_enable(['is_group', 'company'], false);
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Warehouse'};
frm.fields_dict['parent_warehouse'].get_query = function(doc) {
return {
filters: {
"is_group": 1,
} }
} );
} }
frm.fields_dict['account'].get_query = function(doc) { frm.toggle_enable(["is_group", "company"], false);
return {
filters: { frappe.dynamic_link = {
"is_group": 0, doc: frm.doc,
"account_type": "Stock", fieldname: "name",
"company": frm.doc.company doctype: "Warehouse",
} };
} },
}
}
}); });
function convert_to_group_or_ledger(frm){ function convert_to_group_or_ledger(frm) {
frappe.call({ frappe.call({
method:"erpnext.stock.doctype.warehouse.warehouse.convert_to_group_or_ledger", method: "erpnext.stock.doctype.warehouse.warehouse.convert_to_group_or_ledger",
args: { args: {
docname: frm.doc.name, docname: frm.doc.name,
is_group: frm.doc.is_group is_group: frm.doc.is_group,
}, },
callback: function(){ callback: function () {
frm.refresh(); frm.refresh();
} },
});
})
} }

View File

@ -1178,7 +1178,7 @@ Group by Party,Gruppieren nach Partei,
Group by Voucher,Gruppieren nach Beleg, Group by Voucher,Gruppieren nach Beleg,
Group by Voucher (Consolidated),Gruppieren nach Beleg (konsolidiert), Group by Voucher (Consolidated),Gruppieren nach Beleg (konsolidiert),
Group node warehouse is not allowed to select for transactions,Gruppenknoten Lager ist nicht für Transaktionen zu wählen erlaubt, Group node warehouse is not allowed to select for transactions,Gruppenknoten Lager ist nicht für Transaktionen zu wählen erlaubt,
Group to Non-Group,Gruppe an konzernfremde, Convert to Ledger,In Lagerbuch umwandeln,Warehouse
Group your students in batches,Gruppieren Sie Ihre Schüler in den Reihen, Group your students in batches,Gruppieren Sie Ihre Schüler in den Reihen,
Groups,Gruppen, Groups,Gruppen,
Guardian1 Email ID,Guardian1 E-Mail-ID, Guardian1 Email ID,Guardian1 E-Mail-ID,
@ -1735,7 +1735,6 @@ Non GST Inward Supplies,Nicht GST Inward Supplies,
Non Profit,Gemeinnützig, Non Profit,Gemeinnützig,
Non Profit (beta),Non-Profit (Beta), Non Profit (beta),Non-Profit (Beta),
Non-GST outward supplies,Nicht-GST-Lieferungen nach außen, Non-GST outward supplies,Nicht-GST-Lieferungen nach außen,
Non-Group to Group,Non-Group-Gruppe,
None,Keiner, None,Keiner,
None of the items have any change in quantity or value.,Keiner der Artikel hat irgendeine Änderung bei Mengen oder Kosten., None of the items have any change in quantity or value.,Keiner der Artikel hat irgendeine Änderung bei Mengen oder Kosten.,
Nos,Stk, Nos,Stk,

Can't render this file because it is too large.