Commit graph

36414 commits

Author SHA1 Message Date
saxenabhishek
e2d49c17ff refactor: remove reduandant func call 2022-01-11 01:01:44 +05:30
saxenabhishek
0f75394720 refactor: pythonic NamedParameterWrapper 2022-01-11 01:01:44 +05:30
saxenabhishek
15f3523c24 test: qb parameterization
where conditions
set update conditions
where with a function
2022-01-11 01:01:29 +05:30
Gavin D'souza
d81fe8699c feat: frappe.db.set_single_value
Alias to frappe.db.set_value without having to pass the doctype name
twice or teh second one as None

Other changes:
* set/get db APIs for single DocTypes
* Make use of redundant cache key in frappe.db.get_single_value
2022-01-10 21:03:14 +05:30
Gavin D'souza
202145f0ec test: Add tests for frappe.db.set_value 2022-01-10 21:01:02 +05:30
Gavin D'souza
479f637f76 fix(single:set_value): Cast using sbool instead of str for all 2022-01-10 20:59:50 +05:30
mergify[bot]
5feebe22b0
Merge pull request #15569 from ankush/drop_py37
fix!: drop py3.7 support for v14
2022-01-10 11:28:06 +00:00
mergify[bot]
2446c5e099
Merge pull request #15564 from Havenir/fix-communication-get-contacts
fix: communication method "get_contacts"
2022-01-10 11:22:35 +00:00
saxenabhishek
f7cb090c5a style: test_query_builder 2022-01-10 16:09:53 +05:30
Pruthvi Patel
d1852242a0 fix: limit in Document.get 2022-01-10 15:52:25 +05:30
Gavin D'souza
3052808048 fix: Don't cast to str if None or Falsy
* refactor: use get_single_value instead of set_value(blah, None, blah1)
* User.reload in test_home_page to combat what happens locally
2022-01-10 15:05:57 +05:30
Ankush Menat
3d474b5927 fix: drop py3.7 support for v14 2022-01-10 13:45:18 +05:30
Gavin D'souza
f6fba91fd2 chore(typing): Add type hints in qb builder classes 2022-01-10 13:44:23 +05:30
Gavin D'souza
04e79eb075 fix(qb:ValueWrapper): Use get_value_sql only for str values 2022-01-10 13:25:47 +05:30
Gavin D'souza
5de0b5cd35 style: remove commented code, whitespaces test_file, added typing hint 2022-01-10 13:23:49 +05:30
Pruthvi Patel
000625038c fix: delete property setter 2022-01-10 10:41:51 +05:30
Pruthvi Patel
97edb8f267 fix: delete translation only if label is empty 2022-01-10 10:40:58 +05:30
Gavin D'souza
6aa9a0bef5 style: Sorted imports & whitespace consistency 2022-01-07 20:44:51 +05:30
Gavin D'souza
34a6f7adb5 fix(qb): Patch ParameterizedValueWrapper as wrapper_cls 2022-01-07 20:43:50 +05:30
Ahmad
9ebfc1ced9 refactor: communication.py 2022-01-07 17:33:54 +05:00
Ahmad
6afa5c8da3 fix: email_string parsing when pulling email 2022-01-07 17:33:35 +05:00
Rohan Bansal
10c5e732a5 fix: allow longer authorization URIs 2022-01-07 17:54:28 +05:30
ruthra
bf68f76405 fix: data exporter throwing exception 2022-01-07 15:49:05 +05:30
Saqib Ansari
1bde3b48bd fix: parsing exception from traceback 2022-01-07 14:56:25 +05:30
Saqib Ansari
307c7ced69 chore: check custom exception handlers only for json response 2022-01-07 14:55:54 +05:30
Gavin D'souza
31cc658e6d fix(typing): Add type hints for frappe.cache 2022-01-07 14:17:28 +05:30
Gavin D'souza
123bcc9509 fix: Clear cache on set_value 2022-01-07 14:16:45 +05:30
Gavin D'souza
b0c30363cf fix: Cast values as str for all single doctypes
Re-arranged block for simplicity. Type casting doesn't change anything
it seems. On get_value, values are casted properly.
2022-01-07 11:49:49 +05:30
Gavin D'souza
697d6f2d7a fix: Run query even if no documents found for_update
If no docnames are found, then use NULL as fallback. I tested this on PostgreSQL & MariaDB and it seems to work as expected

    In [1]: from frappe.query_builder import Field

    In [2]: frappe.db.set_value('ToDo', Field("creation") > Field("modified"), 'description', 'change 2', for_update=True, debug=True)
    SELECT "name" FROM "tabToDo" WHERE "creation">"modified"
    Execution time: 0.0 sec
    UPDATE "tabToDo" SET "description"='change 2',"modified"='2021-10-22 09:38:40.110481',"modified_by"='Administrator' WHERE "name" IN (NULL)
    Execution time: 0.0 sec
