|
@ -26,8 +26,8 @@ class VariantMapping(Document): |
|
|
|
|
|
|
|
|
if self.is_new(): |
|
|
if self.is_new(): |
|
|
data = frappe.db.sql("""select name from {0}.`tabVariant Mapping` |
|
|
data = frappe.db.sql("""select name from {0}.`tabVariant Mapping` |
|
|
where variant = '{1}' and fuel = '{2}' and |
|
|
where variant = '{1}' and fuel = '{2}' and transmission = '{3}' and drive = '{4}' and family_code = '{5}'; |
|
|
transmission = '{3}' and drive = '{4}'""".format(current_db_name,self.variant,self.fuel,self.transmission,self.drive),as_dict=True) |
|
|
""".format(current_db_name,self.variant,self.fuel,self.transmission,self.drive,self.family_code),as_dict=True) |
|
|
if data: |
|
|
if data: |
|
|
if data != self.name: |
|
|
if data != self.name: |
|
|
frappe.throw('Variant Mapping already created as {0} for {1}'.format(data[0]['name'],self.variant)) |
|
|
frappe.throw('Variant Mapping already created as {0} for {1}'.format(data[0]['name'],self.variant)) |
|
|