Commit graph

44888 commits

Author SHA1 Message Date
Ankush Menat
447f02e8d3
fix!: Remove misleading "raise_exception" (#24266)
frappe.permission.has_permission won't accept raise_exception anymore,
it was extremely misleading argument and actual purpose of the argument
was to print perm check logs.
2024-01-11 08:24:18 +00:00
Ankush Menat
3e2e10780b
Merge pull request #24263 from ankush/fix_perm_message
fix: print perm check logs from DB query
2024-01-11 13:31:29 +05:30
Ankush Menat
0a38fb0813 fix: skip exc without exc id 2024-01-11 13:09:43 +05:30
Ankush Menat
b38199a3b3 fix: pass user to has_perm check 2024-01-11 12:34:15 +05:30
Ankush Menat
9f135e8c1d fix: print perm check logs from DB query
Doing has_permission and then manually raising exception erases the perm check messages.

This causes insane amounts of confusion when perm error says X not
permitted while user is trying to check Y.
2024-01-11 12:27:39 +05:30
Maharshi Patel
141abf9faf
fix: set correct recipient when reply to own email (#24256)
* fix: set correct recipient when reply to own email

When Sender clicks on reply to own email, the recipient is set to the Sender's email address instead of the original ( last_email ) recipient.
Added a check if sender is composing a reply to own email and set the recipient to the original ( last_email ) recipient.

* Update communication.js

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2024-01-11 09:57:10 +05:30
Ankush Menat
5ef8577cff
fix!: Stricter requirement for permission hooks (#24253)
BREAKING CHANGE:

before: `has_permission` hooks need to explicitly return "False" to block a user.

after: `has_permission` hook need to explicitly return "True" (or truthy) value to allow user. They will be blocked otherwise.

Why? Everything related to permission should be block by default and allow if some checks pass.
2024-01-11 01:35:08 +05:30
Ankush Menat
5566d20705
Merge pull request #24251 from ankush/translation_fixes
fix: misc translation fixes
2024-01-10 22:05:09 +05:30
Ankush Menat
98b62e8220 fix: add _lt to extractors 2024-01-10 21:47:55 +05:30
Ankush Menat
1f6201b4af feat: lazy global translated strings 2024-01-10 21:28:01 +05:30
Ankush Menat
1f83fd8847 fix: skip if file is not found 2024-01-10 20:47:58 +05:30
Ankush Menat
a77093d6f6
Merge pull request #22732 from barredterra/po-translation
feat: translations via gettext
2024-01-10 19:10:13 +05:30
Ankush Menat
79b0ec76ae test: increase delay after focus
Cypress can't automatically wait for correct time here, it ends up
focusing at wrong field.
2024-01-10 18:59:42 +05:30
Raffael Meyer
81d6bea82c
Merge pull request #24245 from barredterra/ws-domain-restriction 2024-01-10 14:20:32 +01:00
Ankush Menat
f246f37762 fix: language variants support 2024-01-10 18:27:57 +05:30
barredterra
89582dc73d fix: include workspaces without domain restriction 2024-01-10 13:13:19 +01:00
Ankush Menat
4c0a2060dd chore: migrate translations to PO files 2024-01-10 17:30:45 +05:30
Ankush Menat
e893312f37 perf: parallelize MO compilation
This operation is CPU heavy and has little to no Frappe code
involvement. So we can use a processpool of 4 to reduce time taken for
compilation by 4x.
2024-01-10 17:21:19 +05:30
Ankush Menat
9482126b93 perf: Skip rebuilding MO files where PO file is not updated 2024-01-10 17:04:34 +05:30
Ankush Menat
f7413d74fb
Merge pull request #24243 from ankush/annotate_meta
fix(DX): Type annotations for Meta
2024-01-10 16:45:07 +05:30
Ankush Menat
5d8208ccf4 feat: Build MO files with bench build
Translation assets are also... assets, so grouping them with `bench build`.

We can do some special function but that will likely require updating
bench for everyone. Not so ideal.

Also renamed `compile` function as it is a builtin in python.
2024-01-10 16:41:04 +05:30
Ankush Menat
9620a3c596 Merge branch 'develop' into po-translation 2024-01-10 16:17:47 +05:30
Ankush Menat
09ff2a6fb3
Merge pull request #24240 from ankush/file_has_perm
feat: extend perm debugging to popular controllers
2024-01-10 16:09:48 +05:30
Ankush Menat
d09df92497 fix(DX): Type annotations for Meta
`frappe.get_meta` returns which is 90% `DocType` + 10% `Meta` specific
stuff, this hack just allows us to mix both for autocompletions.
2024-01-10 15:58:03 +05:30
Ankush Menat
b3532024b5 fix: Accept "Falsy" values from perm controllers 2024-01-10 15:43:06 +05:30
Ankush Menat
914406d31b feat: extend perm debugging to popular controllers
- [x] File
- [x] Communication
2024-01-10 15:16:52 +05:30
Ankush Menat
3a8fc90961
feat: permission debugger (#24239)
* feat: permission debugger

This PR adds a virtual doctype that can run has_permission for
doctype-docname-user-ptype combinations and spit out detailed log for
why/where some permissionw as denied or granted.

This isn't supposed to be programatic, it's just textual dump of what code is doing.

IMO a better debugger can be written but that will require extensive
rewrite of perm checks first. All debugging, error messages in current
systems are bolted on top with hacks to avoid messing with
implementation.

* fix: capture UP pass check

* fix: reset docname on changing doctype

* fix: docname is optional

* fix: debug doctype perms
2024-01-10 09:29:13 +00:00
Ankush Menat
238085d865
fix: pass parent doctype on dashboard chart (#24236) 2024-01-10 12:27:49 +05:30
Ankush Menat
3884fa3c63
fix: duplicate field in filters (#24189)
* fix: duplicate field in filters

* test: clear filters using new clear filter button
2024-01-09 16:08:27 +05:30
Shariq Ansari
004359ad6e
Merge pull request #24223 from shariquerik/disabled-button-on-upload
fix: added validation if upload is clicked without uploading file
2024-01-09 15:58:08 +05:30
Shariq Ansari
2fe507c58c
chore: linter fix 2024-01-09 15:55:04 +05:30
Shariq Ansari
2da9ba820b fix: added validation if upload is clicked without uploading file 2024-01-09 15:45:14 +05:30
Shariq Ansari
e2493eb3f2
Merge pull request #24217 from shariquerik/invalid-condition-for-number
fix: added invalid conditions for number fields
2024-01-09 15:18:57 +05:30
Shariq Ansari
724fd1a291
chore: linter fix 2024-01-09 15:08:45 +05:30
Ankush Menat
02031fc6f4
fix: don't update docstatus (#24216)
This doesn't make sense.

Updating docstatus without resaving document is a bad idea.

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2024-01-09 09:32:03 +00:00
Shariq Ansari
610bc43a13 fix: added invalid conditions for number fields 2024-01-09 14:50:58 +05:30
rohitwaghchaure
c56c1cc2f7
fix: bom creator tree view not working (#24200) 2024-01-09 10:17:29 +05:30
mergify[bot]
eb1da4ad18
Merge pull request #24211 from RitvikSardana/develop-ritvik-tag-delete-count
fix: count correction when a tag is deleted
2024-01-09 01:46:43 +00:00
RitvikSardana
207962aadc fix: count correction when a tag is deleted 2024-01-09 00:04:48 +05:30
Sagar Vora
417fce091a
fix: delete existing children first to avoid UniqueValidationError (#24140) 2024-01-08 22:00:54 +05:30
Corentin Flr
0932bbf10c
fix(OTP): Autofocus OTP input, fix placeholder (#24203)
* fix(OTP): Autofocus OTP input

DOM insertion does not trigger autofocus, only initial load does.

* fix(OTP): Fix placeholder of OTP input
2024-01-08 21:38:16 +05:30
Ankush Menat
9b8a8c155d
fix: Correct logic for can_cancel (#24196)
You can cancel a document IFF:
- Document has no workflow
- Document has workflow but it doesn't have state with docstatus=2.

closes https://github.com/frappe/frappe/issues/19075
2024-01-08 19:15:19 +05:30
Suraj Shetty
f0e8fedb53
Merge pull request #24144 from batonac/patch-3 2024-01-08 17:48:21 +05:30
Akhil Narang
b3f90ef7f7
Merge pull request #24127 from akhilnarang/db-backup-restore-pipefail
refactor: set pipefail in shell before running piped backup/restore commands
2024-01-08 17:43:25 +05:30
Akhil Narang
ebdf88150d
Merge pull request #24145 from akhilnarang/fix-backup-restore
fix(restore): check backup directory and bench directory if we can't find the file
2024-01-08 17:42:58 +05:30
Suraj Shetty
2ef4492cdc
Merge pull request #24194 from surajshetty3416/fix-default-datetime 2024-01-08 17:21:50 +05:30
Suraj Shetty
64e37ec046 fix: Handle empty value of datetime control 2024-01-08 17:19:40 +05:30
Akhil Narang
076687bdbf
Merge pull request #24188 from akhilnarang/dont-convert-email-lowercase
fix(communication): don't change email case
2024-01-08 17:14:05 +05:30
Shariq Ansari
54ecae0656
fix: Allowed standard fields in data export ( creation, owner) (#24187)
Co-authored-by: Pavan Kumar Yekabote <yekabotep@gmail.com>
2024-01-08 17:09:13 +05:30
Akhil Narang
e3bafe15b6
fix(communication): don't change email case
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-08 16:31:03 +05:30