patch fix
This commit is contained in:
parent
fb7140df2f
commit
fcda5b636c
@ -7,6 +7,7 @@ import frappe
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import validate_email_add, strip
|
from frappe.utils import validate_email_add, strip
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from email.utils import parseaddr
|
||||||
|
|
||||||
class NewsletterList(Document):
|
class NewsletterList(Document):
|
||||||
def onload(self):
|
def onload(self):
|
||||||
@ -23,7 +24,7 @@ class NewsletterList(Document):
|
|||||||
|
|
||||||
for user in frappe.db.get_all(doctype, [email_field, unsubscribed_field or "name"]):
|
for user in frappe.db.get_all(doctype, [email_field, unsubscribed_field or "name"]):
|
||||||
try:
|
try:
|
||||||
email = strip(user.get(email_field))
|
email = parseaddr(user.get(email_field))[1]
|
||||||
if email:
|
if email:
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Newsletter List Subscriber",
|
"doctype": "Newsletter List Subscriber",
|
||||||
|
@ -96,8 +96,19 @@ def set_party_in_jv_and_gl_entry(receivable_payable_accounts):
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def delete_individual_party_account():
|
def delete_individual_party_account():
|
||||||
frappe.db.sql("""delete from `tabAccount` where ifnull(master_type, '') in ('Customer', 'Supplier')
|
frappe.db.sql("""delete from `tabAccount` acc
|
||||||
and ifnull(master_name, '') != ''""")
|
where ifnull(acc.master_type, '') in ('Customer', 'Supplier')
|
||||||
|
and ifnull(acc.master_name, '') != ''
|
||||||
|
and not exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""")
|
||||||
|
|
||||||
|
accounts_not_deleted = frappe.db.sql_list("""select name from `tabAccount` acc
|
||||||
|
where ifnull(acc.master_type, '') in ('Customer', 'Supplier')
|
||||||
|
and ifnull(acc.master_name, '') != ''
|
||||||
|
and exists(select gle.name from `tabGL Entry` gle where gle.account = acc.name)""")
|
||||||
|
|
||||||
|
if accounts_not_deleted:
|
||||||
|
print "Accounts not deleted: " + "\n".join(accounts_not_deleted)
|
||||||
|
|
||||||
|
|
||||||
def remove_customer_supplier_account_report():
|
def remove_customer_supplier_account_report():
|
||||||
for d in ["Customer Account Head", "Supplier Account Head"]:
|
for d in ["Customer Account Head", "Supplier Account Head"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user