[fix] Merge permission roles to modify frozen entries/set frozen accounts
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index 942de75..b1f7a65 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -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",
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index dab2d82..a5a3079 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -104,9 +104,9 @@
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):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2f0dd2e..37fbc04 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -80,4 +80,5 @@
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
\ No newline at end of file
+erpnext.patches.v4_2.cost_of_production_cycle
+erpnext.patches.v5_0.update_frozen_accounts_permission_role
\ No newline at end of file
diff --git a/erpnext/patches/v5_0/__init__.py b/erpnext/patches/v5_0/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/patches/v5_0/__init__.py
diff --git a/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py b/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py
new file mode 100644
index 0000000..f569695
--- /dev/null
+++ b/erpnext/patches/v5_0/update_frozen_accounts_permission_role.py
@@ -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()