Merge pull request #3527 from nabinhait/develop
Journal Entry list view and delete events via query
This commit is contained in:
commit
9cea01fa8b
@ -53,7 +53,7 @@
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Posting Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "posting_date",
|
||||
@ -445,7 +445,7 @@
|
||||
"icon": "icon-file-text",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2015-04-27 20:32:31.655580",
|
||||
"modified": "2015-06-29 15:28:12.529019",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry",
|
||||
|
@ -22,16 +22,21 @@ class TransactionBase(StatusUpdater):
|
||||
self.posting_time = now_datetime().strftime('%H:%M:%S')
|
||||
|
||||
def add_calendar_event(self, opts, force=False):
|
||||
if self.contact_by != cstr(self._prev.contact_by) or \
|
||||
self.contact_date != cstr(self._prev.contact_date) or force:
|
||||
if cstr(self.contact_by) != cstr(self._prev.contact_by) or \
|
||||
cstr(self.contact_date) != cstr(self._prev.contact_date) or force:
|
||||
|
||||
self.delete_events()
|
||||
self._add_calendar_event(opts)
|
||||
|
||||
def delete_events(self):
|
||||
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
||||
where ref_type=%s and ref_name=%s""", (self.doctype, self.name)),
|
||||
ignore_permissions=True)
|
||||
events = frappe.db.sql_list("""select name from `tabEvent`
|
||||
where ref_type=%s and ref_name=%s""", (self.doctype, self.name))
|
||||
if events:
|
||||
frappe.db.sql("delete from `tabEvent` where name in (%s)"
|
||||
.format(", ".join(['%s']*len(events))), tuple(events))
|
||||
|
||||
frappe.db.sql("delete from `tabEvent Role` where parent in (%s)"
|
||||
.format(", ".join(['%s']*len(events))), tuple(events))
|
||||
|
||||
def _add_calendar_event(self, opts):
|
||||
opts = frappe._dict(opts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user