2022-01-07 11:47:49 +05:30
Gavin D'souza
aefb8e3b06 fix: Expand iterable to get rid of extra brackets
Although valid SQL, MariaDB didn't like double brackets on VALUES. It
raised ERROR 1241: Operand should contain 1 column(s)
2022-01-07 11:46:56 +05:30
Gavin D'souza
44f603fc6e refactor: frappe.db.set_value
* Simplified logic
* Perf enhancements (removed unnecessary conditional computations)
* Use query builder and ORM to build queries instead of juggling
2022-01-07 11:45:27 +05:30
Gavin D'souza
981564e544 Merge branch 'develop' into frappe-postgres-changes 2022-01-07 11:37:28 +05:30
Gavin D'souza
d9b571cf43 refactor(minor): DatabaseQuery.prepare_select_args
* Used regex to replace instead of re-iteration (for-loop)
* Used f-strings for better readability
* Renamed and re-ordered vars, code block
2022-01-07 11:35:52 +05:30
Suraj Shetty
b64cab6867
Merge pull request #15543 from alyf-de/white-space-unset 2022-01-07 11:16:58 +05:30
mergify[bot]
7f74a3164d
Merge pull request #15551 from hrwX/custom_translations
feat: add translations to datatable
2022-01-07 05:25:03 +00:00
Conor
55392b64e7 fix: Revert changes made to fix collation differences
Due to collation differences in MariaDB and Postgres, tests gave
inconsistent results. This was to be handled in tests alone instead of
the application. It was unnecessary. Collation changes should be made at DBMS config
level only. Accomodating for those in the application will unnecessarily
degrade performance for everyone.

Other changes:
* use pluck in user_type
* revert ordering in nestedset
* revert parsing in order_field
* use preferred APIs & styling

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:45:10 +05:30
Conor
1c40881c41 fix: refactor postgres arg prep into its own function 2022-01-07 10:45:05 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
Suraj Shetty
d52f12424a
Merge branch 'develop' into custom_translations 2022-01-07 09:45:14 +05:30
Summayya
6d98860386 fix: my account link unclickable 2022-01-06 21:08:21 +05:30
mergify[bot]
2aa062720a
Merge pull request #14978 from hrwX/multistep_webforms
feat: Multistep webforms
2022-01-06 15:15:32 +00:00
barredterra
ea5695700c feat: add german translations for datatable menu 2022-01-06 15:52:05 +01:00
Raffael Meyer
f04be3f876
fix: sider 2022-01-06 15:44:29 +01:00
barredterra
24ac11c98f fix: update yarn.lock 2022-01-06 15:43:17 +01:00
mergify[bot]
7a6ddb15be
Merge pull request #15554 from shariquerik/single-card-form-fix
fix: Single card form css fix in dark mode
2022-01-06 14:14:56 +00:00
Suraj Shetty
f930fd0fe1
Merge branch 'develop' into multistep_webforms 2022-01-06 18:31:37 +05:30
Suraj Shetty
335eafe0ba
Merge branch 'develop' into single-card-form-fix 2022-01-06 18:30:25 +05:30
Suraj Shetty
2c6f8f04c3
Merge pull request #15502 from surajshetty3416/fix-datetime-filter 2022-01-06 18:29:55 +05:30
Shariq Ansari
3f476fc17c
Merge branch 'develop' into single-card-form-fix 2022-01-06 16:23:20 +05:30
Shariq Ansari
080b3b889f fix: border color fix in dark mode 2022-01-06 16:08:10 +05:30