Commit graph

210 commits

Author SHA1 Message Date
Raffael Meyer
04d1292cf1
fix: consistent translation in meta.get_label (#19080) 2022-12-02 23:38:15 +05:30
Ankush Menat
a6af1ed542 feat: bulk insert simple Document objects 2022-11-28 15:32:20 +05:30
Sagar Vora
cb7d25a293
fix(meta): ensure that insert_after is always considered when sorting fields (#18682)
* fix(meta): ensure that `insert_after` is always considered when sorting fields

* test: add nosemgrep to comment

Co-authored-by: Dany Roberts <danyrt@wahni.com>
2022-10-31 15:37:55 +05:30
Ankush Menat
2b6fc68088
Revert "fix: drop Meta cache during update" (#18186)
* Revert "fix: drop Meta cache during update (#18182)"

This reverts commit 656f6df257.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.
2022-09-19 21:28:45 +05:30
Ankush Menat
656f6df257
fix: drop Meta cache during update (#18182) 2022-09-19 19:24:17 +05:30
Sagar Vora
b529c27cb5 fix: ensure error is thrown 2022-09-19 16:21:11 +05:30
Sagar Vora
6c6a969d3a perf: simpler, faster meta cache 2022-09-19 16:21:11 +05:30
Sagar Vora
df8399f5d3 perf: initialise field map when initialising meta 2022-09-19 16:21:11 +05:30
Sagar Vora
fc3ee12baf
perf: cache FormMeta directly (#18165)
* perf: cache `FormMeta` directly

* perf: check if `dt` is table, use `db.get_value` instead of `get_all`
2022-09-19 16:10:32 +05:30
Ankush Menat
2eec621e95 chore: db.get_all -> get_all
Reduces 1 pointless function call.
Function calls are also not "super cheap" in python.
2022-08-22 11:35:14 +05:30
Sagar Vora
2b873b34dd refactor: remove verbose parameter; add user parameter to Meta.get_permlevel_access 2022-07-30 23:52:20 +05:30
Ankush Menat
261fbfcd11
Revert "fix(doc)!: Always cast datetime, date and time fields"
Revert "fix(doc)!: Always cast datetime, date and time fields (#15891)"

This reverts commit d7789ab6ff.
2022-07-05 13:43:32 +05:30
Himanshu
d7789ab6ff
fix(doc)!: Always cast datetime, date and time fields (#15891)
### BREAKING CHANGE
#### Datetime, Date and Time fields will always be cast to respective objects in `setattr`, this will ensure uniformity while accessing the values, no more `getdate`, `get_datetime`, `to_timedelta` wrapper.
- While importing data, the framework does check for `set_only_once`.
- In normal case scenarios, this will work flawlessly since most date fields might not be set_only_once.
- But in Subscription, the date field is set to `set_only_once` and in `after_insert`, `document.save` is called, and while doing so, `set_only_once` is checked [here](1944a547f9/frappe/model/document.py (L566)).
-This works fine if the data imported is in the correct format.
- If the date's data is not in the correct format, the framework throws an error.
- for eg `06-02-2022 00:00:00 != 06-02-2022`
- fixes [Issue/#15370](https://github.com/frappe/frappe/issues/15370)

> no-docs
2022-07-05 07:07:16 +00:00
Ankush Menat
9a5d11234c
fix: validate scheduler, hook method names (#17400)
* chore: warn about missing scheduler / doc events

* fix: pass list instead of filter

filter can only be iterated upon once

* refactor: many typehints in __init__.py
2022-07-04 19:29:16 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
gavin
fc9308f8ba
fix: Use same labels for standard fields throughout interfaces (#17031)
* fix(model)!: Match labels in meta & model

Labels for fields have been inconsistent. In standard filters, doc.name
would be labelled as "Name" while it's "ID" in the edit filters option.
Similarly for other fields, the same view will address the same fields
differently. This PR aims to get rid of such inconsistencies.

Changes:

* [model] Change label ID for name to 'Name'
* [meta] Match labels of owner, modified, modified_by
* [meta] Add labels for more fields - from model.js

* fix!: get_label to fetch labels as Desk does

* fix!(label): Refer to name field as 'ID' over 'Name'

* test: Use 'ID' label instead of 'Name'
2022-06-09 15:34:57 +05:30
Ankush Menat
15dbcacd56 refactor: split transaction and prefix functions
refactor: fetching transaction list

refactor: get default naming series

refactor: simplify naming series option scrubbing

fix: remove dead code related to insert series

This code is dead in many ways
- Creates map but it's never evaluated, so it doesn't actually run :D
- Just randomly splits naming series parts to create prefix... makes no
  sense.

fix: deduplicate prefix list
2022-05-31 11:53:40 +05:30
chillaranand
1d763a6659 refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
Sagar Vora
a33c2e2abe
refactor(BaseDocument)!: improved get, set and extend methods (#16540)
* perf!: 80% faster doc.get for fields with `None` as value

* perf: quicker init child (#3)

* refactor: avoid repitition and improve error message

* test: `doc.extend`

* fix: improve constant naming

* fix: minor improvements and tests

* refactor: improve naming
2022-05-04 18:37:06 +05:30
Suraj Shetty
6b7fda495b Merge branch 'develop' of https://github.com/frappe/frappe into phone_field_control 2022-04-14 14:19:35 +05:30
Sagar Vora
77879933ce style: make changes as per linter 2022-04-13 13:21:01 +05:30
Sagar Vora
38959637e7
perf: move less expensive condition first
Co-authored-by: gavin <gavin18d@gmail.com>
2022-04-13 11:40:35 +05:30
Sagar Vora
93051389b1 fix: use isinstance instead of looping over __dict__ 2022-04-13 11:20:01 +05:30
Noah Jacob
c2f2fc10e7 Merge branch develop into phone_field_control 2022-04-12 20:40:29 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Sagar Vora
aedd2fb2b6
Revert "perf: 80% faster doc.get for fields with None as value" (#16490) 2022-04-01 20:39:27 +05:30
Sagar Vora
811c213082 perf: 80% faster doc.get for fields with None as value 2022-04-01 04:35:19 +05:30
Noah Jacob
579d0643c4 Merge branch 'develop' into phone_field_control 2022-03-22 15:05:45 +05:30
mergify[bot]
32024b4440
Merge pull request #15990 from hrwX/translated_doctype_links
fix: Merge groups for doctype links
2022-02-16 05:24:56 +00:00
hrwx
1a912aa787 fix: merge groups for doctype links 2022-02-15 15:14:22 +00:00
Gavin D'souza
0482f1362a Merge branch 'develop' of github.com:frappe/frappe into dynamic-docfields 2022-02-08 16:50:58 +05:30
phot0n
7bd84496c1 fix: use int for docstatus in get_default_df 2022-02-07 16:43:16 +05:30
phot0n
b31f3c24f6 refactor: remove parent, parenttype, parentfield, idx columns from non-child table doctypes
* feat: add parent, parenttype, idx, parentfield columns to doctypes when transitioning from normal -> child table

* fix: remove parent, parenttype, parentfield, idx from DocType DocType
2022-02-07 15:12:37 +05:30
Gavin D'souza
4d00579667 fix: Skip data field validations for virtual field 2022-02-01 18:38:31 +05:30
Gavin D'souza
66b09afda6 fix: Don't create DB column for Virtual DocFields 2022-02-01 17:48:02 +05:30
Noah Jacob
e86378f26f
Merge branch 'develop' into phone_field_control 2022-01-07 13:12:33 +05:30
Noah Jacob
d08a332a85 feat: Phone Field Control Type 2022-01-04 12:58:36 +05:30
Gavin D'souza
24830298b0 fix: Make owner, creation fields constant for docs 2021-12-30 10:32:22 +05:30
Faris Ansari
2cfebf2a96 fix: set empty lists for unset meta table fields 2021-12-16 20:20:19 +05:30
Faris Ansari
2635da19f4 fix: Add Document States in customize form 2021-12-14 14:20:46 +05:30
Faris Ansari
4db2c1aaa3 feat: Document States
Customize the color of document states. Works with Status field.
2021-12-09 18:30:59 +05:30
Gavin D'souza
0413349cc8 fix: Table view for bench trim-tables 2021-09-14 21:53:02 +05:30
Gavin D'souza
43459749e2 Merge branch 'develop' into trim-db 2021-09-06 11:35:59 +05:30
Gavin D'souza
4127f0f135 fix: Clear table columns cache to fetch accurate results 2021-09-03 18:59:56 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
ed6533f737 fix: Use cast in favour of cast_fieldtype
Use newly introduced casting util for Python-Frappe types mapping
2021-08-20 12:37:15 +05:30
Gavin D'souza
7f338edca1 feat: Command to trim tables
Maintenance command to get rid of extra columns in your DocType tables.
These columns are remnants of "deleted" fields through customizations or
upgrades
2021-08-17 12:50:11 +05:30
Ankush
257723cb0a
feat: PythonExpression and Python option with syntax validation for Code field types (#13707)
* feat: `PythonExpression` and `Python` options for `Code` fields

* fix: check python expressions in assignment rule

* fix: replace server script syntax validation

* fix: validate condition in workflow transition

Add PythonExpression in Options.
2021-08-06 04:10:09 +00:00
Deepesh Garg
4c400bd6c9 test: Custom internal links addition 2021-08-04 17:10:33 +05:30
Deepesh Garg
252850be98 fix: Internal link support for custom document links 2021-07-31 15:46:54 +05:30