Merge pull request #3527 from nabinhait/develop

Journal Entry list view and delete events via query
This commit is contained in:
Nabin Hait 2015-06-29 18:39:43 +05:30
commit 9cea01fa8b
2 changed files with 12 additions and 7 deletions

View File

@ -53,7 +53,7 @@
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 0,
"label": "Posting Date", "label": "Posting Date",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "posting_date", "oldfieldname": "posting_date",
@ -445,7 +445,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-04-27 20:32:31.655580", "modified": "2015-06-29 15:28:12.529019",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry", "name": "Journal Entry",

View File

@ -22,16 +22,21 @@ class TransactionBase(StatusUpdater):
self.posting_time = now_datetime().strftime('%H:%M:%S') self.posting_time = now_datetime().strftime('%H:%M:%S')
def add_calendar_event(self, opts, force=False): def add_calendar_event(self, opts, force=False):
if self.contact_by != cstr(self._prev.contact_by) or \ if cstr(self.contact_by) != cstr(self._prev.contact_by) or \
self.contact_date != cstr(self._prev.contact_date) or force: cstr(self.contact_date) != cstr(self._prev.contact_date) or force:
self.delete_events() self.delete_events()
self._add_calendar_event(opts) self._add_calendar_event(opts)
def delete_events(self): def delete_events(self):
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent` events = frappe.db.sql_list("""select name from `tabEvent`
where ref_type=%s and ref_name=%s""", (self.doctype, self.name)), where ref_type=%s and ref_name=%s""", (self.doctype, self.name))
ignore_permissions=True) 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): def _add_calendar_event(self, opts):
opts = frappe._dict(opts) opts = frappe._dict(opts)