fix: order_type validation restriction (#18096) (#21264)

Co-authored-by: Don-Leopardo <46027152+Don-Leopardo@users.noreply.github.com>
This commit is contained in:
Rohan
2020-04-14 19:42:21 +05:30
committed by GitHub
parent 49b653b444
commit b0f000b1c8
3 changed files with 0 additions and 15 deletions

View File

@@ -148,13 +148,6 @@ class SellingController(StockController):
if sales_team and total != 100.0: if sales_team and total != 100.0:
throw(_("Total allocated percentage for sales team should be 100")) throw(_("Total allocated percentage for sales team should be 100"))
def validate_order_type(self):
valid_types = ["Sales", "Maintenance", "Shopping Cart"]
if not self.order_type:
self.order_type = "Sales"
elif self.order_type not in valid_types:
throw(_("Order Type must be one of {0}").format(comma_or(valid_types)))
def validate_max_discount(self): def validate_max_discount(self):
for d in self.get("items"): for d in self.get("items"):
if d.item_code: if d.item_code:

View File

@@ -26,7 +26,6 @@ class Quotation(SellingController):
super(Quotation, self).validate() super(Quotation, self).validate()
self.set_status() self.set_status()
self.update_opportunity() self.update_opportunity()
self.validate_order_type()
self.validate_uom_is_integer("stock_uom", "qty") self.validate_uom_is_integer("stock_uom", "qty")
self.validate_valid_till() self.validate_valid_till()
self.set_customer_name() self.set_customer_name()
@@ -40,9 +39,6 @@ class Quotation(SellingController):
def has_sales_order(self): def has_sales_order(self):
return frappe.db.get_value("Sales Order Item", {"prevdoc_docname": self.name, "docstatus": 1}) return frappe.db.get_value("Sales Order Item", {"prevdoc_docname": self.name, "docstatus": 1})
def validate_order_type(self):
super(Quotation, self).validate_order_type()
def update_lead(self): def update_lead(self):
if self.quotation_to == "Lead" and self.party_name: if self.quotation_to == "Lead" and self.party_name:
frappe.get_doc("Lead", self.party_name).set_status(update=True) frappe.get_doc("Lead", self.party_name).set_status(update=True)

View File

@@ -34,7 +34,6 @@ class SalesOrder(SellingController):
def validate(self): def validate(self):
super(SalesOrder, self).validate() super(SalesOrder, self).validate()
self.validate_order_type()
self.validate_delivery_date() self.validate_delivery_date()
self.validate_proj_cust() self.validate_proj_cust()
self.validate_po() self.validate_po()
@@ -100,9 +99,6 @@ class SalesOrder(SellingController):
frappe.msgprint(_("Quotation {0} not of type {1}") frappe.msgprint(_("Quotation {0} not of type {1}")
.format(d.prevdoc_docname, self.order_type)) .format(d.prevdoc_docname, self.order_type))
def validate_order_type(self):
super(SalesOrder, self).validate_order_type()
def validate_delivery_date(self): def validate_delivery_date(self):
if self.order_type == 'Sales' and not self.skip_delivery_note: if self.order_type == 'Sales' and not self.skip_delivery_note:
delivery_date_list = [d.delivery_date for d in self.get("items") if d.delivery_date] delivery_date_list = [d.delivery_date for d in self.get("items") if d.delivery_date]