Merge branch 'master' of github.com:webnotes/erpnext into responsive
Conflicts: projects/doctype/project/project.py utilities/transaction_base.py
This commit is contained in:
commit
b5fd788131
@ -1,6 +1,8 @@
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
from utilities.transaction_base import delete_events
|
||||||
|
|
||||||
# delete orphaned Event User
|
# delete orphaned Event User
|
||||||
webnotes.conn.sql("""delete from `tabEvent User`
|
webnotes.conn.sql("""delete from `tabEvent User`
|
||||||
where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)""")
|
where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)""")
|
||||||
@ -15,5 +17,4 @@ def execute():
|
|||||||
webnotes.get_obj(dt, ref_name).add_calendar_event()
|
webnotes.get_obj(dt, ref_name).add_calendar_event()
|
||||||
else:
|
else:
|
||||||
# remove events where ref doc doesn't exist
|
# remove events where ref doc doesn't exist
|
||||||
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
delete_events(dt, ref_name)
|
||||||
where ref_type=%s and ref_name=%s""", (dt, ref_name)))
|
|
@ -19,6 +19,7 @@ import webnotes
|
|||||||
|
|
||||||
from webnotes.utils import flt, getdate
|
from webnotes.utils import flt, getdate
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from utilities.transaction_base import delete_events
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=None):
|
def __init__(self, doc, doclist=None):
|
||||||
@ -54,7 +55,7 @@ class DocType:
|
|||||||
|
|
||||||
def add_calendar_event(self):
|
def add_calendar_event(self):
|
||||||
# delete any earlier event for this project
|
# delete any earlier event for this project
|
||||||
self.delete_events()
|
delete_events(self.doc.doctype, self.doc.name)
|
||||||
|
|
||||||
# add events
|
# add events
|
||||||
for milestone in self.doclist.get({"parentfield": "project_milestones"}):
|
for milestone in self.doclist.get({"parentfield": "project_milestones"}):
|
||||||
@ -72,8 +73,4 @@ class DocType:
|
|||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
self.delete_events()
|
delete_events(self.doc.doctype, self.doc.name)
|
||||||
|
|
||||||
def delete_events(self):
|
|
||||||
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
|
||||||
where ref_type=%s and ref_name=%s""", (self.doc.doctype, self.doc.name)))
|
|
||||||
|
@ -26,7 +26,7 @@ from webnotes import msgprint
|
|||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase, delete_events
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
@ -327,13 +327,7 @@ class DocType(TransactionBase):
|
|||||||
if d.serial_no:
|
if d.serial_no:
|
||||||
self.update_amc_date(d.serial_no, '')
|
self.update_amc_date(d.serial_no, '')
|
||||||
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
||||||
self.delete_events()
|
delete_events(self.doc.doctype, self.doc.name)
|
||||||
|
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
self.delete_events()
|
delete_events(self.doc.doctype, self.doc.name)
|
||||||
|
|
||||||
def delete_events(self):
|
|
||||||
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
|
||||||
where ref_type=%s and ref_name=%s""", (self.doc.doctype, self.doc.name)))
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,3 +357,6 @@ def validate_currency(args, item, meta=None):
|
|||||||
get_field_precision(meta.get_field("plc_conversion_rate"),
|
get_field_precision(meta.get_field("plc_conversion_rate"),
|
||||||
webnotes._dict({"fields": args})))
|
webnotes._dict({"fields": args})))
|
||||||
|
|
||||||
|
def delete_events(ref_type, ref_name):
|
||||||
|
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
||||||
|
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user