Commit graph

2484 commits

Author SHA1 Message Date
anandbaburajan
0aab6160a4 chore: validate arg for rename_field() 2023-11-17 00:31:04 +05:30
Akhil Narang
731c5c8cd5
refactor(db_query): check for docfield not_nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
10ad99869a
feat: use user-specified default value if passed
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
15c925ccc7
feat: check for docfield not_nullable property to decide whether a field can be nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
390d4e1b13
chore: drop unused variables and parameters
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
75709eede7
feat: set a non-null value if docfield isn't set as nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
18867b273f
chore: make return type annotation make more sense
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
David Arnold
91e22446d2
Merge remote-tracking branch 'upstream/develop' into feat/into-child-mapper 2023-11-13 10:03:38 +01:00
Ankush Menat
47c3151662
fix: remove data import legacy leftover fields (#23113)
* fix: clear last message if ignoring DNE

* fix: attempt to delete data import legacy leftover fields
2023-11-06 19:18:39 +05:30
Ankush Menat
cc9e92572b perf: dont query ignored link doctypes
Currently the code first queries and then ignores, just don't query linked doctypes if they are ignored via validation.
2023-10-31 15:14:24 +05:30
Ankush Menat
6926669577 perf: Ignore amended_from link fields in link field checks
Small perf benefit at not much cost. `amended_from` are *always*
refererring to cancelled documents so there's no need to check these
fields.
2023-10-31 15:03:08 +05:30
Marica
6b1ec4703d
fix: Validate invalid links in fetch_from dependency fields (#22993) 2023-10-30 18:43:41 +05:30
gavin
8e7cd47d3d
feat: Document.remove_tag (#22970)
Added remove_tag API for consistency
2023-10-30 16:10:20 +05:30
Ankush Menat
1560fa8610
fix: ignore stale custom fields while checking back-links (#22940)
* fix: ignore non-existing back-links

* refactor: less indentation, guard clauses
2023-10-27 14:07:58 +05:30
Ankush Menat
385fa8aaef
fix!: Correct between filtering (#22918)
* fix: Remove incorrect fallback

If you do +1 on date it will also start considering next date. This was
only done to accomodate date filter on datetime fields. Which also
doesn't really work.

* refactor: simplify fieldtype detection

* fix!: Correct datetime fallbacks for between filters

* chore: remove unncessary test

This is very specific and introduces flake when the job tests run before
it.
2023-10-26 06:23:14 +00:00
Maharshi Patel
409a3a8105 Merge branch 'develop' into fix-attach-before-doc-save 2023-10-19 11:40:20 +05:30
Ankush Menat
018ed845bd refactor: defer unnecessary json-dumping of messages
Also avoid accessing locals where interface is present like for popping last message.
2023-10-16 18:13:50 +05:30
Ankush Menat
d5a21a2676 fix: rename type validation
`None` can be passed which is acceptable here.

TODO: Make slackdict accept none as bool and convert to False
2023-10-16 18:12:53 +05:30
Ankush Menat
11dd961d81 refactor!: Method whitelisting
Document.whitelist doesn't work, no idea why it's doing all weird
`__func__` business.

`@frappe.whitelist()` works just fine.
2023-10-16 18:12:53 +05:30
Ankush Menat
52d6bd67e4 fix: Always return document from doc.insert 2023-10-13 15:34:03 +05:30
Akhil Narang
1482ad68c9 fix(model/document): add missing parameters to docstring
[skip ci]

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-13 14:51:39 +05:30
Maharshi Patel
53cdd6d1bf fix: relink attachments before saving doc
Certain people add attachment, before filling mandatory fields
which will raise Missing Fields error.

Or any other kind of errors raised by different validators due to which
file is uploaded but doc is not saved.

This will lead to orphaned/mislinked files. ex. new-purchase-receipt-1

This fix changes name of new docs to new-<doctype>-<no>-<10digithash>
after saving the document we can use this new name to find any mislinked
files created in past hour and relink them to the new doc on save.
2023-10-10 23:49:16 +05:30
Akhil Narang
b601131d8f
fix: don't allow setting an invalid rating (#22633)
* feat: don't allow setting an invalid rating

Convert anything <0 to 0, and anything >1 to 1

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: add in tests for rating

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-10 15:38:58 +05:30
David Arnold
14cc0ac29b
feat(model): implement into-child table mapper 2023-09-29 18:32:50 +02:00
Ankush Menat
cc292d6789 fix!: Last overriden method should be considered
Following same principle of last writer wins everywhere
2023-09-25 16:35:12 +05:30
Ankush Menat
6a2bfbf61d
fix: Ignore perm while updating module onboarding (#22448)
* fix: Ignore perm while updating module onboarding

* fix: incorrect error message
2023-09-18 09:00:53 +00:00
Ankush Menat
b409a05e8e fix: Ignore all non-import exceptions 2023-09-15 16:22:09 +05:30
Ankush Menat
c189b7e622 revert: syncing of report and pages 2023-09-15 16:22:06 +05:30
Ankush Menat
662b07170c test: orpahned doctype check after patch test 2023-09-15 16:18:25 +05:30
Ankush Menat
b9ee6827b4 refactor: stale object removal
- Do it after migration, post migration might use some old doctype.
- stale -> orpahn
- dont commit changes individually
- Remove table doctype too
2023-09-15 16:18:25 +05:30
14987
2937ba38db fix: Update get_doc filter 2023-09-15 16:18:25 +05:30
14987
31a1d37f0a refactor: Fix ambigious var name 2023-09-15 16:18:25 +05:30
14987
b9449a4f13 fix: Delete stale doctypes, reports and pages 2023-09-15 16:18:25 +05:30
Deepesh Garg
b3742b45a8
Merge pull request #22104 from GursheenK/doc-comparator
feat: audit trail
2023-09-13 14:04:15 +05:30
Gursheen Anand
177955a12f fix: check label for fields 2023-09-11 11:06:01 +05:30
Sagar Vora
bcc7cc9a3d
style: use functools.cached_property (#22304) 2023-09-04 16:50:25 +05:30
Ankush Menat
04b2c42778
Merge pull request #22239 from ankush/reveal_missing_perm
fix(UX): Highlight which permission is missing
2023-08-29 20:25:12 +05:30
Ankush Menat
edfeb0d932 fix(UX): Highlight which permission is missing 2023-08-29 19:11:58 +05:30
Ankush Menat
5fd0dfb163 fix: dont allow rename+merge for case changes 2023-08-29 18:03:16 +05:30
Ankush Menat
730e906dfd
refactor!: remove implicit primary key from logs (#22209) 2023-08-26 16:01:47 +05:30
mergify[bot]
fdcfb82f47
Merge pull request #22114 from gavindsouza/doc-bulk_insert-include_child
fix: Handle child record insertions via bulk_insert
2023-08-25 13:57:38 +00:00
Gavin D'souza
6b1609d277
fix: Cast documents iterable to list in db_insert 2023-08-25 16:12:48 +05:30
mergify[bot]
d6d82eb581
Merge pull request #22110 from resilient-tech/perf-as_dict-2
perf: undo regression in `as_dict` performance
2023-08-21 06:10:54 +00:00
Sagar Vora
7dc67f2feb chore: add back getattr for virtual docfields which get value from a property 2023-08-18 21:51:56 +05:30
Gavin D'souza
a996ff7f5b fix: Handle child record insertions via bulk_insert 2023-08-18 14:17:19 +00:00
Ankush Menat
d1495bb991 perf: ignore log links and disable in background jobs
Scheduled job type keeps getting updated for every scheduled job. This
is not required at all and not triggered by user.

This feature is for prioritizing user selected links, background jobs
should be ignored.
2023-08-18 17:47:58 +05:30
Sagar Vora
928bc46be3 perf: undo regression in as_dict performance 2023-08-18 17:44:45 +05:30
Gursheen Anand
0d80ffc988 fix: return df label only when not none 2023-08-18 11:01:55 +05:30
Ankush Menat
c7847395da
fix: remove thread-unsafe class attributes (#22097)
The problem is same as mutable defaults. Container type class attributes
are mutable and shared between all objects.

```python
class CLS:
    attr = {}
    ...

a = CLS()
b = CLS()

a.attr is b.attr  # => True
```
2023-08-17 20:11:20 +05:30
Ankush Menat
79392260d4
fix: autoincr caching and clear site cache after restore (#22079)
* fix: remove hazardous cache for autoincr

* fix: move cache to redis

* fix: clear all redis cache after restoring a site
2023-08-17 11:11:27 +05:30