* fix: added 'autoname' to reserved keywords
* fix: prevent using autoname as DocField name
- Add validation for autoname in check_invalid_fieldnames()
- Treat Python keywords as reserved fieldnames
* fix: move autoname out of reserved keywords
* fix: move python keywords out of reserved keywords
* fix: skip reserved docfield name check for 'DocType'
---------
Co-authored-by: Raiza Safeel <raizasafeel@Raizas-MacBook-Air.local>
* feat: add dynamic value support for workflow update_value field
* feat: add evaluate as expression checkbox to workflow states
* test: add tests for dynamic workflow update_value expression
* fix: use description field instead of sender in workflow
tests
* chore: fix typo
---------
Co-authored-by: UmakanthKaspa <kaspaumakanth1999@gmail.com>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
In Postgres, double quotes denote identifiers. The previous LIKE clause format caused "UndefinedColumn" errors during field renaming (e.g., during HRMS installation) because the pattern was interpreted as a column name.
This change parameterizes the LIKE pattern and passes the wildcarded value as a bound parameter, ensuring compatibility with both MySQL and Postgres.
* feat: implement field masking for query builder
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix: add series and sessions to "core doctypes" list
This is so that we don't try to query their meta
This should also resolve#35030
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
---------
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix(postgres): add rollback to prevent crash on hash collision
* fix(postgres): rollback to savepoint to prevent crash on hash collision
* fix(postgres): tighten bounds for a rollback to savepoint for a better perf
* fix(postgres): Handle hash collision efficiently with ON CONFLICT
* refactor: better naming
- Private methods
- "rows" is not a correct name for single record's name
* fix: Bad error handling
- Why raise postgres error?
- Let default error raising/handling happen
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
The `check_parent_permission` calls in client.py are redundant because
`frappe.has_permission` already handles child tables via `has_child_permission`,
which performs the same validations plus additional permlevel checks.
Adjust to use `ON CONFLICT` in a similar manner as the others
```
File "apps/frappe/frappe/model/rename_doc.py", line 192, in rename_doc
update_user_settings(old, new, link_fields)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/rename_doc.py", line 276, in update_user_settings
sync_user_settings()
~~~~~~~~~~~~~~~~~~^^
File "apps/frappe/frappe/model/utils/user_settings.py", line 52, in sync_user_settings
frappe.db.multisql(
^^^^^^^^^^^^^^^^^^^
...<12 lines>...
as_dict=1,
File "apps/frappe/frappe/database/database.py", line 1416, in multisql
return self.sql(query, values, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/sqlite/database.py", line 454, in sql
return super().sql(*args, **kwargs)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 272, in sql
self.execute_query(query, values)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/sqlite/database.py", line 443, in execute_query
return self._cursor.execute(query, values or ())
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 3, and there are 4 supplied.
```
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
If `db_query_compat=True` (set by `qb_query.py`), then we default to some `db_query.py` behaviour.
Otherwise, we'll retail the previous query builder behaviour, this is to minimize breakage on either side.
Signed-off-by: Akhil Narang <me@akhilnarang.dev>