diff --git a/foundation/erpnext_foundation/doctype/bounty/bounty.py b/foundation/erpnext_foundation/doctype/bounty/bounty.py index 710b39b1..a7bb06c3 100644 --- a/foundation/erpnext_foundation/doctype/bounty/bounty.py +++ b/foundation/erpnext_foundation/doctype/bounty/bounty.py @@ -24,6 +24,11 @@ class Bounty(WebsiteGenerator): if bounty_left > (self.goal * 0.1) or bounty_left < 0: bounty_left = self.goal * 0.1 + # edit permission + can_edit = False + if 'System Manager' in frappe.get_roles() or self.owner == frappe.session.user: + can_edit = True + context.no_cache = True context.no_breadcrumbs = False context.days_to_go = date_diff(self.end_date, nowdate()) @@ -32,6 +37,7 @@ class Bounty(WebsiteGenerator): context.fmt_money = fmt_money context.bounty_left = bounty_left context.comment_list = get_comment_list(self.doctype, self.name) + context.can_edit = can_edit def validate(self): from frappe.utils.user import get_user_fullname diff --git a/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html b/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html index 98dc311d..48b98485 100644 --- a/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html +++ b/foundation/erpnext_foundation/doctype/bounty/templates/bounty.html @@ -33,7 +33,7 @@

{{ title }} - {% if doc.owner == frappe.session.user %} + {% if can_edit %} Edit {% endif %} {{days_to_go}} days to go