[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):
|
||||
if self.lead_name:
|
||||
# assign lead address to customer (if already not set)
|
||||
address_names = frappe.db.get_values('Dynamic Link', dict(
|
||||
parenttype='Address',
|
||||
link_doctype='Lead',
|
||||
link_name=self.lead_name
|
||||
), 'parent as name', as_dict=True)
|
||||
address_names = frappe.get_all('Dynamic Link', filters={
|
||||
"parenttype":"Address",
|
||||
"link_doctype":"Lead",
|
||||
"link_name":self.lead_name
|
||||
}, fields=["parent as name"])
|
||||
|
||||
for address_name in address_names:
|
||||
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'
|
||||
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):
|
||||
frappe.db.sql("""
|
||||
|
Loading…
x
Reference in New Issue
Block a user