fix: resolve conflicts in backport of #60777

This commit is contained in:
Nabin Hait
2026-10-24 10:04:42 +05:30
parent 049520d285
commit cbe334473e
6 changed files with 12 additions and 54 deletions
-12
View File
@@ -288,26 +288,14 @@ sounds = [
has_upload_permission = {"Employee": "erpnext.setup.doctype.employee.employee.has_upload_permission"}
<<<<<<< HEAD
=======
permission_query_conditions = {
"Asset Activity": "erpnext.assets.doctype.asset_activity.asset_activity.get_permission_query_conditions",
"Item": "erpnext.stock.doctype.company_restriction.company_restriction.get_permission_query_conditions",
"Customer": "erpnext.stock.doctype.company_restriction.company_restriction.get_permission_query_conditions",
"Supplier": "erpnext.stock.doctype.company_restriction.company_restriction.get_permission_query_conditions",
"Voice Call Settings": "erpnext.telephony.doctype.voice_call_settings.voice_call_settings.get_permission_query_conditions",
"*": "erpnext.stock.doctype.company_restriction.company_restriction.get_inherited_permission_query_conditions",
}
has_permission = {
"Item": "erpnext.stock.doctype.company_restriction.company_restriction.has_permission",
"Customer": "erpnext.stock.doctype.company_restriction.company_restriction.has_permission",
"Supplier": "erpnext.stock.doctype.company_restriction.company_restriction.has_permission",
"Voice Call Settings": "erpnext.telephony.doctype.voice_call_settings.voice_call_settings.has_permission",
"*": "erpnext.stock.doctype.company_restriction.company_restriction.has_inherited_permission",
}
>>>>>>> 7c88594 (fix(telephony): scope voice call settings to their user)
has_website_permission = {
"Sales Order": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
-11
View File
@@ -460,15 +460,4 @@ erpnext.patches.v16_0.remove_all_role_from_payment_terms_template
execute:from erpnext.setup.install import grant_address_read_to_accounts_manager; grant_address_read_to_accounts_manager()
erpnext.patches.v16_0.remove_invalid_fetch_from_italy_payment_schedule_swift_number
erpnext.patches.v16_0.set_user_on_timesheets
<<<<<<< HEAD
=======
erpnext.patches.v16_0.replace_legacy_print_formats_with_classic
erpnext.patches.v16_0.set_stock_value_in_stock_closing_balance
erpnext.patches.v16_0.reset_fifo_queue_in_stock_closing_balance
erpnext.patches.v16_0.remove_invalid_fields_from_copy_fields_to_variants
erpnext.patches.v16_0.fix_ifrs_cash_flow_template_formulas
erpnext.patches.v16_0.disable_add_to_transit_on_standard_stock_entry_types
erpnext.patches.v16_0.unhide_item_barcode_fields
execute:frappe.db.set_value("Report", "Negative Batch Report", "prepared_report", 1)
erpnext.patches.v16_0.scope_voice_call_settings_to_desk_users
>>>>>>> 7c88594 (fix(telephony): scope voice call settings to their user)
@@ -1,10 +1,9 @@
import frappe
from frappe.permissions import get_doctypes_with_custom_docperms
from frappe.permissions import get_all_perms, get_doctypes_with_custom_docperms
from frappe.utils import cint
from erpnext.patches.v16_0.mirror_release_perms_to_custom_docperm import mirror_rules
from erpnext.patches.v16_0.mirror_release_perms_to_custom_docperm import mirror_role
from erpnext.patches.v16_0.remove_all_role_from_payment_terms_template import remove_rule
from erpnext.setup.install import get_role_rules
DOCTYPE = "Voice Call Settings"
DESK_USER_PTYPES = ("read", "write", "create", "report", "export", "print", "email")
@@ -24,10 +23,10 @@ def remove_shares():
def move_customised_rules():
frappe.db.set_value("Custom DocPerm", {"parent": DOCTYPE}, "share", 0)
mirror_rules({DOCTYPE: {"Desk User": DESK_USER_PTYPES}})
mirror_role(DOCTYPE, "Desk User", DESK_USER_PTYPES)
removed = False
for rule in get_role_rules(DOCTYPE, "All"):
if not cint(rule.permlevel) and remove_rule(DOCTYPE, rule.name):
for rule in get_all_perms("All"):
if rule.parent == DOCTYPE and not cint(rule.permlevel) and remove_rule(DOCTYPE, rule.name):
removed = True
if removed:
frappe.clear_cache(doctype=DOCTYPE)
@@ -1,22 +1,17 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
<<<<<<< HEAD
# import frappe
import unittest
class TestVoiceCallSettings(unittest.TestCase):
pass
=======
import frappe
import frappe.client
from frappe.tests.utils import FrappeTestCase
from erpnext.tests.permission_test_utils import as_user, make_fenced_user
from erpnext.tests.utils import ERPNextTestSuite
class TestVoiceCallSettings(ERPNextTestSuite):
class TestVoiceCallSettings(FrappeTestCase):
def tearDown(self):
frappe.db.rollback()
def test_user_creates_own_settings(self):
user = make_user("voice-call-owner@example.com")
other_user = make_user("voice-call-other@example.com")
@@ -78,7 +73,7 @@ class TestVoiceCallSettings(ERPNextTestSuite):
"Voice Call Settings", owner, other_user, write=1, flags={"ignore_share_permission": True}
)
with as_user(other_user):
self.assertIn(owner, frappe.get_list("Voice Call Settings", pluck="name"))
self.assertEqual(frappe.client.get("Voice Call Settings", owner)["name"], owner)
execute()
@@ -96,4 +91,3 @@ def make_settings(user: str, **values) -> "frappe.model.document.Document":
frappe.get_doc({"doctype": "Voice Call Settings", "user": user}).insert(ignore_permissions=True)
frappe.db.set_value("Voice Call Settings", user, values)
return frappe.get_doc("Voice Call Settings", user)
>>>>>>> 7c88594 (fix(telephony): scope voice call settings to their user)
@@ -53,15 +53,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
<<<<<<< HEAD
<<<<<<< HEAD
"modified": "2020-12-14 18:49:34.600194",
=======
"modified": "2026-10-15 15:16:45.554169",
>>>>>>> 7c88594 (fix(telephony): scope voice call settings to their user)
=======
"modified": "2026-10-15 22:19:14.883211",
>>>>>>> 405153d (fix(telephony): disable sharing of voice call settings)
"modified_by": "Administrator",
"module": "Telephony",
"name": "Voice Call Settings",
@@ -2,7 +2,7 @@
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
ADMIN_ROLE = "System Manager"
@@ -24,9 +24,6 @@ class VoiceCallSettings(Document):
user: DF.Link
# end: auto-generated types
<<<<<<< HEAD
pass
=======
def before_insert(self):
self.set_user_for_restricted_creator()
@@ -58,4 +55,3 @@ def get_permission_query_conditions(user: str | None = None) -> str | None:
def is_admin(user: str) -> bool:
return ADMIN_ROLE in frappe.get_roles(user)
>>>>>>> 7c88594 (fix(telephony): scope voice call settings to their user)