[minor] allowed role to edit entries against frozen accounts

This commit is contained in:
Nabin Hait 2013-09-24 00:10:10 +05:30
parent 865e62df61
commit 6c66096fa5
3 changed files with 23 additions and 8 deletions

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-30 12:49:46",
"docstatus": 0,
"modified": "2013-07-05 14:23:30",
"modified": "2013-09-23 23:55:15",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -179,7 +179,7 @@
"reqd": 0
},
{
"description": "If the account is frozen, entries are allowed for the \"Account Manager\" only.",
"description": "If the account is frozen, entries are allowed to restricted users.",
"doctype": "DocField",
"fieldname": "freeze_account",
"fieldtype": "Select",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-24 15:49:57",
"docstatus": 0,
"modified": "2013-07-05 14:23:40",
"modified": "2013-09-23 23:53:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -57,7 +57,15 @@
"doctype": "DocField",
"fieldname": "bde_auth_role",
"fieldtype": "Link",
"label": "Allow Editing of Frozen Accounts For",
"label": "Allowed Role to Edit Entries Before Frozen Date",
"options": "Role"
},
{
"description": "Users with this role are allowed to do / modify accounting entries against frozen accounts",
"doctype": "DocField",
"fieldname": "frozen_accounts_modifier",
"fieldtype": "Link",
"label": "Allowed Role to Edit Entries against Frozen Accounts",
"options": "Role"
},
{

View File

@ -91,10 +91,17 @@ class DocType:
msgprint(_("Account") + ": " + self.doc.account + _(" is not active"), raise_exception=1)
# Account has been freezed for other users except account manager
if ret and ret[0]["freeze_account"]== 'Yes' and not adv_adj \
and not 'Accounts Manager' in webnotes.user.get_roles():
msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \
Only Accounts Manager can do transaction against this account"), raise_exception=1)
if ret and ret[0]["freeze_account"]== 'Yes' and not adv_adj:
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
'frozen_accounts_modifier')
if not frozen_accounts_modifier:
webnotes.throw(self.doc.account + _(" is a frozen account. \
Either make the account active or assign role in Accounts Settings \
who can do / modify entries against this account"))
elif frozen_accounts_modifier not in webnotes.user.get_roles():
webnotes.throw(self.doc.account + _(" is a frozen account. ") +
_("To make / edit transactions against this account, you need role") + ": " +
frozen_accounts_modifier)
if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company:
msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \