Commit graph

2243 commits

Author SHA1 Message Date
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
106ff1f1ee fix: move cache clearing away from document
Passing lambda function from inside document object would keep reference
to document alive. This means increasing memeory usage in bulk
processing.

Refer https://github.com/frappe/frappe/pull/17061 for example

This also extends it to db.set_value
2023-06-03 22:53:10 +05:30
Ankush Menat
be1da0dd00 chore: remove duplicate cache clearing 2023-06-03 22:53:10 +05:30
Ankush Menat
339cbf208c fix: Cache clearing implementation 2023-06-03 22:53:10 +05:30
Ankush Menat
680cf73cba fix: link_count
This didn't work correctly, if link_count is present in cache it would
just read and dump it back in.

This has practically never worked correctly.
2023-06-03 18:44:19 +05:30
Ankush Menat
3f1c66de10 refactor: move flush_local_link_count to hook 2023-06-03 18:44:19 +05:30
Dhia' Alhaq Shalabi
efff6ebba7
fix: doctype name localization (#21197)
[skip ci]
2023-06-01 12:09:25 +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
Saurabh
aabaab0fd2
feat: used cached version of document in mapper (#21186)
* fix: in get_mapped_doc return cached version if available

* feat: specify explicitly cached version of doc in doc_mapper


[skip ci]
2023-05-31 11:15:33 +05:30
Ankush Menat
3df13ca392 feat: new operator - descendants of (inclusive)
Co-Authored-By: Faris Ansari <netchamp.faris@gmail.com>
2023-05-29 16:59:57 +05:30
Ankush Menat
43714825b0
fix: sync importable doctype before documents (#21131) 2023-05-26 15:58:26 +05:30
Sagar Vora
2eca7b4837 chore: more pythonic code
[skip ci]
2023-05-25 18:47:39 +05:30
PeterG
a182414610
fix(workflow): populate doc from db in apply_workflow (#21068) 2023-05-24 11:35:37 +05:30
Shariq Ansari
2cd8a860e5 fix: sync workspace custom block doctype while installing 2023-05-17 18:16:11 +05:30
Saif Ur Rehman
0b92078c60
fix(delete_doc): Check ignore_links_on_delete with parent doctype (#20898) 2023-05-16 09:04:00 +05:30
Ritwik Puri
2e2c8316c6
fix: use sentinel value for checking existence of key in doc while parsing naming series (#20994) 2023-05-15 14:58:14 +05:30
Ritwik Puri
4bd32bcf04
fix: naming part should be empty if field is empty (#20978) 2023-05-14 00:41:12 +05:30
Gavin D'souza
63a605876f fix: Pass current dt as fallback parent_doctype 2023-04-27 14:37:15 +05:30
Gavin D'souza
a22cbe8ae5 fix: Setup permission_map & use get_permitted_fields 2023-04-22 14:58:28 +05:30
Gavin D'souza
a1f59c5a82 fix: Allow only search fields for select permission type 2023-04-22 12:46:15 +05:30
Gavin D'souza
36ee97a8f8 fix: Dont assume user & permission_type in get_permitted_fileds 2023-04-21 17:40:00 +05:30
Vincent Vrithof
090c91b44f
fix: virtual fields in child tables not displaying (#20528)
* fix: virtual fields in child tables

* Update frappe/model/base_document.py

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

* fix: virtual fields in child tables not displaying

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-04-06 12:30:58 +05:30
Ankush Menat
45c86e2ff8
fix: nestedset rename (#20498) 2023-03-29 12:49:28 +05:30
gavin
3da5a84d7c
fix(meta): get_permitted_fields with no field-columns (#20401) 2023-03-20 21:00:03 +05:30
Sagar Vora
70ede18942
fix: improved implementation of between filter (#20190) 2023-03-02 09:51:02 +05:30
Shariq Ansari
c11c2303ad
Merge branch 'develop' into feat-number-card-workspace-dev 2023-03-01 19:16:21 +05:30
Sagar Vora
e0d7c9d901
chore: remove dead helper function (#20191) 2023-03-01 12:05:30 +05:30
Suraj Shetty
7abdad3282 Merge branch 'develop' of https://github.com/frappe/frappe into newsletter-analytics 2023-02-28 14:31:03 +05:30
Shariq Ansari
d37423916c fix: prioritize workspace_number_card doctype while installing 2023-02-28 13:40:40 +05:30
Suraj Shetty
b397ec3858 feat: Track count of views on newsletter emails 2023-02-23 13:45:53 +05:30
gavin
3406b6d752
fix(db_query): selecting linked fields as alias (#20085)
* fix(db_query): Don't track link_tables separately

Treat all joined tables the same, expand the fieldnames whether Table or
Link type with their respective table names

* fix(db_query): Add link join conditions for all relevant fields

* Revert "fix(db_query): Add link join conditions for all relevant fields"

This reverts commit 79622ab4cea5aa73a24f4ba7afde8e83510a79fb.

* Revert "fix(db_query): Don't track link_tables separately"

This reverts commit b8364f781e52e7ffaa7faa8878ef409b023f2288.

* fix: Check link field tables permissions in permlevel checks

* test: Fix, add for test_permlevel_fields

Previous assertion was wrong :')
added extra to check if access is fine
2023-02-22 22:14:15 +05:30
Devin Slauenwhite
d5ce94d6a5
feat: disable comment count on list view settings. (#20039)
* feat: add list view setting disable column count.

* fix: cast using sbool

* fix: make modified last-child if comment_count is disabled.
2023-02-22 18:17:45 +05:30
Rucha Mahabal
89d63ea82b
fix: false positive attr check while applying permlevel (#20069)
* fix: false positive attr check while applying permlevel

* Revert "fix: false positive attr check while applying permlevel"

This reverts commit 9114788590ce12be977df847c13b00e3bf72ac2a.

* fix: ignore AttributeError while trying to pop low permlevel fields

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-02-20 12:18:37 +05:30
Zhixuan Lai
2d416098c2
fix: link validation fetch from virtual doc (#20055)
Problem: 
document.save() throws "Object is not scriptable exception" when fetching values from virtual doc.

Root cause:
```python
        # ....
        if frappe.get_meta(doctype).get("is_virtual"):
	    values = frappe.get_doc(doctype, docname) <--- Document is not scriptable.
.as_dict()
        # ....

	def set_fetch_from_value(self, doctype, df, values):
		fetch_from_fieldname = df.fetch_from.split(".")[-1]
		value = values[fetch_from_fieldname] <--- Tries to access value by key and throws "Object is not scriptable" exception
```

Solution:
```python
        if frappe.get_meta(doctype).get("is_virtual"):
	    values = frappe.get_doc(doctype, docname).as_dict() <--- Makes the document scriptable.
```
2023-02-16 18:15:40 +05:30
Suraj Shetty
044eec35a6 fix: Do not filter columns like "_assign" & "_user_tags" 2023-02-14 14:00:42 +05:30
Ankush Menat
163b9290e3
Merge pull request #19916 from gavindsouza/distinct-get_count
fix(db_query): apply_fieldlevel_read_permissions
2023-02-14 11:56:22 +05:30
Gavin D'souza
ebc32a34f6 fix(trim-tables): Exclude virtual doctypes from query 2023-02-09 15:29:06 +05:30
Gavin D'souza
db209cbdf7 fix: Permit no fields if dt is table and no parenttype is specified 2023-02-06 13:33:49 +05:30
Gavin D'souza
5829dabf74 fix: Add DefaultValue to core_doctypes_list 2023-02-06 12:45:02 +05:30
Gavin D'souza
18395b66f0 fix(get_permitted_fieldnames): Return all fields if permissions not defined 2023-02-06 12:42:06 +05:30
Gavin D'souza
4648c287f9 fix(meta): get_permitted_fields
Don't return any fields if user doesn't have permission for at least one
field
2023-02-04 11:55:02 +05:30
Gavin D'souza
f9eff18fd0 fix(meta): Remove faulty permitted fields cache
The Meta property didn't respect user parameter passed
2023-02-03 22:12:26 +05:30
Gavin D'souza
da3b98c91a Merge branch 'develop' into distinct-get_count 2023-02-03 20:26:21 +05:30
Ritwik Puri
d118cfb94a fix: Pass parent_doctype to fetch permitted fields in child tables 2023-02-03 20:20:00 +05:30
Gavin D'souza
0c17d400c0 fix(db_query): Handle distinct in fn calls 2023-02-03 20:12:55 +05:30
Ankush Menat
ccaf4c1e7e
Merge pull request #19854 from gavindsouza/get_all-virtual-dts
fix: Interface DatabaseQuery to virtual doctypes' get_list
2023-02-03 17:30:57 +05:30
Ankush Menat
95ad5c7696 fix: Dont use meta for get_controller 2023-02-03 16:14:12 +05:30
Ankush Menat
90c4543065 fix: Dont use cached controllers during migration 2023-02-03 13:28:59 +05:30
Ankush Menat
5348dd1f29 fix: Migration fails while inserting docfield
When migrating base doctypes we need to insert docfield which triggers
 document naming rule code and document naming rule doesn't yet exists
 cause that's what we are trying to migrate.

Fix: skip naming rule on bootstrapped doctypes.
2023-02-03 13:28:59 +05:30
Ankush Menat
07529ff1c3
fix: Consider parenttype when renaming (#19901) 2023-02-02 17:05:44 +05:30