[fixes] set lead to Null on delete company transaction & other minor fixes
This commit is contained in:
parent
51b1d6de48
commit
16ce3623bc
@ -95,11 +95,11 @@ class Customer(TransactionBase):
|
|||||||
def create_lead_address_contact(self):
|
def create_lead_address_contact(self):
|
||||||
if self.lead_name:
|
if self.lead_name:
|
||||||
# assign lead address to customer (if already not set)
|
# assign lead address to customer (if already not set)
|
||||||
address_names = frappe.db.get_values('Dynamic Link', dict(
|
address_names = frappe.get_all('Dynamic Link', filters={
|
||||||
parenttype='Address',
|
"parenttype":"Address",
|
||||||
link_doctype='Lead',
|
"link_doctype":"Lead",
|
||||||
link_name=self.lead_name
|
"link_name":self.lead_name
|
||||||
), 'parent as name', as_dict=True)
|
}, fields=["parent as name"])
|
||||||
|
|
||||||
for address_name in address_names:
|
for address_name in address_names:
|
||||||
address = frappe.get_doc('Address', address_name.get('name'))
|
address = frappe.get_doc('Address', address_name.get('name'))
|
||||||
|
|||||||
@ -89,7 +89,7 @@ def delete_lead_addresses(company_name):
|
|||||||
frappe.db.sql("""delete from `tabDynamic Link` where link_doctype='Lead' and parenttype='Address'
|
frappe.db.sql("""delete from `tabDynamic Link` where link_doctype='Lead' and parenttype='Address'
|
||||||
and link_name in ({leads})""".format(leads=",".join(leads)), debug=True)
|
and link_name in ({leads})""".format(leads=",".join(leads)), debug=True)
|
||||||
|
|
||||||
frappe.db.sql("""update tabCustomer set lead_name='' where lead_name in ({leads})""".format(leads=",".join(leads)), debug=True)
|
frappe.db.sql("""update tabCustomer set lead_name=NULL where lead_name in ({leads})""".format(leads=",".join(leads)), debug=True)
|
||||||
|
|
||||||
def delete_communications(doctype, company_name, company_fieldname):
|
def delete_communications(doctype, company_name, company_fieldname):
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user