Commit graph

3352 commits

Author SHA1 Message Date
Akhil Narang
16489b342b
Merge pull request #25125 from akhilnarang/bg-job-docstring
refactor: update docstring and typehints for functions
2024-02-28 11:30:43 +05:30
Akhil Narang
1ca98566d4
fix(background_jobs): update type hint and docstring
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-27 12:20:13 +05:30
Corentin Flr
0934dfea93
fix(formatters): Translate Select value in format_value (#24951) 2024-02-26 21:05:44 +05:30
Ankush Menat
a19fd6a8b9
fix: Don't init site if already init-ed during truncate (#25033) 2024-02-23 11:37:38 +00:00
Akhil Narang
bf12be6928
fix: 755 -> 644
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-23 16:54:10 +05:30
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Ankush Menat
718b5b8bee
fix: Private images in PDFs from background jobs (#24980)
* refactor: Private images rendering in PDFs

Private images currently render fine if PDF is generated during a
request as we pass the cookiejar to WKHTML.

Background jobs however fail completeley because they can't retrieve
private images without cookiejar.

This PR converts all image types to base64 encoded sources in HTML
itself, so wkhtmltopdf doesn't have to a fire a request.

* test: private images in pdf
2024-02-21 10:38:02 +00:00
Akhil Narang
648828c3b5
fix(redis_wrapper): handle redis not being connected during cache clearing
Ignore the redis connection errors, we can still proceed here

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 11:26:57 +05:30
Akhil Narang
5343bcb756
fix(redis_wrapper/hdel): don't pipeline if we can avoid it
For a single deletion it doesn't make much sense, so just directly delete and return

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Akhil Narang
94365a59bf
chore(utils/caching): drop unnecessary indent
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Akhil Narang
7c82115f5b
refactor(redis): DEL -> UNLINK
This is beneficial since unlink is non blocking, it will run in a different thread if the data passed is large
https://redis.io/commands/unlink/

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Akhil Narang
762290db9a
chore: don't delete keys that aren't used
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Akhil Narang
aa38d9e2f4
refactor: pipeline wherever possible, optimize calls
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-19 14:28:35 +05:30
Ankush Menat
e6120f230a
Merge pull request #23848 from barredterra/copy-config-to-new-app
feat: default configuration for new app
2024-02-19 12:19:07 +05:30
Ankush Menat
beb75ef66e
Merge pull request #24919 from scdanieli/fix-has-value-changed
fix: ensure has_value_changed works for Datetime, Date and Time fields
2024-02-19 10:54:45 +05:30
barredterra
d67066dfae fix: switch to ruff 2024-02-18 16:42:41 +01:00
barredterra
7e5dd21cba Merge remote-tracking branch 'upstream/develop' into copy-config-to-new-app 2024-02-18 16:30:00 +01:00
scdanieli
a1cb19c820 fix: ensure has_value_changed works for datetime, date and timedelta fields 2024-02-18 16:05:31 +01:00
Raffael Meyer
fc64e8a0fb
feat: pass doctype as context when translating label (#24903) 2024-02-18 19:42:15 +05:30
barredterra
1aae576b1a Merge branch 'develop' into copy-config-to-new-app 2024-02-16 14:36:58 +01:00
barredterra
30d63b165b refactor: split into multiple methods 2024-02-13 11:44:50 +01:00
barredterra
2a85c4c5d9 refactor: no inline if-statement
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2024-02-13 11:29:30 +01:00
barredterra
2e4dd1ba77 refactor: setup_backup_tables 2024-02-12 18:16:47 +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
Nihalroshan55
c21935ba9e
fix: added prefix none as default in export_fixtures (#24816)
* added prefix none as default in export_fixtures

* refactor: declare prefix default later later

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2024-02-10 08:21:56 +00:00
Raffael Meyer
b3b02c809f
Merge pull request #24684 from barredterra/label-in-link-to-form 2024-02-09 21:03:07 +01:00
barredterra
51743e5952 feat: frapp.model.can_submit (JS) 2024-02-09 16:19:12 +01:00
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
7753ed28fb
fix(DX): show user who modified in diff view (#24790) 2024-02-06 13:00:31 +00:00
barredterra
c282103867 fix: make get_url_to_form accept single doctype 2024-02-06 12:49:31 +01:00
Ankush Menat
2c19e846df refactor: simplify code
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2024-02-06 13:02:45 +05:30
Ankush Menat
d616341ad4 fix: Auto delete very old document locks
locks older than 12 hours are most likely from dead processes. They can be (mostly) safely ignored.
2024-02-06 12:28:05 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
7487df22c9 refactor: use frappe.get_system_settings
because it's cached and doesn't hit frappe.db at all.
2024-02-02 18:43:43 +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
Maharshi Patel
3fb418f28f
Merge pull request #23907 from marination/dynamic-header-footer-develop
feat: Letterhead Scripts & fix disappearing header in pdf
2024-02-01 17:43:12 +05:30
Akhil Narang
ea65d86d72
Merge pull request #24625 from blaggacao/fix/shell-escaping
fix: shell escaping on external commands
2024-02-01 12:45:21 +05:30
marination
4d2c4f020b fix: Check if header/footer html exists before trying to extract
- issue: AttributeError: 'NoneType' object has no attribute 'extract', when no letterhead html was present
2024-01-31 12:54:20 +01:00
Ankush Menat
a25e68a763
fix: make rate_limiter respect multitenancy (#24634)
* fix: make rate_limiter respect multitenancy

* fix: lower rate limit window for password reset

* refactor: Use redis_wrapper
2024-01-31 09:16:27 +00:00
Ankush Menat
dedadbb0d9 perf: optional faster perm check for files 2024-01-31 10:49:18 +05:30
David Arnold
3abbde3284
fix: shell escaping on external commands 2024-01-30 18:23:05 +01:00
Ankush Menat
d838da51dd fix: short circuit private files perm check
For guest users there's no point in checking permissions, they'll eventually fail... instead just fail immediately.
2024-01-30 20:31:28 +05:30
barredterra
ce50162213 Merge branch 'develop' into copy-config-to-new-app 2024-01-29 15:07:13 +01:00
marination
bcca1da8d8 fix: Extract header/footer html into content to simplify things
- Extract header/footer html into `content` first, then remove any instances from the main content since it is already rendered via the extracted header/footer html
2024-01-29 13:25:45 +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
barredterra
9d6cbd0c15 fix: typos 2024-01-24 02:41:03 +01:00
barredterra
61a72b1803 fix: improve translatability of money in words 2024-01-23 19:24:12 +01:00
marination
f77b99396e fix: Custom Script runs twice
- `frappe.get_print` calls `get_response_content("printview")` which calls `www/printview` that adds header and footer scripts
- Now it gets added again via `pdf_header_footer.html` which causes the script to run twice
- Header and Footer html are also added twice but then removed and handled in pdf.py (because printview + wkhtml processing)
- Misc: Use walrus operator
- Remove passed `letterhead` to insert script via pdf.py, printview handles it
2024-01-22 22:42:13 +01:00