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):
|
def validate_balance_leaves(self):
|
||||||
if self.doc.from_date and self.doc.to_date and not self.is_lwp():
|
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,
|
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()
|
tot_leaves = self.get_total_leave_days()
|
||||||
bal, tot_leaves = bal, tot_leaves
|
bal, tot_leaves = bal, tot_leaves
|
||||||
webnotes.conn.set(self.doc,'leave_balance',flt(bal['leave_balance']))
|
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, 'total_leave_days', flt(tot_leaves['total_leave_days']))
|
||||||
if flt(bal['leave_balance']) < 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")
|
msgprint("Warning : There is not enough leave balance")
|
||||||
|
|
||||||
|
@ -725,4 +725,8 @@ patch_list = [
|
|||||||
'patch_module': 'patches.december_2012',
|
'patch_module': 'patches.december_2012',
|
||||||
'patch_file': 'reload_debtors_creditors_ledger',
|
'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 = """\
|
query = """\
|
||||||
select
|
select
|
||||||
cache.name as name, cache.html as content,
|
name, content, owner, creation as creation,
|
||||||
blog.owner as owner, blog.creation as published,
|
title, (select count(name) from `tabComment` where
|
||||||
blog.title as title, (select count(name) from `tabComment` where
|
comment_doctype='Blog' and comment_docname=name) as comments
|
||||||
comment_doctype='Blog' and comment_docname=blog.name) as comments
|
from `tabBlog`
|
||||||
from `tabWeb Cache` cache, `tabBlog` blog
|
where ifnull(published,0)=1
|
||||||
where cache.doc_type = 'Blog' and blog.page_name = cache.name
|
|
||||||
order by published desc, name asc"""
|
order by published desc, name asc"""
|
||||||
|
|
||||||
from webnotes.widgets.query_builder import add_limit_to_query
|
from webnotes.widgets.query_builder import add_limit_to_query
|
||||||
@ -35,7 +34,7 @@ def get_blog_list(args=None):
|
|||||||
for res in result:
|
for res in result:
|
||||||
from webnotes.utils import global_date_format, get_fullname
|
from webnotes.utils import global_date_format, get_fullname
|
||||||
res['full_name'] = get_fullname(res['owner'])
|
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']:
|
if not res['content']:
|
||||||
res['content'] = website.web_cache.get_html(res['name'])
|
res['content'] = website.web_cache.get_html(res['name'])
|
||||||
res['content'] = split_blog_content(res['content'])
|
res['content'] = split_blog_content(res['content'])
|
||||||
|
@ -1,137 +1,102 @@
|
|||||||
# DocType, Blog
|
|
||||||
[
|
[
|
||||||
|
{
|
||||||
# These values are common in all dictionaries
|
"owner": "Administrator",
|
||||||
{
|
"docstatus": 0,
|
||||||
'creation': '2012-07-27 19:32:53',
|
"creation": "2012-11-30 18:14:18",
|
||||||
'docstatus': 0,
|
"modified_by": "Administrator",
|
||||||
'modified': '2012-08-03 12:18:36',
|
"modified": "2012-12-06 16:33:36"
|
||||||
'modified_by': u'Administrator',
|
},
|
||||||
'owner': u'Administrator'
|
{
|
||||||
},
|
"allow_attach": 1,
|
||||||
|
"doctype": "DocType",
|
||||||
# These values are common for all DocType
|
"module": "Website",
|
||||||
{
|
"max_attachments": 5,
|
||||||
'_last_update': u'1328599743',
|
"name": "__common__"
|
||||||
'allow_attach': 1,
|
},
|
||||||
'colour': u'White:FFF',
|
{
|
||||||
'doctype': 'DocType',
|
"name": "__common__",
|
||||||
'max_attachments': 5,
|
"parent": "Blog",
|
||||||
'module': u'Website',
|
"doctype": "DocField",
|
||||||
'name': '__common__',
|
"parenttype": "DocType",
|
||||||
'section_style': u'Simple',
|
"parentfield": "fields"
|
||||||
'show_in_menu': 0,
|
},
|
||||||
'version': 1
|
{
|
||||||
},
|
"name": "__common__",
|
||||||
|
"parent": "Blog",
|
||||||
# These values are common for all DocField
|
"read": 1,
|
||||||
{
|
"doctype": "DocPerm",
|
||||||
'doctype': u'DocField',
|
"parenttype": "DocType",
|
||||||
'name': '__common__',
|
"permlevel": 0,
|
||||||
'parent': u'Blog',
|
"parentfield": "permissions"
|
||||||
'parentfield': u'fields',
|
},
|
||||||
'parenttype': u'DocType'
|
{
|
||||||
},
|
"name": "Blog",
|
||||||
|
"doctype": "DocType"
|
||||||
# These values are common for all DocPerm
|
},
|
||||||
{
|
{
|
||||||
'doctype': u'DocPerm',
|
"doctype": "DocField",
|
||||||
'name': '__common__',
|
"label": "Title",
|
||||||
'parent': u'Blog',
|
"fieldname": "title",
|
||||||
'parentfield': u'permissions',
|
"fieldtype": "Data",
|
||||||
'parenttype': u'DocType',
|
"reqd": 1,
|
||||||
'permlevel': 0,
|
"permlevel": 0
|
||||||
'read': 1
|
},
|
||||||
},
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
# DocType, Blog
|
"label": "Published",
|
||||||
{
|
"fieldname": "published",
|
||||||
'doctype': 'DocType',
|
"fieldtype": "Check",
|
||||||
'name': u'Blog'
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocPerm
|
"doctype": "DocField",
|
||||||
{
|
"label": "Content",
|
||||||
'create': 1,
|
"fieldname": "content",
|
||||||
'doctype': u'DocPerm',
|
"fieldtype": "Text Editor",
|
||||||
'role': u'Website Manager',
|
"reqd": 0,
|
||||||
'write': 1
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocPerm
|
"doctype": "DocField",
|
||||||
{
|
"label": "Page Name",
|
||||||
'create': 1,
|
"fieldname": "page_name",
|
||||||
'doctype': u'DocPerm',
|
"fieldtype": "Data",
|
||||||
'role': u'Blogger',
|
"hidden": 1,
|
||||||
'write': 1
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocPerm
|
"doctype": "DocField",
|
||||||
{
|
"label": "Email Sent",
|
||||||
'doctype': u'DocPerm',
|
"fieldname": "email_sent",
|
||||||
'role': u'Guest',
|
"fieldtype": "Check",
|
||||||
'write': 0
|
"hidden": 1,
|
||||||
},
|
"permlevel": 0
|
||||||
|
},
|
||||||
# DocField
|
{
|
||||||
{
|
"print_hide": 1,
|
||||||
'doctype': u'DocField',
|
"no_copy": 1,
|
||||||
'fieldname': u'title',
|
"doctype": "DocField",
|
||||||
'fieldtype': u'Data',
|
"label": "File List",
|
||||||
'label': u'Title',
|
"fieldname": "file_list",
|
||||||
'permlevel': 0,
|
"fieldtype": "Text",
|
||||||
'reqd': 1
|
"hidden": 1,
|
||||||
},
|
"permlevel": 0
|
||||||
|
},
|
||||||
# DocField
|
{
|
||||||
{
|
"create": 1,
|
||||||
'doctype': u'DocField',
|
"doctype": "DocPerm",
|
||||||
'fieldname': u'published',
|
"write": 1,
|
||||||
'fieldtype': u'Check',
|
"role": "Website Manager"
|
||||||
'label': u'Published',
|
},
|
||||||
'permlevel': 0
|
{
|
||||||
},
|
"create": 1,
|
||||||
|
"doctype": "DocPerm",
|
||||||
# DocField
|
"write": 1,
|
||||||
{
|
"role": "Blogger"
|
||||||
'doctype': u'DocField',
|
},
|
||||||
'fieldname': u'content',
|
{
|
||||||
'fieldtype': u'Code',
|
"write": 0,
|
||||||
'label': u'Content',
|
"role": "Guest",
|
||||||
'options': u'Markdown',
|
"doctype": "DocPerm"
|
||||||
'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
|
|
||||||
}
|
|
||||||
]
|
]
|
@ -39,7 +39,7 @@ def get_page_html(page_name, comments=''):
|
|||||||
|
|
||||||
if not html:
|
if not html:
|
||||||
html = load_into_cache(page_name)
|
html = load_into_cache(page_name)
|
||||||
comments += "\n\npage load status: fresh"
|
comments += "\n\npage load status: cache"
|
||||||
|
|
||||||
# insert comments
|
# insert comments
|
||||||
import webnotes.utils
|
import webnotes.utils
|
||||||
|
Loading…
x
Reference in New Issue
Block a user