Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has_permission() got an unexpected keyword argument 'print_logs' #42154

Closed
samy4sam opened this issue Jul 3, 2024 · 1 comment
Closed

has_permission() got an unexpected keyword argument 'print_logs' #42154

samy4sam opened this issue Jul 3, 2024 · 1 comment
Labels

Comments

@samy4sam
Copy link

samy4sam commented Jul 3, 2024

Information about bug

I get this error when creating a new employee.

Screenshot 03 07 2024 um 08 29 19 AM

Fix: #41885

Module

HR

Version

Frappe version: v15.32.0
ERPNext version: v15.28.2
Frappe HR version: v15.23.0

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
	"erpnext": "15.28.2",
	"frappe": "15.32.0",
	"gameplan": "0.0.1",
	"helpdesk": "0.10.0",
	"hrms": "15.23.0",
	"payments": "0.0.1",
	"print_designer": "1.3.3",
	"wiki": "2.0.0"
}

Route

Form/Employee/HR-EMP-00001

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 390, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1128, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/setup/doctype/employee/employee.py", line 83, in on_update
    self.update_user()
  File "apps/erpnext/erpnext/setup/doctype/employee/employee.py", line 144, in update_user
    user.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 390, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1128, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in runner
    add_to_return_value(self, f(self, method, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/setup/doctype/employee/employee.py", line 257, in update_user_permissions
    if not has_permission("User Permission", ptype="write", print_logs=False):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/permissions.py", line 49, in inner
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
TypeError: has_permission() got an unexpected keyword argument 'print_logs'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"HR-EMP-00001\",\"owner\":\"Administrator\",\"creation\":\"2024-07-03 08:21:44.194611\",\"modified\":\"2024-07-03 08:22:05.903191\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"employee\":\"HR-EMP-00001\",\"naming_series\":\"HR-EMP-\",\"first_name\":\"first\",\"last_name\":\"last\",\"employee_name\":\"first last\",\"gender\":\"Male\",\"date_of_birth\":\"1994-12-03\",\"salutation\":\"Mr\",\"date_of_joining\":\"2023-04-01\",\"status\":\"Active\",\"create_user_permission\":1,\"company\":\"myCompany\",\"designation\":\"Chief Executive Officer\",\"notice_number_of_days\":0,\"date_of_retirement\":\"2054-12-03\",\"cell_number\":\"+41 79 864 03 42\",\"personal_email\":\"first.last@mail.com\",\"company_email\":\"first.last@mycompany.com\",\"prefered_contact_email\":\"Company Email\",\"prefered_email\":\"first.last@mycompany.com\",\"unsubscribed\":0,\"current_address\":\"my Address",\"current_accommodation_type\":\"Rented\",\"permanent_accommodation_type\":\"\",\"ctc\":0,\"salary_currency\":\"CHF\",\"salary_mode\":\"\",\"marital_status\":\"Single\",\"blood_group\":\"\",\"leave_encashed\":\"\",\"lft\":1,\"rgt\":2,\"old_parent\":\"\",\"doctype\":\"Employee\",\"education\":[],\"internal_work_history\":[],\"employment_degrees\":[],\"external_work_history\":[],\"carryover_and_payouts\":[],\"image\":null,\"__unsaved\":1,\"user_id\":\"first.last@mycompany.com\"}",
		"action": "Save"
	},
	"btn": {
		"jQuery370050763034872889991": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 3370,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

{
	"exception": "TypeError: has_permission() got an unexpected keyword argument 'print_logs'",
	"exc_type": "TypeError",
	"_exc_source": "erpnext (app)"
}
@samy4sam samy4sam added the bug label Jul 3, 2024
@ljain112
Copy link
Contributor

ljain112 commented Jul 3, 2024

It looks like there might be a branch conflict between ERPNext and Frappe. Your ERPNext is on the develop branch, while Frappe is on the version-15 branch. This change has not been backported yet.

You can check the branch versions and if the issue is resolved, you can close this issue.

PR: #39309.

@vorasmit vorasmit closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants