diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js index 9243e1ed84..d69c624fba 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.js +++ b/erpnext/stock/doctype/warehouse/warehouse.js @@ -1,88 +1,97 @@ // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt - frappe.ui.form.on("Warehouse", { - onload: function(frm) { - frm.set_query("default_in_transit_warehouse", function() { + setup: function (frm) { + frm.set_query("default_in_transit_warehouse", function (doc) { return { - filters:{ - 'warehouse_type' : 'Transit', - 'is_group': 0, - 'company': frm.doc.company - } + filters: { + warehouse_type: "Transit", + is_group: 0, + 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) { - frm.toggle_display('warehouse_name', frm.doc.__islocal); - frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal); + refresh: function (frm) { + frm.toggle_display("warehouse_name", 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); - } else { frappe.contacts.clear_address_and_contact(frm); } - frm.add_custom_button(__("Stock Balance"), function() { - frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name}); + frm.add_custom_button(__("Stock Balance"), function () { + frappe.set_route("query-report", "Stock Balance", { + warehouse: frm.doc.name, + }); }); - if (cint(frm.doc.is_group) == 1) { - frm.add_custom_button(__('Group to Non-Group'), - function() { convert_to_group_or_ledger(frm); }, '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() { + frm.add_custom_button( + frm.doc.is_group + ? __("Convert to Ledger", null, "Warehouse") + : __("Convert to Group", null, "Warehouse"), + 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 = { - "account": frm.doc.__onload.account, - "company": frm.doc.company - } + account: frm.doc.__onload.account, + company: frm.doc.company, + }; 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) { - return { - filters: { - "is_group": 0, - "account_type": "Stock", - "company": frm.doc.company - } - } - } - } + frm.toggle_enable(["is_group", "company"], false); + + frappe.dynamic_link = { + doc: frm.doc, + fieldname: "name", + doctype: "Warehouse", + }; + }, }); -function convert_to_group_or_ledger(frm){ +function convert_to_group_or_ledger(frm) { 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: { docname: frm.doc.name, - is_group: frm.doc.is_group + is_group: frm.doc.is_group, }, - callback: function(){ + callback: function () { frm.refresh(); - } - - }) + }, + }); } diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv index 07fdd6589a..45bc6c2d8a 100644 --- a/erpnext/translations/de.csv +++ b/erpnext/translations/de.csv @@ -1178,7 +1178,7 @@ Group by Party,Gruppieren nach Partei, Group by Voucher,Gruppieren nach Beleg, 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 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, Groups,Gruppen, 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 (beta),Non-Profit (Beta), Non-GST outward supplies,Nicht-GST-Lieferungen nach außen, -Non-Group to Group,Non-Group-Gruppe, None,Keiner, None of the items have any change in quantity or value.,Keiner der Artikel hat irgendeine Änderung bei Mengen oder Kosten., Nos,Stk,