mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Fix in warehouse query
This commit is contained in:
@@ -13,14 +13,19 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
setup_warehouse_query: function() {
|
setup_warehouse_query: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
var warehouse_query_method = function() {
|
||||||
|
return erpnext.queries.warehouse(me.frm.doc);
|
||||||
|
};
|
||||||
|
|
||||||
var _set_warehouse_query = function(doctype, parentfield) {
|
var _set_warehouse_query = function(doctype, parentfield) {
|
||||||
var warehouse_link_fields = frappe.meta.get_docfields(doctype, me.frm.doc.name,
|
var warehouse_link_fields = frappe.meta.get_docfields(doctype, me.frm.doc.name,
|
||||||
{"fieldtype": "Link", "options": "Warehouse"});
|
{"fieldtype": "Link", "options": "Warehouse"});
|
||||||
$.each(warehouse_link_fields, function(i, df) {
|
$.each(warehouse_link_fields, function(i, df) {
|
||||||
me.frm.set_query(df.fieldname, parentfield, function() {
|
if(parentfield) {
|
||||||
return erpnext.queries.warehouse(me.frm.doc);
|
me.frm.set_query(df.fieldname, parentfield, warehouse_query_method);
|
||||||
})
|
} else {
|
||||||
|
me.frm.set_query(df.fieldname, warehouse_query_method);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ cur_frm.cscript.sales_team_fname = "sales_team";
|
|||||||
{% include 'accounts/doctype/sales_invoice/pos.js' %}
|
{% include 'accounts/doctype/sales_invoice/pos.js' %}
|
||||||
|
|
||||||
frappe.provide("erpnext.stock");
|
frappe.provide("erpnext.stock");
|
||||||
|
frappe.provide("erpnext.stock.delivery_note");
|
||||||
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
|
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
|
||||||
refresh: function(doc, dt, dn) {
|
refresh: function(doc, dt, dn) {
|
||||||
this._super();
|
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']);
|
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
|
// unhide expense_account and cost_center is auto_accounting_for_stock enabled
|
||||||
var aii_enabled = cint(sys_defaults.auto_accounting_for_stock)
|
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_fields = frappe.meta.docfield_map['Delivery Note'];
|
||||||
var dn_item_fields = frappe.meta.docfield_map['Delivery Note Item'];
|
var dn_item_fields = frappe.meta.docfield_map['Delivery Note Item'];
|
||||||
var dn_fields_copy = dn_fields;
|
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) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user