website updates and leave balance bugfix
diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py
index cdddb9f..8dbd532 100755
--- a/hr/doctype/leave_application/leave_application.py
+++ b/hr/doctype/leave_application/leave_application.py
@@ -64,11 +64,11 @@
def validate_balance_leaves(self):
if self.doc.from_date and self.doc.to_date and not self.is_lwp():
bal = get_leave_balance(self.doc.leave_type, self.doc.employee,
- self.doc.fiscal_year)["leave_balance"]
+ self.doc.fiscal_year)
tot_leaves = self.get_total_leave_days()
bal, tot_leaves = bal, tot_leaves
- webnotes.conn.set(self.doc,'leave_balance',flt(bal['leave_balance']))
- webnotes.conn.set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
+ webnotes.conn.set(self.doc, 'leave_balance', flt(bal['leave_balance']))
+ webnotes.conn.set(self.doc, 'total_leave_days', flt(tot_leaves['total_leave_days']))
if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']):
msgprint("Warning : There is not enough leave balance")
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 38847eb..4f64dff 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -725,4 +725,8 @@
'patch_module': 'patches.december_2012',
'patch_file': 'reload_debtors_creditors_ledger',
},
+ {
+ 'patch_module': 'patches.december_2012',
+ 'patch_file': 'website_cache_refactor',
+ },
]
\ No newline at end of file
diff --git a/website/blog.py b/website/blog.py
index be3a791..6c2f85e 100644
--- a/website/blog.py
+++ b/website/blog.py
@@ -15,12 +15,11 @@
query = """\
select
- cache.name as name, cache.html as content,
- blog.owner as owner, blog.creation as published,
- blog.title as title, (select count(name) from `tabComment` where
- comment_doctype='Blog' and comment_docname=blog.name) as comments
- from `tabWeb Cache` cache, `tabBlog` blog
- where cache.doc_type = 'Blog' and blog.page_name = cache.name
+ name, content, owner, creation as creation,
+ title, (select count(name) from `tabComment` where
+ comment_doctype='Blog' and comment_docname=name) as comments
+ from `tabBlog`
+ where ifnull(published,0)=1
order by published desc, name asc"""
from webnotes.widgets.query_builder import add_limit_to_query
@@ -35,7 +34,7 @@
for res in result:
from webnotes.utils import global_date_format, get_fullname
res['full_name'] = get_fullname(res['owner'])
- res['published'] = global_date_format(res['published'])
+ res['published'] = global_date_format(res['creation'])
if not res['content']:
res['content'] = website.web_cache.get_html(res['name'])
res['content'] = split_blog_content(res['content'])
diff --git a/website/doctype/blog/blog.txt b/website/doctype/blog/blog.txt
index 35d31c6..962d888 100644
--- a/website/doctype/blog/blog.txt
+++ b/website/doctype/blog/blog.txt
@@ -1,137 +1,102 @@
-# DocType, Blog
[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-07-27 19:32:53',
- 'docstatus': 0,
- 'modified': '2012-08-03 12:18:36',
- 'modified_by': u'Administrator',
- 'owner': u'Administrator'
- },
-
- # These values are common for all DocType
- {
- '_last_update': u'1328599743',
- 'allow_attach': 1,
- 'colour': u'White:FFF',
- 'doctype': 'DocType',
- 'max_attachments': 5,
- 'module': u'Website',
- 'name': '__common__',
- 'section_style': u'Simple',
- 'show_in_menu': 0,
- 'version': 1
- },
-
- # These values are common for all DocField
- {
- 'doctype': u'DocField',
- 'name': '__common__',
- 'parent': u'Blog',
- 'parentfield': u'fields',
- 'parenttype': u'DocType'
- },
-
- # These values are common for all DocPerm
- {
- 'doctype': u'DocPerm',
- 'name': '__common__',
- 'parent': u'Blog',
- 'parentfield': u'permissions',
- 'parenttype': u'DocType',
- 'permlevel': 0,
- 'read': 1
- },
-
- # DocType, Blog
- {
- 'doctype': 'DocType',
- 'name': u'Blog'
- },
-
- # DocPerm
- {
- 'create': 1,
- 'doctype': u'DocPerm',
- 'role': u'Website Manager',
- 'write': 1
- },
-
- # DocPerm
- {
- 'create': 1,
- 'doctype': u'DocPerm',
- 'role': u'Blogger',
- 'write': 1
- },
-
- # DocPerm
- {
- 'doctype': u'DocPerm',
- 'role': u'Guest',
- 'write': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'title',
- 'fieldtype': u'Data',
- 'label': u'Title',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'published',
- 'fieldtype': u'Check',
- 'label': u'Published',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'content',
- 'fieldtype': u'Code',
- 'label': u'Content',
- 'options': u'Markdown',
- 'permlevel': 0,
- 'reqd': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'page_name',
- 'fieldtype': u'Data',
- 'hidden': 1,
- 'label': u'Page Name',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'email_sent',
- 'fieldtype': u'Check',
- 'hidden': 1,
- 'label': u'Email Sent',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'file_list',
- 'fieldtype': u'Text',
- 'hidden': 1,
- 'label': u'File List',
- 'no_copy': 1,
- 'permlevel': 0,
- 'print_hide': 1
- }
+ {
+ "owner": "Administrator",
+ "docstatus": 0,
+ "creation": "2012-11-30 18:14:18",
+ "modified_by": "Administrator",
+ "modified": "2012-12-06 16:33:36"
+ },
+ {
+ "allow_attach": 1,
+ "doctype": "DocType",
+ "module": "Website",
+ "max_attachments": 5,
+ "name": "__common__"
+ },
+ {
+ "name": "__common__",
+ "parent": "Blog",
+ "doctype": "DocField",
+ "parenttype": "DocType",
+ "parentfield": "fields"
+ },
+ {
+ "name": "__common__",
+ "parent": "Blog",
+ "read": 1,
+ "doctype": "DocPerm",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "parentfield": "permissions"
+ },
+ {
+ "name": "Blog",
+ "doctype": "DocType"
+ },
+ {
+ "doctype": "DocField",
+ "label": "Title",
+ "fieldname": "title",
+ "fieldtype": "Data",
+ "reqd": 1,
+ "permlevel": 0
+ },
+ {
+ "doctype": "DocField",
+ "label": "Published",
+ "fieldname": "published",
+ "fieldtype": "Check",
+ "permlevel": 0
+ },
+ {
+ "doctype": "DocField",
+ "label": "Content",
+ "fieldname": "content",
+ "fieldtype": "Text Editor",
+ "reqd": 0,
+ "permlevel": 0
+ },
+ {
+ "doctype": "DocField",
+ "label": "Page Name",
+ "fieldname": "page_name",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "permlevel": 1
+ },
+ {
+ "doctype": "DocField",
+ "label": "Email Sent",
+ "fieldname": "email_sent",
+ "fieldtype": "Check",
+ "hidden": 1,
+ "permlevel": 0
+ },
+ {
+ "print_hide": 1,
+ "no_copy": 1,
+ "doctype": "DocField",
+ "label": "File List",
+ "fieldname": "file_list",
+ "fieldtype": "Text",
+ "hidden": 1,
+ "permlevel": 0
+ },
+ {
+ "create": 1,
+ "doctype": "DocPerm",
+ "write": 1,
+ "role": "Website Manager"
+ },
+ {
+ "create": 1,
+ "doctype": "DocPerm",
+ "write": 1,
+ "role": "Blogger"
+ },
+ {
+ "write": 0,
+ "role": "Guest",
+ "doctype": "DocPerm"
+ }
]
\ No newline at end of file
diff --git a/website/web_cache.py b/website/web_cache.py
index 23b2603..60672d8 100644
--- a/website/web_cache.py
+++ b/website/web_cache.py
@@ -39,7 +39,7 @@
if not html:
html = load_into_cache(page_name)
- comments += "\n\npage load status: fresh"
+ comments += "\n\npage load status: cache"
# insert comments
import webnotes.utils