I try to update values of a doc from a public web_form.
In order to do this, in server side py file, I use frappe.set_value() and then frappe.db.commit().
The problem is a public web_form means the user is Guest. So it is not allowed to set_value and commit.
I am able to insert the new doc with frappe.save(ignore_permissions=True).
So… is there any way to use ignore_permissions with those set_value and db.commit?
Or is there any way to change Guest to any system user just to update the value?
Thanks for your input.
But my problem is not on the saving. I did saving with that lines.
My problem is after the doc is inserted, I run other process, and then a code to change the value of the doc.
This is where the problem arise. I got permission error:
File "/Users/rahy/frappe-bench/apps/frappe/frappe/__init__.py", line 692, in set_value return frappe.client.set_value(doctype, docname, fieldname, value)
File "/Users/rahy/frappe-bench/apps/frappe/frappe/client.py", line 128, in set_value doc.save()
File "/Users/rahy/frappe-bench/apps/frappe/frappe/model/document.py", line 273, in save return self._save(*args, **kwargs)
File "/Users/rahy/frappe-bench/apps/frappe/frappe/model/document.py", line 299, in _save self.check_permission("write", "save")
File "/Users/rahy/frappe-bench/apps/frappe/frappe/model/document.py", line 180, in check_permission self.raise_no_permission_to(permlevel or permtype)
File "/Users/rahy/frappe-bench/apps/frappe/frappe/model/document.py", line 194, in raise_no_permission_to raise frappe.PermissionError
frappe.exceptions.PermissionError''''
This error occurs when set_value function is saving the doc because the guest user doesn’t have the permission to edit the doctype.
The above code snippet I shared is another way to do the exact same thing as frappe.set_value and you can pass the ignore permissions flag to save it.