Commit graph

2484 commits

Author SHA1 Message Date
barredterra
4bcb12617c fix: assertAlmostEqual with precision 2023-01-26 11:39:41 +01:00
Gavin D'souza
31049b705e fix(db_query): With as_list, pass NULL to maintain order 2023-01-25 14:01:02 +05:30
Gavin D'souza
895f1d3f3a fix(db_query): Check if params in sql fn call are all permitted access 2023-01-25 12:45:36 +05:30
Gavin D'souza
4accf0ed9d fix: Consider virtual fields in fields with values conditionally 2023-01-25 12:38:15 +05:30
Gavin D'souza
6b0e4695a8 Merge branch 'develop' into permlevel-apis 2023-01-25 12:08:47 +05:30
Gavin D'souza
4c1b2ae67c refactor: get_valid_dict
* Util get_permitted_fields checks for valid columns instead of planned logic
* Remove virtual field from dict if not in permitted fields
* Remove reliance on sentinel object _DOC_DELETED_ATTR
2023-01-25 12:04:34 +05:30
Gavin D'souza
e75bfd0e73 refactor: Split objects just once
Co-authored-by: Ritwik Puri <ritwikpuri5678@gmail.com>
2023-01-25 10:45:30 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
Gavin D'souza
e41f005daa fix(db_query): Remove naive field in sql func check 2023-01-24 13:59:48 +05:30
Gavin D'souza
2ae6b7f016 fix: Handle * fields after field iterations 2023-01-24 13:52:33 +05:30
Gavin D'souza
54ff630c77 fix(db_query): Permit optional_fields without checking in permitted
fields
2023-01-24 13:27:07 +05:30
Gavin D'souza
5c5bd2b104 refactor: Meta.get_permitted_fieldnames
* Remove older API that returned list[df]
* Rename fields in usage scope & Meta internals
2023-01-24 13:09:43 +05:30
Gavin D'souza
550261b3dc fix(db_query): Set & use existing constants 2023-01-24 13:01:05 +05:30
Gavin D'souza
acb0dc38ae fix: Check if attr exists before checking permlevel 2023-01-24 12:17:57 +05:30
Sagar Vora
71420eb4e6
refactor: simplified get_controller (#19684)
* refactor: simplified `get_controller`

* chore: more refactor, better error if not subclass

* chore: more correct condition

* refactor: `class_` > `_class`

* chore: use `Meta` instead of DB calls

* chore: `_get_controller` => `import_controller`

* style: remove else block
2023-01-24 01:27:26 +05:30
Anand Baburajan
6554919f1e
fix: improve invalid naming series message (#19711)
* fix: show the invalid naming series in special chars error msg

* chore: translations

[skip ci]
2023-01-23 15:00:04 +05:30
gavin
d1b7a69141
Merge branch 'develop' into permlevel-apis 2023-01-16 14:54:36 +05:30
Gavin D'souza
47bcc527f3 fix: Remove logic short circuit / dont reject fields easily 2023-01-16 14:51:31 +05:30
Gavin D'souza
85d6949d04 fix: Raise PermissionError when user doesnt have access to linked table 2023-01-16 14:28:47 +05:30
Gavin D'souza
0355f33b77 fix(db_query): Handle permlevel check cases clearer
- Split to utility functions for clarity
- Add example over code blocks
- Re-arrange blocks based on priority
2023-01-16 13:54:56 +05:30
Gavin D'souza
197de99e35 refactor: Use permitted over available in variable naming 2023-01-16 11:07:56 +05:30
Devin Slauenwhite
7e6e7aa055 fix: ambiguous linked tables 2023-01-13 13:53:13 -05:00
Gavin D'souza
19b728f514 fix(db_query): Parse distinct field usages 2023-01-11 14:05:10 +05:30
Ankush Menat
327300b6c9
fix(UX): Better message for update after submit. (#19558)
[skip ci]
2023-01-10 19:35:45 +05:30
Ankush Menat
1b1e4de35e
chore!: dead code (#19551)
This was added for some very old patch code.

[skip ci]
2023-01-10 18:53:08 +05:30
gavin
2b27652bd4
Merge branch 'develop' into permlevel-apis 2023-01-10 17:45:46 +05:30
Gavin D'souza
3ee510439b fix(db_query): Allow standalone functions, rename get_permitted_fields 2023-01-10 17:43:14 +05:30
Raffael Meyer
ed30a6d59f
refactor(minor): use DocStatus (#19545) 2023-01-10 17:38:11 +05:30
Gavin D'souza
ae81cd2dd3 fix(doc): Maintain virtual df data in as_valid_dict 2023-01-09 18:44:42 +05:30
Gavin D'souza
bb9763def7 fix(db_query): Parse SQL function calls to check if field is accessible 2023-01-09 18:19:03 +05:30
Gavin D'souza
058c49f439 fix: Pass parenttype in meta calls, handle count(*) type queries 2023-01-09 17:09:36 +05:30
Gavin D'souza
2a6f9b1b9a fix(db_query): Load doctype meta on demand not on init 2023-01-09 16:22:01 +05:30
Gavin D'souza
1f50370599 fix(db_query): Apply permlevel checks on child/joined table queries 2023-01-09 16:12:22 +05:30
Gavin D'souza
15e51307b1 fix(db_query): Maintain order of dict[/select] keys
* Reduce internals' mutating calls
* maintain order of fields as previous function
* Use performant f-strings over concat + formatting
2023-01-09 15:47:21 +05:30
Gavin D'souza
1cd7620a3c fix: Fetch fields according to meta maintain order 2023-01-09 15:47:21 +05:30
Gavin D'souza
48aa7e8a93 perf(db_query): Avoid re-fetching doctype meta
Store doctype meta in DatabaseQuery instance under `doctype_meta`
bypassing multiple get_meta calls and Redis/DB IO & serialization overheads.
2023-01-09 15:47:21 +05:30
Gavin D'souza
d71522091e fix: Apply permlevel restrictions to DatabaseQuery
Allow reading only accessible fields for given user session if
ignore_permissions (get_all) is unset.
2023-01-09 15:47:21 +05:30
Gavin D'souza
ee074ec3c0 perf: DatabaseQuery.prepare_args
* Re-use stripped str variable where possible
* Remove use of any + [], startswith to get rid of unnecessary evaluations
2023-01-09 15:47:21 +05:30
Gavin D'souza
c28e4590e8 fix(rest): Delete doc attr if insufficient field permissions 2023-01-09 15:47:21 +05:30
rohitwaghchaure
0e9d16820b
fix: For Update for child table (#19436) 2023-01-02 11:35:21 +05:30
Sagar Vora
e84cea9901
Merge pull request #19395 from resilient-tech/old-cache-code-removal
chore: remove code for handling old dict-based meta cache
2022-12-31 11:11:39 +00:00
rohitwaghchaure
a72fdcbd89
fix: not able to make delivery note from pick list (#19418) 2022-12-27 17:58:04 +05:30
Sagar Vora
1458429d98
chore(Document): remove code that resets self.latest (#19399) 2022-12-24 00:13:28 +05:30
Sagar Vora
d072e20cbd chore: fix typo 2022-12-23 06:13:07 +00:00
Sagar Vora
7fdcafddce chore: remove code for handling old dict cache 2022-12-23 06:13:07 +00:00
Daizy Modi
d88ef967b9
feat: hook ignore_links_on_delete to skip doctypes on delete (#19347)
* feat: hook `ignore_links_on_delete` to skip doctypes on delete

* fix: helper comment

* fix: helper comment

* test: test case for `ignore_links_on_delete`

* test: fix test case
2022-12-20 11:17:28 +05:30
Ankush Menat
a1132075a0
Merge pull request #19326 from resilient-tech/get-latest-fix
perf: reuse `_doc_before_save` in `doc.get_latest`
2022-12-19 12:30:30 +05:30
Sagar Vora
2fd2d426cc
fix: better check of whether doctype is child table (#19329)
* fix: better check of whether doctype is child table

* perf: init `_table_fields` earlier
2022-12-19 11:50:16 +05:30
Sagar Vora
c453ad2d97 perf: reuse _doc_before_save in doc.get_latest 2022-12-17 07:56:54 +00:00
Hussain Nagaria
da7fd35e49 fix: handle HTML code field's has_content 2022-12-14 19:36:07 +05:30