[minor] validate permission in Process Payroll and all products fix for home page
This commit is contained in:
parent
f92f04bffc
commit
9d1b56f423
@ -57,6 +57,8 @@ class ProcessPayroll(Document):
|
||||
Creates salary slip for selected employees if already not created
|
||||
"""
|
||||
|
||||
self.check_permission('write')
|
||||
|
||||
emp_list = self.get_emp_list()
|
||||
ss_list = []
|
||||
for emp in emp_list:
|
||||
@ -102,6 +104,8 @@ class ProcessPayroll(Document):
|
||||
"""
|
||||
Submit all salary slips based on selected criteria
|
||||
"""
|
||||
self.check_permission('write')
|
||||
|
||||
ss_list = self.get_sal_slip_list()
|
||||
not_submitted_ss = []
|
||||
for ss in ss_list:
|
||||
@ -159,6 +163,8 @@ class ProcessPayroll(Document):
|
||||
|
||||
|
||||
def make_journal_entry(self, salary_account = None):
|
||||
self.check_permission('write')
|
||||
|
||||
amount = self.get_total_salary()
|
||||
default_bank_account = frappe.db.get_value("Company", self.company,
|
||||
"default_bank_account")
|
||||
|
@ -139,6 +139,32 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "/products",
|
||||
"fieldname": "products_url",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "URL for \"All Products\"",
|
||||
"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": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -178,7 +204,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-08-09 05:01:30.287861",
|
||||
"modified": "2016-08-29 01:28:00.961623",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Portal",
|
||||
"name": "Homepage",
|
||||
|
@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.website.utils import delete_page_cache
|
||||
|
||||
class Homepage(Document):
|
||||
def validate(self):
|
||||
@ -12,6 +13,7 @@ class Homepage(Document):
|
||||
self.setup_items()
|
||||
if not self.description:
|
||||
self.description = frappe._("This is an example website auto-generated from ERPNext")
|
||||
delete_page_cache('home')
|
||||
|
||||
def setup_items(self):
|
||||
for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'],
|
||||
|
@ -26,9 +26,8 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- TODO: remove hardcoding of /products -->
|
||||
<div class="text-center padding">
|
||||
<a href="/products" class="btn btn-primary all-products">
|
||||
<a href="{{ homepage.products_url or "/products" }}" class="btn btn-primary all-products">
|
||||
{{ _("View All Products") }}</a></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user