Fix in warehouse query

This commit is contained in:
Anand Doshi 2014-06-25 13:29:43 +05:30
parent aa1edfb6ae
commit 610a405c85
2 changed files with 12 additions and 6 deletions

View File

@ -13,14 +13,19 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({
setup_warehouse_query: function() {
var me = this;
var warehouse_query_method = function() {
return erpnext.queries.warehouse(me.frm.doc);
};
var _set_warehouse_query = function(doctype, parentfield) {
var warehouse_link_fields = frappe.meta.get_docfields(doctype, me.frm.doc.name,
{"fieldtype": "Link", "options": "Warehouse"});
$.each(warehouse_link_fields, function(i, df) {
me.frm.set_query(df.fieldname, parentfield, function() {
return erpnext.queries.warehouse(me.frm.doc);
})
if(parentfield) {
me.frm.set_query(df.fieldname, parentfield, warehouse_query_method);
} else {
me.frm.set_query(df.fieldname, warehouse_query_method);
}
});
};

View File

@ -12,6 +12,7 @@ cur_frm.cscript.sales_team_fname = "sales_team";
{% include 'accounts/doctype/sales_invoice/pos.js' %}
frappe.provide("erpnext.stock");
frappe.provide("erpnext.stock.delivery_note");
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
@ -40,7 +41,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
cur_frm.add_custom_button(__('Make Packing Slip'), cur_frm.cscript['Make Packing Slip']);
}
set_print_hide(doc, dt, dn);
erpnext.stock.delivery_note.set_print_hide(doc, dt, dn);
// unhide expense_account and cost_center is auto_accounting_for_stock enabled
var aii_enabled = cint(sys_defaults.auto_accounting_for_stock)
@ -124,7 +125,7 @@ cur_frm.cscript['Make Packing Slip'] = function() {
})
}
var set_print_hide= function(doc, cdt, cdn){
erpnext.stock.delivery_note.set_print_hide = function(doc, cdt, cdn){
var dn_fields = frappe.meta.docfield_map['Delivery Note'];
var dn_item_fields = frappe.meta.docfield_map['Delivery Note Item'];
var dn_fields_copy = dn_fields;
@ -147,7 +148,7 @@ var set_print_hide= function(doc, cdt, cdn){
}
cur_frm.cscript.print_without_amount = function(doc, cdt, cdn) {
set_print_hide(doc, cdt, cdn);
erpnext.stock.delivery_note.set_print_hide(doc, cdt, cdn);
}