[minor] [fix] trigger in supplier address and contact person field
This commit is contained in:
parent
fa910593e6
commit
461b417871
@ -109,11 +109,6 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
|
|||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
$.extend(cur_frm.cscript, new erpnext.accounts.PurchaseInvoiceController({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.accounts.PurchaseInvoiceController({frm: cur_frm}));
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
|
||||||
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
||||||
|
|
||||||
cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
||||||
|
@ -99,6 +99,31 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supplier_address: function() {
|
||||||
|
var me = this;
|
||||||
|
if (this.frm.doc.supplier) {
|
||||||
|
wn.call({
|
||||||
|
doc: this.frm.doc,
|
||||||
|
method: "get_supplier_address",
|
||||||
|
freeze: true,
|
||||||
|
args: {
|
||||||
|
supplier: this.frm.doc.supplier,
|
||||||
|
address: this.frm.doc.supplier_address,
|
||||||
|
contact: this.frm.doc.contact_person
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if(!r.exc) {
|
||||||
|
me.frm.refresh_fields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
contact_person: function() {
|
||||||
|
this.supplier_address();
|
||||||
|
},
|
||||||
|
|
||||||
item_code: function(doc, cdt, cdn) {
|
item_code: function(doc, cdt, cdn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
|
@ -105,10 +105,6 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
$.extend(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
|
||||||
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return {
|
return {
|
||||||
filters: {'supplier': doc.supplier}
|
filters: {'supplier': doc.supplier}
|
||||||
|
@ -72,14 +72,6 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.supplier_address = function(doc, dt, dn) {
|
|
||||||
if (doc.supplier) {
|
|
||||||
get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier,
|
|
||||||
address: doc.supplier_address, contact: doc.contact_person}), '', doc, dt, dn, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cur_frm.cscript.contact_person = cur_frm.cscript.supplier_address;
|
|
||||||
|
|
||||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return {
|
return {
|
||||||
filters:{'supplier': doc.supplier}
|
filters:{'supplier': doc.supplier}
|
||||||
|
@ -111,10 +111,6 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
|
||||||
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return{
|
return{
|
||||||
filters:{ 'supplier': doc.supplier}
|
filters:{ 'supplier': doc.supplier}
|
||||||
|
Loading…
Reference in New Issue
Block a user