Commit graph

492 commits

Author SHA1 Message Date
barredterra
aeb8ac1cb9 feat: additional options for timespan filter 2025-01-28 12:37:38 +01:00
Ankush Menat
e4a2b8db38
refactor: trim init.py (#29866)
* refactor: Trim `__init__.py`

We strayed from the goal here: https://github.com/frappe/frappe/pull/29181

So making up for it.

* chore!: Delete unused get_version

Not used anywhere

* refactor: move few more functions to relevant place

* asd
2025-01-20 13:05:02 +00:00
Ankush Menat
c72e91f465
fix: backward compatible date parsing (#29155)
Even though we never use tz aware object in frappe this function
previously used to retain them, so keep TZinfo for sake of compat.

Nothing should be affected ideally.
2025-01-14 11:05:55 +00:00
Ankush Menat
2a5c778235
perf: speedup date parsing (#29090) 2025-01-09 06:55:13 +00:00
Ankush Menat
dd6346e466
perf: Avoid parsing same field repeatedly (#29030) 2025-01-02 15:51:16 +00:00
Akhil Narang
b5bad56cdd
feat(sanitize_column): improve check
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-23 16:16:08 +05:30
Ankush Menat
f243aa1942
perf: faster add_to_date (#28843)
* fix(DX): Accept None directly as input to add_to_date

It's already supported, signature is just not updated.

* perf: use efficient date parser
2024-12-21 05:23:34 +00:00
Ankush Menat
9e9096834f
perf: pretty_date - avoid useless dt->string->dt cycle (#28842) 2024-12-19 14:53:38 +00:00
Ankush Menat
17cc356915
perf: speed up flt by 1.06x and get_system_settings by 1.32x (#28841)
* perf: resolve rounding method once

When rounding method is explcitly specified it's 1.4x faster.

* perf: reorder checks

Bankers rounding is default and most common now

* perf: speedup get_system_settings
2024-12-19 14:38:45 +00:00
Ankush Menat
1c2f8abb4e
perf: speedup get_datetime by ~9.5x (#28840) 2024-12-19 20:01:45 +05:30
Akhil Narang
4cf18d37bd
fix(convert_utc_to_timezone): set UTC if tzinfo undefined
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-10 16:12:01 +05:30
Akhil Narang
ad1ed62652
fix: handle ZoneInfoNotFoundError
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-06 16:01:43 +05:30
Gavin D'souza
00163f5bf4
fix: Re-define utils to match previous behaviour 2024-12-06 15:43:33 +05:30
Gavin D'souza
c6580b5880
refactor: Replace pytz to std lib zoneinfo & datetime
Signed-off-by: Gavin D'souza <gavin.dsouza@switchup.de>
2024-12-06 15:43:33 +05:30
David Arnold
75377aaaf5
refactor(typing): type filters (#28218)
* chore(typing): type filters

* chore(typing): type filters for get_list et al

* fix: dashboard chart filter expression

* test: fix case with new-style right hand object to equality check

* chore: place new typed filter under typing verification

* chore: remove debug print statment

* chore: inverse logic of type guard

* fix: add float to filter value types

* chore: clarify value naming
2024-12-04 23:18:53 +00:00
Akhil Narang
1a45cd3ab0
chore(cint): explicitly handle NoneTypes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 15:36:25 +05:30
Akhil Narang
9c9349b74f
Merge pull request #28658 from akhilnarang/flt-explicit-handle-nonetype
chore(flt): explicitly handle NoneTypes
2024-12-04 15:21:42 +05:30
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Akhil Narang
cfeb1224e6
chore(flt): explicitly handle NoneTypes
These were implicitly handled due to the catch-all 0.0 return, but type checkers break here, and a lot of places depend on this behaviour

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 12:54:46 +05:30
David Arnold
d8fab7a64f
chore: use deprecation dumpster for remaining deprecated decorator (#28555) 2024-11-23 23:50:56 +00:00
David Arnold
8d6f8bce01
chore(typing): add some more typing to frappe.__init__ (#28215) 2024-10-21 11:30:11 +00:00
Akhil Narang
44447d27e0
fix(format_timedelta): don't try to call .total_seconds() if a string was passed in
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-23 16:15:24 +05:30
Akhil Narang
ce3b15c3e1
fix: update comment
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-09-23 16:14:12 +05:30
Raffael Meyer
d3248612cb
fix: money in words (#27190) 2024-09-21 16:24:39 +02:00
Raffael Meyer
b91cacdd18
feat!: enhance Language to become more of a Locale (#27178) 2024-09-21 16:02:58 +02:00
David
d50e579317
feat(utm): make data helper more useful 2024-09-12 00:08:11 +02:00
vishnu
22042ae00b chore: pre-commit 2024-08-21 18:49:48 +00:00
vishnu
5b73b8c20a chore: added calendar module 2024-08-21 18:28:34 +00:00
vishnu
ace2122e92 chore: removed extra functiion 2024-08-21 18:07:03 +00:00
vishnu
b41083561e feat: Add get_month function to return current or specific month as a string 2024-08-17 14:11:00 +00:00
Dany Robert
968800ce72
fix(babel): not a valid locale identifier (#26749) 2024-07-26 14:58:49 +02:00
Ankush Menat
f8abd09ab9
perf: avoid two layer cache of timezone (#26340)
It's same thing, system settings are always fetched, no idea what's point of additional layer of caching on top of it.
2024-05-06 13:12:41 +00:00
Ankush Menat
ee64b2cb6c
fix!: Only use webserver_port in developer mode (#26268) 2024-05-01 12:11:01 +05:30
Maharshi Patel
72b1db0ae5
revert: fix: pointless conditions about systemd/supervisor (#26267)
commit added port numbers in urls which broke links on fc.
2024-04-30 20:31:48 +00:00
Ankush Menat
7b0074e059
refactor!: override_doctype -> Must extend base class (#26152)
* fix: pointless conditions about systemd/supervisor

What does this have to do with hostname?

* fix!: Overriden doctypes must inherit same base class

There is almost never a real need to completely override a class. After
this change we'll only allow extending and not overriding completely.
2024-04-29 10:21:53 +00:00
Akhil Narang
bf931598a2
Revert "Merge pull request #25755 from akhilnarang/optional-skip-msgprint"
This reverts commit f8121b99df, reversing
changes made to 14e2d95947.
2024-04-01 21:42:12 +05:30
Akhil Narang
ca83ad580c
feat: allow skipping msgprint
If we're handling the exception on our own, we don't need to show the user anything
Example: https://github.com/frappe/frappe/blob/version-15/frappe/desk/doctype/event/event.py#L398

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-04-01 14:21:47 +05:30
Ankush Menat
ea5e1b61ad
fix: cint -> avoid precision loss if already integer (#25735) 2024-03-29 22:31:53 +05:30
Maxim Sysoev
eff50e1cd3
fix: filter Implementation is set operator (#25182)
* Implementation is set operator. fix issue #25180

* Refactored filtrer operator `is`,
Add tests

* fix: Correct implementation for `is set`

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2024-03-02 13:59:30 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
scdanieli
a1cb19c820 fix: ensure has_value_changed works for datetime, date and timedelta fields 2024-02-18 16:05:31 +01:00
Ankush Menat
4c925e0325 refactor: Reset password flow
- Hash one time reset tokens instead of storing them as is
- Up the perm level
- Use better source of randomness for generating token
- minor code cleanup here and there
2024-02-11 14:25:26 +05:30
Raffael Meyer
b3b02c809f
Merge pull request #24684 from barredterra/label-in-link-to-form 2024-02-09 21:03:07 +01:00
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
barredterra
c282103867 fix: make get_url_to_form accept single doctype 2024-02-06 12:49:31 +01:00
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
David Arnold
c09f48f5d7
feat: comply trackers with utm and add utm_content for a/b testing (#24521)
* feat: comply trackers with utm and add utm_content for a/b testing

* fix: make all other than source optional

this is plausible.io best practice

* fix: medium is not specified to be lowercase

* fix: ensure proper parameter quoting
2024-02-02 11:33:22 +05:30
barredterra
9e851aa0cc fix: allow name to be missing
for single doctypes
2024-02-01 18:16:05 +01:00
barredterra
5b6f05442e fix: translate label in link to form
When a single doctype is passed to `get_link_to_form`, use the translated doctype as the label.
2024-02-01 18:15:46 +01:00
Corentin Flr
dde34f9402
fix(money_in_words)!: Don't translate the result of num2words
It's unlikely that a translation for the results of num2words exists, because it should return a string that is already translated in the target language. If there are some numbers that have a specific translation, then it should already be handled in the num2words library. A domain-specific library is surely better at this hypothetical task than Frappe's generic translation system.

In French, 100 is called Cent. But in English, Cent is 1/100th of a dollar, which is called Centime in French.
Expected: num2words(200).title() == "Cent"
Actual: _(num2words(200).title()) == _("Cent") == "Centime"
2024-01-26 15:49:18 +01:00