mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-29 19:48:27 +00:00
fix: Server side handling of quotation to and get_query fix
This commit is contained in:
@@ -26,6 +26,8 @@ frappe.ui.form.on('Quotation', {
|
||||
|
||||
quotation_to: function(frm) {
|
||||
frm.trigger("set_label");
|
||||
frm.trigger("set_dynamic_field_label");
|
||||
frm.trigger("toggle_reqd_lead_customer");
|
||||
},
|
||||
|
||||
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(){
|
||||
if (this.frm.doc.quotation_to == "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")
|
||||
|
||||
@@ -28,11 +28,11 @@ class Quotation(SellingController):
|
||||
self.update_opportunity()
|
||||
self.validate_order_type()
|
||||
self.validate_uom_is_integer("stock_uom", "qty")
|
||||
self.validate_quotation_to()
|
||||
# self.validate_quotation_to()
|
||||
self.validate_valid_till()
|
||||
if self.items:
|
||||
self.with_items = 1
|
||||
|
||||
|
||||
def validate_valid_till(self):
|
||||
if self.valid_till and self.valid_till < self.transaction_date:
|
||||
frappe.throw(_("Valid till date cannot be before transaction date"))
|
||||
@@ -43,16 +43,16 @@ class Quotation(SellingController):
|
||||
def validate_order_type(self):
|
||||
super(Quotation, self).validate_order_type()
|
||||
|
||||
def validate_quotation_to(self):
|
||||
if self.customer:
|
||||
self.quotation_to = "Customer"
|
||||
self.lead = None
|
||||
elif self.lead:
|
||||
self.quotation_to = "Lead"
|
||||
# def validate_quotation_to(self):
|
||||
# if self.customer:
|
||||
# self.quotation_to = "Customer"
|
||||
# self.lead = None
|
||||
# elif self.lead:
|
||||
# self.quotation_to = "Lead"
|
||||
|
||||
def update_lead(self):
|
||||
if self.lead:
|
||||
frappe.get_doc("Lead", self.lead).set_status(update=True)
|
||||
if self.quotation_to == "Lead":
|
||||
frappe.get_doc("Lead", self.customer_lead).set_status(update=True)
|
||||
|
||||
def update_opportunity(self):
|
||||
for opportunity in list(set([d.prevdoc_docname for d in self.get("items")])):
|
||||
@@ -209,7 +209,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||
}
|
||||
}, target_doc, set_missing_values, ignore_permissions=ignore_permissions)
|
||||
|
||||
return doclist
|
||||
return doclist
|
||||
|
||||
def _make_customer(source_name, ignore_permissions=False):
|
||||
quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type", "customer"])
|
||||
|
||||
Reference in New Issue
Block a user