Commit graph

1677 commits

Author SHA1 Message Date
Ankush Menat
b3840596fc
test: mock github API calls (#21450)
[skip ci]
2023-06-21 16:33:09 +05:30
Smit Vora
db6a06d204
fix: make sure number is not zero for bankers_rounding (#21431)
* fix: make sure num is not zero for bankers_rounding

* test: rounding near zero

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-06-20 12:00:22 +05:30
Ankush Menat
3f3ee12338 Revert: keep supporting set_value for singles
w/ explicit check for singles

This shouldn't have any performance impact as last function call only
happens if we THINK it's single doctype. use set_single_value to avoid
that extra function call.
2023-06-14 17:30:32 +05:30
Ankush Menat
039be73af4
refactor: Consider singles for dynamic set_value usage (#21367)
Found all usage using this semgrep rule:

```yaml
    - pattern: frappe.db.set_value($DOCTYPE, ...)
    - pattern-not: frappe.db.set_value("$STR", ...)
```
2023-06-14 10:46:25 +05:30
Ankush Menat
3d0888a5d5 refactor: set_value usage 2023-06-13 16:00:43 +05:30
Ankush Menat
3005e66e45 refactor!: Drop previously deprecated code 2023-06-13 16:00:43 +05:30
Ritwik Puri
fbc25d206e
Merge pull request #21304 from phot0n/fix-expiry-for-email-queue
feat: bulk retry for email queue & remove infinite* retry for certain smtp exceptions
2023-06-12 15:08:44 +05:30
Ankush Menat
18e791a353 build(deps): PyPDF2 -> pypdf
closes https://github.com/frappe/frappe/issues/19861
2023-06-10 20:47:27 +05:30
Ankush Menat
8485ac5d62 build(deps): bump many dependencies
test: change code to adapt to new werkzeug client

fix: avoid setting charset

utf8 is default and assumed now by werkzeug, setting this manually is
deprecated.

fix: use string instead of bytes for setting headers

DeprecationWarning: Passing bytes as a header value is deprecated and will not be supported in Werkzeug 3.0.
12:23:34 web.1         |   response.headers["X-Page-Name"] = path.encode("ascii", errors="xmlcharrefreplace")
2023-06-10 20:47:27 +05:30
phot0n
1f8598891e fix: remove infinite sending retries for certain exceptions for email queue
* chore: remove expired status & set_expiry job from email queue
2023-06-09 14:38:55 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
40b3cd82bc
feat!: frappe.cache() -> frappe.cache (#21279)
This is more intuitive and consistent with other things like `frappe.db`.

PS: This is quite likely to break some weird usage which I can't guess right now. Normal usage inside request/job cycles will continue to work as it used to.
2023-06-07 22:47:45 +05:30
Ankush Menat
26722b1a1c fix: ignore ConnectionError in frappe.cache().exists() 2023-06-03 22:53:10 +05:30
Ankush Menat
0d056a3a2b test: fix broken tests
Fixture test:
This is broken cause it's trying to find doctype after it has been
deleted (wut?)
It was working so far because cache wasn't cleared correctly so you'd
still find it from cache.

db.set_value test:
converted to use last query instead of patching SQL
2023-06-03 22:53:10 +05:30
Ankush Menat
7d50ef19d3 perf: Delete multiple keys in O(1) redis calls
Currently we call redis for each key, redis already supports deleting
multiple keys in one go.
2023-06-03 22:53:10 +05:30
Ankush Menat
4193a251a5 fix: Invalidate cache on rollback too
Steps:
    - Document modified
    - Document refetched from cache
    - Transaction rolled back
    - Cache now contains unmodified changes.
2023-06-03 22:53:10 +05:30
Ankush Menat
0b9dee4791 test: db callbacks 2023-06-03 18:44:19 +05:30
Ankush Menat
54ae0c4a21 refactor: move flush_realtime_log to realtime.py
This doesn't have anything to do with databases
2023-06-03 18:44:19 +05:30
Ankush Menat
ccc107b41f test: use db.before_commit 2023-06-03 18:44:19 +05:30
Ankush Menat
b3d370a0b1 refactor!: remove rollback_observers
use `frappe.db.after_rollback.add` instead
2023-06-03 18:44:19 +05:30
Ankush Menat
7e9ef00bea refactor!: Remove frappe.db.add_before_commit
Not used anywhere, use `frappe.db.before_commit.add()` instead.
2023-06-03 18:44:19 +05:30
Sagar Vora
81d5160ac1 test: ensure stricter filters when validate_filters is passed 2023-05-31 14:16:52 +05:30
Sagar Vora
9f5a994f70 fix!: improved filter validation in Engine.get_query 2023-05-31 14:16:52 +05:30
Ankush Menat
4a81d9f8e3
feat!: populate fields from kwargs in frappe.new_doc (#21190)
This makes it similar to `get_doc` API BUT still signifies intent that
it's a "NEW" document.

Minor Breaking Change: positional arguments are now forcefully keyword
arguments. Only seems to be used internally from what I can tell.

https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/frappe/.*+/frappe.new_doc%5C%28.*%3F%2C.*%3F%5C%29/+lang:python+&patternType=regexp&case=yes&sm=0&groupBy=repo
2023-05-31 12:29:31 +05:30
Ankush Menat
a1c40d9158 feat: support tree-link-fields filtering in QB 2023-05-29 17:00:37 +05:30
Ankush Menat
e5878b0c68 test: reduce duplication 2023-05-29 15:35:38 +05:30
Sagar Sharma
a43ad15eab feat: Truncate QB function 2023-05-26 14:03:47 +05:30
Sagar Sharma
3f0b03c808 feat: Round QB function 2023-05-26 14:03:12 +05:30
Gursheen Kaur Anand
49fe6e0c98
feat: patches.txt template added by default for new apps #21046 (#21070)
* Added patches.txt template in boilerplate

* test: new app patches.txt

* style: formatting

---------

Co-authored-by: Gursheen Anand <gursheen@frappe.io>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-05-24 14:47:06 +05:30
Suraj Shetty
bd737d3616
Merge branch 'develop' into fix-note-2 2023-05-16 07:53:15 +05:30
Ritwik Puri
4bd32bcf04
fix: naming part should be empty if field is empty (#20978) 2023-05-14 00:41:12 +05:30
Faris Ansari
2df7fdd79e
Merge pull request #20908 from netchampfaris/qb-getquery-child-fields-syntax-sugar 2023-05-11 12:02:30 +05:30
Ankush Menat
e0f465ed9c test: expected failing test 2023-05-09 12:42:25 +05:30
Faris Ansari
7e7b1e024a test: for child query in qb.get_query 2023-05-08 18:55:11 +05:30
William Luke
e0ed7d3b97
fix(oauth): add exp to idToken (#20694) 2023-05-05 01:19:03 +05:30
gavin
c4ecd33357
Merge branch 'develop' into fix-20689 2023-04-27 14:38:32 +05:30
Ankush Menat
109a549a23
fix: pass reference_doctype to search query methods (#20842)
frappe.call ensures that it's only passed to functions which can accept
it, so nothing to worry about ~ backward compatible change.
2023-04-25 18:31:14 +05:30
Gavin D'souza
340617c1e1 test: Add check to make sure select & search fields intersect 2023-04-22 15:07:14 +05:30
Gavin D'souza
c0537c74da test: Add check for permitted fields 2023-04-22 13:28:17 +05:30
Suraj Shetty
3028918f98
Merge branch 'develop' into fix-note-2 2023-04-17 13:19:48 +05:30
Ankush Menat
76e576c83e test: fix print view test from lang 2023-04-14 09:07:00 +05:30
barredterra
44bb745035 fix: change pretty date expectations in test 2023-04-11 15:56:05 +02:00
Ankush Menat
d7b474f4ac
Merge pull request #20648 from ankush/translations_hooks_order
fix(translations)!: load translation in installed app order
2023-04-11 18:29:01 +05:30
Ankush Menat
6fa732e2f7 test: flake in redis caching test
[skip ci]
2023-04-11 12:29:59 +05:30
Ankush Menat
361e44de1d fix(translations)!: load translation in installed order
- translations are loaded in apps.txt order this doesnt make much sense.
- translations are loaded from apps which aren't even installed, again
  doesn't make sense.

Breaking but necessary change.
2023-04-11 12:10:45 +05:30
Ankush Menat
a3a9e40aa4
fix: log requests even if no response (#20638) 2023-04-11 07:29:14 +05:30
Deepesh Garg
c0ae00168d chore: Only run on mariadb 2023-04-10 13:58:06 +05:30
Deepesh Garg
5d61ed2d8f test: Update test 2023-04-09 21:26:35 +05:30
Deepesh Garg
68b1051f69 test: Set defualts 2023-04-09 20:43:10 +05:30
Deepesh Garg
5527048592 test: Create user 2023-04-07 11:49:25 +05:30