Commit graph

2276 commits

Author SHA1 Message Date
Ankush Menat
f6326b6145
fix: check before deleting prepared report (#21950) 2023-08-07 14:00:34 +05:30
Raffael Meyer
5fce1a57c0
fix: validate fieldname in get_group_by_count (#21932)
* fix: validate fieldname in get_group_by_count

* test: call get_group_by_count with invalid field

* test: is_default_field
2023-08-06 17:33:34 +05:30
Ankush Menat
8817c228a2 fix: filter schema name on mariadb 2023-08-04 14:33:17 +05:30
Ankush Menat
fd15ab5329 fix: revert pg incompatible change 2023-08-04 14:13:36 +05:30
Ankush Menat
c4230f8760
fix: autoincr status per doctype (#21918)
* fix: autoincr status per doctype

closes https://github.com/frappe/frappe/issues/21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
2023-08-04 13:59:39 +05:30
Raffael Meyer
dc0a8c5ccb
fix: keep privacy setting of attachments on amend (#21911) 2023-08-03 15:33:39 +05:30
Shariq Ansari
e1c1e256ef
Merge pull request #21798 from pps190/frappe/fix/ambigus-table-join 2023-07-28 12:28:04 +05:30
Ankush Menat
c40faddac7
perf: skip reset_seen for new doc (#21832)
The query is fired but document doesn't exist yet, so it does nothing really.

[skip ci]
2023-07-27 16:07:22 +05:30
Ankush Menat
8930d4b5e1
perf: drop ifnull from IS SET filter (#21822)
- Kinda confuses query planner (idk why it's not smart enough to
  understand but there are probably edge cases where it can't be done)
- `null != null` and `'' != null` both yield `null` which is falsy and
  won't be shown in results.

Alternate fix to https://github.com/frappe/frappe/pull/21817
2023-07-27 10:58:20 +05:30
Devin Slauenwhite
7a3e7b7eb2 Merge remote-tracking branch 'frappe/develop' into frappe/fix/ambigus-table-join 2023-07-24 14:23:28 -04:00
Ankush Menat
0bc5d1dc3b feat(DX): type annotated python controllers 2023-07-24 15:32:46 +05:30
Ankush Menat
1bfe585b71
fix!: Drop unused link_doctype, link_name (#21788) 2023-07-24 14:22:07 +05:30
Ankush Menat
2c99583247 perf: Lazily fetch shared documents
We eagerly fetch shared documents for ANY `get_list` query, even when
user has full read acess doctype, where it's moot to consider adding
shared document as separately.

This eliminates one entire db call from get_list and in most cases
get_list will translate to single DB call, hence probably worth the
additional complexity.
2023-07-22 18:04:35 +05:30
Ankush Menat
892c5e30a2 refactor: Simpler workflow caching
Entire document is cached, so no need to create another layer of cache.
2023-07-19 16:45:44 +05:30
Sagar Vora
7d7c440a1b fix: compare with doc.amended_from while saving version for newly amended doc 2023-07-17 16:04:28 +05:30
Deepesh Garg
e32e74f2f1
feat: Custom naming series parser via hooks (#21690)
* feat: Custom naming series parser via hooks

* chore: use assignment operatot

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

* test: Unit test for custom parser

* test: Unit test for custom parser

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-07-16 12:57:40 +05:30
Ankush Menat
adf30693a9 ci: update pyupgrade 2023-07-14 14:24:08 +05:30
Sagar Vora
b4f1a2328b
fix: ignore naming series validation when generating repeated address name (#21568) 2023-07-10 10:51:55 +05:30
gavin
05893bef42
fix: Rename document/update title via toolbar (update_document_title API) (#21404)
* fix: update_document_title

* Fix broken socket event
* Fix broken title + name doc update

* fix: if only title updated then dont enqueue

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-06-21 15:46:09 +05:30
Dany Robert
4f3c0f6e99
feat: configurable amended document naming (#21414)
* feat: configurable amendment naming

* patch: set default amend naming

* chore: linters and document filter

* test: amended document naming

* refactor: use set_single_value

* chore: typo, fix copy

* fix(UX): move action button below table

* refactor: Series Counter -> Default Naming

The behaviour in this PR doesn't necessarily mean to apply naming series
it can be:
- Naming Series
- hash
- Naming Rule
- Some code

So the name was misleading.

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-06-20 21:37:08 +05:30
Ankush Menat
8155371162
fix: ignore DOCTYPES_FOR_DOCTYPE in issingle check (#21375) 2023-06-14 18:21:55 +05:30
Ankush Menat
3f3ee12338 Revert: keep supporting set_value for singles
w/ explicit check for singles

This shouldn't have any performance impact as last function call only
happens if we THINK it's single doctype. use set_single_value to avoid
that extra function call.
2023-06-14 17:30:32 +05:30
Ankush Menat
039be73af4
refactor: Consider singles for dynamic set_value usage (#21367)
Found all usage using this semgrep rule:

```yaml
    - pattern: frappe.db.set_value($DOCTYPE, ...)
    - pattern-not: frappe.db.set_value("$STR", ...)
```
2023-06-14 10:46:25 +05:30
Ankush Menat
3005e66e45 refactor!: Drop previously deprecated code 2023-06-13 16:00:43 +05:30
Ankush Menat
8a30667a97
fix: Fetch non-cached version of Meta on Customize Form. (#21269)
* fix: Replace meta cache when uncached meta is requested

* fix: use meta from DB on customize form

* refactor: make cached kw only, use _dev_server
2023-06-12 14:59:42 +05:30
Ankush Menat
774a75dbde
perf: use cached workflow doc for transitions (#21300)
* fix: expire `RECORDER_INTERCEPT_FLAG` in one hour

Leaving this running in prod can be dangerous.

* perf: Use cached doc in workflows
2023-06-09 12:43:40 +05:30
Devin Slauenwhite
19d211f1d2
feat: rearranging standard fields in customize form (#19822)
* feat: rearranging standing fields

* fix: fixed creation of property setter

* refactor: renamed setup_sortable

* fix: loading field_order property

* refactor: removed redundant db call

* fix: field_order not found

* test: Added tests for field order in customize form

* refactor: better naming

* refactor: simplified logic

* feat: Updating field order on custom field creation

* feat: Added support for custom fiels

* refactor: moving to meta

* refactor: changed property type to json

* fix: new standard field insert order.

* fix: don't modify insert_after of system generated custom fields.

# This is because system generated fields are to be treated as standard fields. If the user restores the form to default, this value will be used to reset the original position.

# The new position of form fields are stored in the field_order Property Setter.

* fix: treat system generated fields as standard fields when sorting.

* revert: check for is_system_generated

* Revert "fix: new standard field insert order."

This reverts commit 6cdbe42f28d5944165dd100a9bb9172463951fda.

* fix: prioritize field_order over insert_after.

# Use insert_after as fallback in event the field doesn't exist in field_order

* fix(test): delete existing custom field

* fix: order of standard fields without field_order property.

* Revert "Revert "fix: new standard field insert order.""

This reverts commit c830f1ba2fe1e602b09c11a897869d9992097c1e.

* test: field order of newly migrated standard fields.

* fix(test): clear test_standard_field from previous test run.

* fix: sort with insert_after for system generated fields.

* fix(test): reset standard field creation before re-run and after successful test.

* fix: insert_after position should be + 1

* chore: remove debug statement

* test: system generated customized fields

* chore: remove print

* chore: lint all

* fix: show quick link to Table MultiSelect DocTypes

* refactor: change backend implementation of `CustomizeForm` and `Meta`

* test: simplify tests

* fix: rename `idx` to `index` for clarity

* perf: define `existing_fields` conditionally

---------

Co-authored-by: Aradhya <aradhyatripathi51@gmail.com>
Co-authored-by: Aradhya Tripathi <67282231+Aradhya-Tripathi@users.noreply.github.com>
Co-authored-by: Sagar Vora <sagar@resilient.tech>
2023-06-08 17:14:44 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Devin Slauenwhite
b9b3a250f8
Merge branch 'develop' into fix-ambigus-table-join 2023-06-06 10:29:59 -04:00
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