[Fix] Default letter head

This commit is contained in:
Rohit Waghchaure 2016-04-11 12:10:20 +05:30
parent 3912a31a6f
commit b2e7a1f605
3 changed files with 20 additions and 16 deletions

View File

@ -172,14 +172,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}, __("Get items from")); }, __("Get items from"));
}, },
company: function() {
var me = this;
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address")
&& !this.frm.doc.shipping_address) {
erpnext.utils.get_shipping_address(this.frm)
}
},
shipping_address: function(){ shipping_address: function(){
var me = this; var me = this;

View File

@ -308,7 +308,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date; else var date = this.frm.doc.transaction_date;
set_party_account(set_pricing);
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){
erpnext.utils.get_shipping_address(this.frm, function(){
set_party_account(set_pricing);
})
}else{
set_party_account(set_pricing);
}
if(this.frm.doc.company) { if(this.frm.doc.company) {
erpnext.last_selected_company = this.frm.doc.company; erpnext.last_selected_company = this.frm.doc.company;

View File

@ -127,7 +127,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
return true; return true;
} }
erpnext.utils.get_shipping_address = function(frm){ erpnext.utils.get_shipping_address = function(frm, callback){
frappe.call({ frappe.call({
method: "erpnext.utilities.doctype.address.address.get_shipping_address", method: "erpnext.utilities.doctype.address.address.get_shipping_address",
args: {company: frm.doc.company}, args: {company: frm.doc.company},
@ -136,6 +136,10 @@ erpnext.utils.get_shipping_address = function(frm){
frm.set_value("shipping_address", r.message[0]) //Address title or name frm.set_value("shipping_address", r.message[0]) //Address title or name
frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page
} }
if(callback){
return callback();
}
} }
}); });
} }