[fix] Merge permission roles to modify frozen entries/set frozen accounts

This commit is contained in:
ankitjavalkarwork 2014-09-29 15:45:26 +05:30
parent 86211cd219
commit 44d42ddf63
5 changed files with 23 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{
"creation": "2013-06-24 15:49:57.000000",
"creation": "2013-06-24 15:49:57",
"description": "Settings for Accounts",
"docstatus": 0,
"doctype": "DocType",
@ -9,6 +9,7 @@
"description": "If enabled, the system will post accounting entries for inventory automatically.",
"fieldname": "auto_accounting_for_stock",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Make Accounting Entry For Every Stock Movement",
"permlevel": 0
},
@ -16,22 +17,16 @@
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except role specified below.",
"fieldname": "acc_frozen_upto",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Accounts Frozen Upto",
"permlevel": 0
},
{
"description": "Users with this role are allowed to create / modify accounting entry before frozen date",
"fieldname": "bde_auth_role",
"fieldtype": "Link",
"label": "Allowed Role to Edit Entries Before Frozen Date",
"options": "Role",
"permlevel": 0
},
{
"description": "Users with this role are allowed to set frozen accounts and create / modify accounting entries against frozen accounts",
"fieldname": "frozen_accounts_modifier",
"fieldtype": "Link",
"label": "Frozen Accounts Modifier",
"in_list_view": 1,
"label": "Role Allowed to Set Frozen Accounts & Edit Frozen Entries",
"options": "Role",
"permlevel": 0
},
@ -39,6 +34,7 @@
"description": "Role that is allowed to submit transactions that exceed credit limits set.",
"fieldname": "credit_controller",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Credit Controller",
"options": "Role",
"permlevel": 0
@ -47,7 +43,7 @@
"icon": "icon-cog",
"idx": 1,
"issingle": 1,
"modified": "2013-12-20 19:22:52.000000",
"modified": "2014-09-29 15:42:18.976866",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",

View File

@ -104,9 +104,9 @@ def check_freezing_date(posting_date, adv_adj=False):
if not adv_adj:
acc_frozen_upto = frappe.db.get_value('Accounts Settings', None, 'acc_frozen_upto')
if acc_frozen_upto:
bde_auth_role = frappe.db.get_value( 'Accounts Settings', None,'bde_auth_role')
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
if getdate(posting_date) <= getdate(acc_frozen_upto) \
and not bde_auth_role in frappe.user.get_roles():
and not frozen_accounts_modifier in frappe.user.get_roles():
frappe.throw(_("You are not authorized to add or update entries before {0}").format(formatdate(acc_frozen_upto)))
def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):

View File

@ -80,4 +80,5 @@ execute:frappe.delete_doc("DocType", "Landed Cost Wizard")
erpnext.patches.v4_2.default_website_style
erpnext.patches.v4_2.set_company_country
erpnext.patches.v4_2.update_sales_order_invoice_field_name
erpnext.patches.v4_2.cost_of_production_cycle
erpnext.patches.v4_2.cost_of_production_cycle
erpnext.patches.v5_0.update_frozen_accounts_permission_role

View File

View File

@ -0,0 +1,12 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
account_settings = frappe.get_doc("Accounts Settings")
if not account_settings.frozen_accounts_modifier and account_settings.bde_auth_role:
account_settings.frozen_accounts_modifier = account_settings.bde_auth_role
account_settings.save()