瀏覽代碼

[minor] expire notification in popup note

version-14
Rushabh Mehta 9 年之前
父節點
當前提交
80ca5fecad
共有 3 個檔案被更改,包括 36 行新增3 行删除
  1. +2
    -2
      frappe/boot.py
  2. +28
    -1
      frappe/desk/doctype/note/note.json
  3. +6
    -0
      frappe/desk/doctype/note/note.py

+ 2
- 2
frappe/boot.py 查看文件

@@ -168,6 +168,6 @@ def load_print_css(bootinfo, print_settings):

def get_unseen_notes():
return frappe.db.sql('''select name, title, content from tabNote where notify_on_login=1
and %s not in
and expire_notification_on > %s and %s not in
(select user from `tabNote Seen By` nsb
where nsb.parent=tabNote.name)''', frappe.session.user, as_dict=True)
where nsb.parent=tabNote.name)''', (frappe.utils.now(), frappe.session.user), as_dict=True)

+ 28
- 1
frappe/desk/doctype/note/note.json 查看文件

@@ -89,6 +89,33 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.notify_on_login && doc.public",
"fieldname": "expire_notification_on",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Expire Notification On",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
@@ -180,7 +207,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-08-29 06:00:27.360336",
"modified": "2016-08-30 00:28:57.094889",
"modified_by": "Administrator",
"module": "Desk",
"name": "Note",


+ 6
- 0
frappe/desk/doctype/note/note.py 查看文件

@@ -11,6 +11,12 @@ class Note(Document):
import re
self.name = re.sub("[%'\"#*?`]", "", self.title.strip())

def validate(self):
if self.notify_on_login and not self.expire_notification_on:

# expire this notification in a week (default)
self.expire_notification_on = frappe.utils.add_days(self.creation, 7)

def before_print(self):
self.print_heading = self.name
self.sub_heading = ""


Loading…
取消
儲存