website updates and leave balance bugfix
This commit is contained in:
parent
c66305dcdc
commit
87192da372
@ -64,11 +64,11 @@ class DocType:
|
||||
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")
|
||||
|
||||
|
@ -725,4 +725,8 @@ patch_list = [
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'reload_debtors_creditors_ledger',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'website_cache_refactor',
|
||||
},
|
||||
]
|
@ -15,12 +15,11 @@ def get_blog_list(args=None):
|
||||
|
||||
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 @@ def get_blog_list(args=None):
|
||||
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'])
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
@ -39,7 +39,7 @@ def get_page_html(page_name, comments=''):
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user