fix: Server side handling of quotation to and get_query fix

This commit is contained in:
deepeshgarg007
2019-04-01 19:08:59 +05:30
parent 3b4f481ca4
commit 6ba48c58e8
2 changed files with 14 additions and 16 deletions

View File

@@ -26,6 +26,8 @@ frappe.ui.form.on('Quotation', {
quotation_to: function(frm) { quotation_to: function(frm) {
frm.trigger("set_label"); frm.trigger("set_label");
frm.trigger("set_dynamic_field_label");
frm.trigger("toggle_reqd_lead_customer");
}, },
set_label: function(frm) { set_label: function(frm) {
@@ -106,15 +108,11 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
}, },
quotation_to: function(frm) {
this.set_dynamic_field_label();
this.toggle_reqd_lead_customer();
},
set_dynamic_field_label: function(){ set_dynamic_field_label: function(){
if (this.frm.doc.quotation_to == "Customer") if (this.frm.doc.quotation_to == "Customer")
{ {
this.frm.set_df_property("customer_lead", "label", "Customer"); this.frm.set_df_property("customer_lead", "label", "Customer");
this.frm.fields_dict.customer_lead.get_query = null;
} }
if (this.frm.doc.quotation_to == "Lead") if (this.frm.doc.quotation_to == "Lead")

View File

@@ -28,7 +28,7 @@ class Quotation(SellingController):
self.update_opportunity() self.update_opportunity()
self.validate_order_type() self.validate_order_type()
self.validate_uom_is_integer("stock_uom", "qty") self.validate_uom_is_integer("stock_uom", "qty")
self.validate_quotation_to() # self.validate_quotation_to()
self.validate_valid_till() self.validate_valid_till()
if self.items: if self.items:
self.with_items = 1 self.with_items = 1
@@ -43,16 +43,16 @@ class Quotation(SellingController):
def validate_order_type(self): def validate_order_type(self):
super(Quotation, self).validate_order_type() super(Quotation, self).validate_order_type()
def validate_quotation_to(self): # def validate_quotation_to(self):
if self.customer: # if self.customer:
self.quotation_to = "Customer" # self.quotation_to = "Customer"
self.lead = None # self.lead = None
elif self.lead: # elif self.lead:
self.quotation_to = "Lead" # self.quotation_to = "Lead"
def update_lead(self): def update_lead(self):
if self.lead: if self.quotation_to == "Lead":
frappe.get_doc("Lead", self.lead).set_status(update=True) frappe.get_doc("Lead", self.customer_lead).set_status(update=True)
def update_opportunity(self): def update_opportunity(self):
for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])): for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])):