fix: Remove HR & Payroll from Authorization Control and Rules
This commit is contained in:
@@ -248,61 +248,3 @@ class AuthorizationControl(TransactionBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return rule
|
return rule
|
||||||
|
|
||||||
# related to payroll module only
|
|
||||||
def get_approver_name(self, doctype_name, total, doc_obj=""):
|
|
||||||
app_user = []
|
|
||||||
app_specific_user = []
|
|
||||||
rule = {}
|
|
||||||
|
|
||||||
if doc_obj:
|
|
||||||
if doctype_name == "Expense Claim":
|
|
||||||
rule = self.get_value_based_rule(
|
|
||||||
doctype_name, doc_obj.employee, doc_obj.total_claimed_amount, doc_obj.company
|
|
||||||
)
|
|
||||||
elif doctype_name == "Appraisal":
|
|
||||||
rule = frappe.db.sql(
|
|
||||||
"""select name, to_emp, to_designation, approving_role, approving_user
|
|
||||||
from `tabAuthorization Rule` where transaction=%s
|
|
||||||
and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s))
|
|
||||||
and company = %s and docstatus!=2""",
|
|
||||||
(doctype_name, doc_obj.employee, doc_obj.employee, doc_obj.company),
|
|
||||||
as_dict=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
if not rule:
|
|
||||||
rule = frappe.db.sql(
|
|
||||||
"""select name, to_emp, to_designation, approving_role, approving_user
|
|
||||||
from `tabAuthorization Rule`
|
|
||||||
where transaction=%s and (to_emp=%s or
|
|
||||||
to_designation IN (select designation from `tabEmployee` where name=%s))
|
|
||||||
and ifnull(company,'') = '' and docstatus!=2""",
|
|
||||||
(doctype_name, doc_obj.employee, doc_obj.employee),
|
|
||||||
as_dict=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
if rule:
|
|
||||||
for m in rule:
|
|
||||||
if m["to_emp"] or m["to_designation"]:
|
|
||||||
if m["approving_user"]:
|
|
||||||
app_specific_user.append(m["approving_user"])
|
|
||||||
elif m["approving_role"]:
|
|
||||||
user_lst = [
|
|
||||||
z[0]
|
|
||||||
for z in frappe.db.sql(
|
|
||||||
"""select distinct t1.name
|
|
||||||
from `tabUser` t1, `tabHas Role` t2 where t2.role=%s
|
|
||||||
and t2.parent=t1.name and t1.name !='Administrator'
|
|
||||||
and t1.name != 'Guest' and t1.docstatus !=2""",
|
|
||||||
m["approving_role"],
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
for x in user_lst:
|
|
||||||
if not x in app_user:
|
|
||||||
app_user.append(x)
|
|
||||||
|
|
||||||
if len(app_specific_user) > 0:
|
|
||||||
return app_specific_user
|
|
||||||
else:
|
|
||||||
return app_user
|
|
||||||
|
|||||||
@@ -28,19 +28,8 @@ frappe.ui.form.on("Authorization Rule", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
transaction: function(frm) {
|
transaction: function(frm) {
|
||||||
if (frm.doc.transaction == 'Appraisal') {
|
unhide_field(['system_role', 'system_user','value', 'based_on']);
|
||||||
frm.set_value("based_on", "Not Applicable");
|
hide_field(['to_emp','to_designation']);
|
||||||
frm.set_value("master_name", "");
|
|
||||||
frm.set_value("system_role", "");
|
|
||||||
frm.set_value("system_user", "");
|
|
||||||
frm.set_value("value", 0);
|
|
||||||
hide_field(['based_on', 'system_role', 'system_user', 'value']);
|
|
||||||
unhide_field(['to_emp','to_designation']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unhide_field(['system_role', 'system_user','value', 'based_on']);
|
|
||||||
hide_field(['to_emp','to_designation']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -52,19 +41,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
else
|
else
|
||||||
unhide_field('value');
|
unhide_field('value');
|
||||||
|
|
||||||
if (doc.transaction == 'Appraisal') {
|
unhide_field(['system_role', 'system_user','value']);
|
||||||
hide_field(['system_role', 'system_user']);
|
hide_field(['to_emp','to_designation']);
|
||||||
unhide_field(['to_emp','to_designation']);
|
|
||||||
|
|
||||||
if (doc.transaction == 'Appraisal')
|
|
||||||
hide_field('value');
|
|
||||||
else
|
|
||||||
unhide_field('value');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unhide_field(['system_role', 'system_user','value']);
|
|
||||||
hide_field(['to_emp','to_designation']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.system_user.get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict.system_user.get_query = function(doc, cdt, cdn) {
|
||||||
|
|||||||
@@ -1,657 +1,189 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"actions": [],
|
||||||
"allow_events_in_timeline": 0,
|
"allow_import": 1,
|
||||||
"allow_guest_to_view": 0,
|
"autoname": "HR-ARU-.#####",
|
||||||
"allow_import": 1,
|
"creation": "2013-01-10 16:34:22",
|
||||||
"allow_rename": 0,
|
"doctype": "DocType",
|
||||||
"autoname": "HR-ARU-.#####",
|
"document_type": "Setup",
|
||||||
"beta": 0,
|
"engine": "InnoDB",
|
||||||
"creation": "2013-01-10 16:34:22",
|
"field_order": [
|
||||||
"custom": 0,
|
"transaction",
|
||||||
"docstatus": 0,
|
"based_on",
|
||||||
"doctype": "DocType",
|
"customer_or_item",
|
||||||
"document_type": "Setup",
|
"master_name",
|
||||||
"editable_grid": 0,
|
"column_break_3",
|
||||||
|
"company",
|
||||||
|
"section_break_17",
|
||||||
|
"value",
|
||||||
|
"section_break_7",
|
||||||
|
"system_role",
|
||||||
|
"to_emp",
|
||||||
|
"column_break_10",
|
||||||
|
"system_user",
|
||||||
|
"to_designation",
|
||||||
|
"section_break_13",
|
||||||
|
"approving_role",
|
||||||
|
"column_break_15",
|
||||||
|
"approving_user"
|
||||||
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "transaction",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Select",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"in_standard_filter": 1,
|
||||||
"collapsible": 0,
|
"label": "Transaction",
|
||||||
"columns": 0,
|
"oldfieldname": "transaction",
|
||||||
"fieldname": "transaction",
|
"oldfieldtype": "Select",
|
||||||
"fieldtype": "Select",
|
"options": "\nSales Order\nPurchase Order\nQuotation\nDelivery Note\nSales Invoice\nPurchase Invoice\nPurchase Receipt",
|
||||||
"hidden": 0,
|
"reqd": 1
|
||||||
"ignore_user_permissions": 0,
|
},
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 1,
|
|
||||||
"label": "Transaction",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "transaction",
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"options": "\nSales Order\nPurchase Order\nQuotation\nDelivery Note\nSales Invoice\nPurchase Invoice\nPurchase Receipt\nAppraisal",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "based_on",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Select",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"in_standard_filter": 1,
|
||||||
"collapsible": 0,
|
"label": "Based On",
|
||||||
"columns": 0,
|
"oldfieldname": "based_on",
|
||||||
"fieldname": "based_on",
|
"oldfieldtype": "Select",
|
||||||
"fieldtype": "Select",
|
"options": "\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nNot Applicable",
|
||||||
"hidden": 0,
|
"reqd": 1
|
||||||
"ignore_user_permissions": 0,
|
},
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 1,
|
|
||||||
"label": "Based On",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "based_on",
|
|
||||||
"oldfieldtype": "Select",
|
|
||||||
"options": "\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nNot Applicable",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "customer_or_item",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Select",
|
||||||
"allow_on_submit": 0,
|
"hidden": 1,
|
||||||
"bold": 0,
|
"label": "Customer or Item",
|
||||||
"collapsible": 0,
|
"options": "Customer\nItem",
|
||||||
"columns": 0,
|
"read_only": 1
|
||||||
"fieldname": "customer_or_item",
|
},
|
||||||
"fieldtype": "Select",
|
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Customer or Item",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Customer\nItem",
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "master_name",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Dynamic Link",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"label": "Customer / Item Name",
|
||||||
"collapsible": 0,
|
"oldfieldname": "master_name",
|
||||||
"columns": 0,
|
"oldfieldtype": "Link",
|
||||||
"fieldname": "master_name",
|
"options": "customer_or_item"
|
||||||
"fieldtype": "Dynamic Link",
|
},
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Customer / Item Name",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "master_name",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "customer_or_item",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "column_break_3",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Column Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_3",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "company",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"label": "Company",
|
||||||
"collapsible": 0,
|
"oldfieldname": "company",
|
||||||
"columns": 0,
|
"oldfieldtype": "Link",
|
||||||
"fieldname": "company",
|
"options": "Company",
|
||||||
"fieldtype": "Link",
|
"remember_last_selected_value": 1
|
||||||
"hidden": 0,
|
},
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Company",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "company",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Company",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "section_break_17",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Section Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_17",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "value",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Float",
|
||||||
"allow_on_submit": 0,
|
"label": "Authorized Value",
|
||||||
"bold": 0,
|
"oldfieldname": "value",
|
||||||
"collapsible": 0,
|
"oldfieldtype": "Currency"
|
||||||
"columns": 0,
|
},
|
||||||
"fieldname": "value",
|
|
||||||
"fieldtype": "Float",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Authorized Value",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "value",
|
|
||||||
"oldfieldtype": "Currency",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "section_break_7",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Section Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_7",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "system_role",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"in_list_view": 1,
|
||||||
"bold": 0,
|
"in_standard_filter": 1,
|
||||||
"collapsible": 0,
|
"label": "Applicable To (Role)",
|
||||||
"columns": 0,
|
"oldfieldname": "system_role",
|
||||||
"fieldname": "system_role",
|
"oldfieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Role"
|
||||||
"hidden": 0,
|
},
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 1,
|
|
||||||
"label": "Applicable To (Role)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "system_role",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Role",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "to_emp",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"ignore_user_permissions": 1,
|
||||||
"bold": 0,
|
"label": "Applicable To (Employee)",
|
||||||
"collapsible": 0,
|
"oldfieldname": "to_emp",
|
||||||
"columns": 0,
|
"oldfieldtype": "Link",
|
||||||
"description": "",
|
"options": "Employee"
|
||||||
"fieldname": "to_emp",
|
},
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 1,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Applicable To (Employee)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "to_emp",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Employee",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "column_break_10",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Column Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_10",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "system_user",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Applicable To (User)",
|
||||||
"bold": 0,
|
"oldfieldname": "system_user",
|
||||||
"collapsible": 0,
|
"oldfieldtype": "Link",
|
||||||
"columns": 0,
|
"options": "User"
|
||||||
"fieldname": "system_user",
|
},
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Applicable To (User)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "system_user",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "User",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "to_designation",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Applicable To (Designation)",
|
||||||
"bold": 0,
|
"oldfieldname": "to_designation",
|
||||||
"collapsible": 0,
|
"oldfieldtype": "Link",
|
||||||
"columns": 0,
|
"options": "Designation"
|
||||||
"description": "",
|
},
|
||||||
"fieldname": "to_designation",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Applicable To (Designation)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "to_designation",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Designation",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "section_break_13",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Section Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "section_break_13",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "approving_role",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Approving Role (above authorized value)",
|
||||||
"bold": 0,
|
"oldfieldname": "approving_role",
|
||||||
"collapsible": 0,
|
"oldfieldtype": "Link",
|
||||||
"columns": 0,
|
"options": "Role"
|
||||||
"fieldname": "approving_role",
|
},
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Approving Role (above authorized value)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "approving_role",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Role",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "column_break_15",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Column Break"
|
||||||
"allow_on_submit": 0,
|
},
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"fieldname": "column_break_15",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "approving_user",
|
||||||
"allow_in_quick_entry": 0,
|
"fieldtype": "Link",
|
||||||
"allow_on_submit": 0,
|
"label": "Approving User (above authorized value)",
|
||||||
"bold": 0,
|
"oldfieldname": "approving_user",
|
||||||
"collapsible": 0,
|
"oldfieldtype": "Link",
|
||||||
"columns": 0,
|
"options": "User"
|
||||||
"fieldname": "approving_user",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Approving User (above authorized value)",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "approving_user",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "User",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"remember_last_selected_value": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"icon": "fa fa-shield",
|
||||||
"hide_heading": 0,
|
"idx": 1,
|
||||||
"hide_toolbar": 0,
|
"links": [],
|
||||||
"icon": "fa fa-shield",
|
"modified": "2022-07-01 11:19:45.643991",
|
||||||
"idx": 1,
|
"modified_by": "Administrator",
|
||||||
"image_view": 0,
|
"module": "Setup",
|
||||||
"in_create": 0,
|
"name": "Authorization Rule",
|
||||||
"is_submittable": 0,
|
"naming_rule": "Expression (old style)",
|
||||||
"issingle": 0,
|
"owner": "Administrator",
|
||||||
"istable": 0,
|
|
||||||
"max_attachments": 0,
|
|
||||||
"modified": "2019-01-21 17:10:39.822125",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"module": "Setup",
|
|
||||||
"name": "Authorization Rule",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"create": 1,
|
||||||
"cancel": 0,
|
"delete": 1,
|
||||||
"create": 1,
|
"email": 1,
|
||||||
"delete": 1,
|
"print": 1,
|
||||||
"email": 1,
|
"read": 1,
|
||||||
"export": 0,
|
"report": 1,
|
||||||
"if_owner": 0,
|
"role": "System Manager",
|
||||||
"import": 0,
|
"share": 1,
|
||||||
"permlevel": 0,
|
|
||||||
"print": 1,
|
|
||||||
"read": 1,
|
|
||||||
"report": 1,
|
|
||||||
"role": "System Manager",
|
|
||||||
"set_user_permissions": 0,
|
|
||||||
"share": 1,
|
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 0,
|
"search_fields": "transaction,based_on,system_user,system_role,approving_user,approving_role",
|
||||||
"read_only": 0,
|
"show_name_in_global_search": 1,
|
||||||
"read_only_onload": 0,
|
"sort_field": "modified",
|
||||||
"search_fields": "transaction,based_on,system_user,system_role,approving_user,approving_role",
|
"sort_order": "DESC",
|
||||||
"show_name_in_global_search": 1,
|
"states": []
|
||||||
"sort_order": "DESC",
|
|
||||||
"track_changes": 0,
|
|
||||||
"track_seen": 0,
|
|
||||||
"track_views": 0
|
|
||||||
}
|
}
|
||||||
@@ -32,33 +32,31 @@ class AuthorizationRule(Document):
|
|||||||
frappe.throw(_("Duplicate Entry. Please check Authorization Rule {0}").format(auth_exists))
|
frappe.throw(_("Duplicate Entry. Please check Authorization Rule {0}").format(auth_exists))
|
||||||
|
|
||||||
def validate_rule(self):
|
def validate_rule(self):
|
||||||
if self.transaction != "Appraisal":
|
if not self.approving_role and not self.approving_user:
|
||||||
if not self.approving_role and not self.approving_user:
|
frappe.throw(_("Please enter Approving Role or Approving User"))
|
||||||
frappe.throw(_("Please enter Approving Role or Approving User"))
|
elif self.system_user and self.system_user == self.approving_user:
|
||||||
elif self.system_user and self.system_user == self.approving_user:
|
frappe.throw(_("Approving User cannot be same as user the rule is Applicable To"))
|
||||||
frappe.throw(_("Approving User cannot be same as user the rule is Applicable To"))
|
elif self.system_role and self.system_role == self.approving_role:
|
||||||
elif self.system_role and self.system_role == self.approving_role:
|
frappe.throw(_("Approving Role cannot be same as role the rule is Applicable To"))
|
||||||
frappe.throw(_("Approving Role cannot be same as role the rule is Applicable To"))
|
elif self.transaction in [
|
||||||
elif self.transaction in [
|
"Purchase Order",
|
||||||
"Purchase Order",
|
"Purchase Receipt",
|
||||||
"Purchase Receipt",
|
"Purchase Invoice",
|
||||||
"Purchase Invoice",
|
"Stock Entry",
|
||||||
"Stock Entry",
|
] and self.based_on in [
|
||||||
] and self.based_on in [
|
"Average Discount",
|
||||||
"Average Discount",
|
"Customerwise Discount",
|
||||||
"Customerwise Discount",
|
"Itemwise Discount",
|
||||||
"Itemwise Discount",
|
]:
|
||||||
]:
|
frappe.throw(
|
||||||
frappe.throw(
|
_("Cannot set authorization on basis of Discount for {0}").format(self.transaction)
|
||||||
_("Cannot set authorization on basis of Discount for {0}").format(self.transaction)
|
)
|
||||||
)
|
elif self.based_on == "Average Discount" and flt(self.value) > 100.00:
|
||||||
elif self.based_on == "Average Discount" and flt(self.value) > 100.00:
|
frappe.throw(_("Discount must be less than 100"))
|
||||||
frappe.throw(_("Discount must be less than 100"))
|
elif self.based_on == "Customerwise Discount" and not self.master_name:
|
||||||
elif self.based_on == "Customerwise Discount" and not self.master_name:
|
frappe.throw(_("Customer required for 'Customerwise Discount'"))
|
||||||
frappe.throw(_("Customer required for 'Customerwise Discount'"))
|
|
||||||
else:
|
else:
|
||||||
if self.transaction == "Appraisal":
|
self.based_on = "Not Applicable"
|
||||||
self.based_on = "Not Applicable"
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.check_duplicate_entry()
|
self.check_duplicate_entry()
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ frappe.ui.form.on("Company", {
|
|||||||
},
|
},
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
erpnext.company.setup_queries(frm);
|
erpnext.company.setup_queries(frm);
|
||||||
frm.set_query("hra_component", function(){
|
|
||||||
return {
|
|
||||||
filters: {"type": "Earning"}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
frm.set_query("parent_company", function() {
|
frm.set_query("parent_company", function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user