Merge pull request #1370 from akhileshdarjee/hotfix
Shipping address in quotation fixed for customer validation
This commit is contained in:
commit
7e676f3aae
@ -54,8 +54,16 @@ $.extend(erpnext.queries, {
|
||||
return { filters: { supplier: doc.supplier } };
|
||||
},
|
||||
|
||||
lead_filter: function(doc) {
|
||||
if(!doc.lead) {
|
||||
wn.throw(wn._("Please specify a") + " " +
|
||||
wn._(wn.meta.get_label(doc.doctype, "lead", doc.name)));
|
||||
}
|
||||
|
||||
return { filters: { lead: doc.lead } };
|
||||
},
|
||||
|
||||
not_a_group_filter: function() {
|
||||
return { filters: { is_group: "No" } };
|
||||
},
|
||||
|
||||
});
|
@ -105,9 +105,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||
|
||||
if(doc.docstatus === 1 && doc.status!=="Lost") {
|
||||
cur_frm.add_custom_button(wn._('Create Quotation'), cur_frm.cscript.create_quotation);
|
||||
if(doc.status!=="Quotation") {
|
||||
if(doc.status!=="Quotation")
|
||||
cur_frm.add_custom_button(wn._('Opportunity Lost'), cur_frm.cscript['Declare Opportunity Lost']);
|
||||
}
|
||||
|
||||
cur_frm.add_custom_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
|
||||
}
|
||||
|
||||
@ -116,17 +116,15 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
if(doc.enquiry_from == 'Lead' && doc.lead) {
|
||||
if(doc.enquiry_from == 'Lead' && doc.lead)
|
||||
cur_frm.cscript.lead(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
if (d.item_code)
|
||||
return get_server_fields('get_item_details', d.item_code, 'enquiry_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// hide - unhide fields on basis of enquiry_from lead or customer
|
||||
cur_frm.cscript.enquiry_from = function(doc, cdt, cdn) {
|
||||
@ -164,14 +162,12 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.lead.lead.make_opportunity",
|
||||
source_name: cur_frm.doc.lead
|
||||
})
|
||||
});
|
||||
|
||||
unhide_field(['customer_name', 'address_display','contact_mobile', 'customer_address',
|
||||
'contact_email', 'territory']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
cur_frm.cscript['Declare Opportunity Lost'] = function() {
|
||||
var dialog = new wn.ui.Dialog({
|
||||
title: wn._("Set as Lost"),
|
||||
@ -200,5 +196,4 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
||||
})
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
}
|
@ -15,12 +15,21 @@ wn.require('app/accounts/doctype/sales_invoice/pos.js');
|
||||
|
||||
erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
onload: function(doc, dt, dn) {
|
||||
var me = this;
|
||||
this._super(doc, dt, dn);
|
||||
if(doc.customer && !doc.quotation_to)
|
||||
doc.quotation_to = "Customer";
|
||||
else if(doc.lead && !doc.quotation_to)
|
||||
doc.quotation_to = "Lead";
|
||||
|
||||
// to overwrite the customer_filter trigger from queries.js
|
||||
if (doc.lead) {
|
||||
$.each(["customer_address", "shipping_address_name"],
|
||||
function(i, opts) {
|
||||
me.frm.set_query(opts, erpnext.queries["lead_filter"]);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super(doc, dt, dn);
|
||||
@ -68,6 +77,12 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
quotation_to: function() {
|
||||
this.frm.toggle_reqd("lead", this.frm.doc.quotation_to == "Lead");
|
||||
this.frm.toggle_reqd("customer", this.frm.doc.quotation_to == "Customer");
|
||||
if (this.frm.doc.quotation_to == "Lead") {
|
||||
this.frm.set_value("customer", null);
|
||||
this.frm.set_value("contact_person", null);
|
||||
}
|
||||
else if (this.frm.doc.quotation_to == "Customer")
|
||||
this.frm.set_value("lead", null);
|
||||
},
|
||||
|
||||
tc_name: function() {
|
||||
@ -152,7 +167,6 @@ cur_frm.cscript['Declare Order Lost'] = function(){
|
||||
}
|
||||
|
||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
if(cint(wn.boot.notification_settings.quotation)) {
|
||||
if(cint(wn.boot.notification_settings.quotation))
|
||||
cur_frm.email_doc(wn.boot.notification_settings.quotation_message);
|
||||
}
|
||||
}
|
@ -3,14 +3,10 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import _, msgprint
|
||||
|
||||
|
||||
|
||||
from controllers.selling_controller import SellingController
|
||||
|
||||
class DocType(SellingController):
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:08",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-14 17:25:46",
|
||||
"modified": "2014-01-29 19:42:32",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -665,6 +665,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_person",
|
||||
"fieldtype": "Link",
|
||||
|
@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes import msgprint
|
||||
from webnotes import msgprint, throw, _
|
||||
from webnotes.utils import cstr, cint
|
||||
|
||||
class DocType:
|
||||
@ -20,7 +20,7 @@ class DocType:
|
||||
if self.doc.address_title:
|
||||
self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip()
|
||||
else:
|
||||
webnotes.msgprint("""Address Title is mandatory.""" + self.doc.customer, raise_exception=True)
|
||||
throw(_("Address Title is mandatory."))
|
||||
|
||||
def validate(self):
|
||||
self.validate_primary_address()
|
||||
|
Loading…
x
Reference in New Issue
Block a user