Commit graph

200 commits

Author SHA1 Message Date
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
Gavin D'souza
c489846547 Merge branch 'develop' into unnecessary_comprehensions 2021-06-11 19:30:23 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Ankush Menat
4754ab71d1
perf(minor): remove unnecessary comprehensions
- remove several unnecessary comprehensions from functions that accept a generator.
- Using `[x for x in iter]` causes a list to be built first then passed to the outer function.
- `any` and `all` can take generator instead. This makes memory usage O(1) and actually makes these functions short-circuiting. E.g. if the first condition fails then `all` will immediately return false instead of evaluating all the entries.
- `sum`, `min`, `max` => memory usage become O(1)
- `list`, `set`, `.join()` => roughly halves memory usage, as list is not required to be built.
- lastly, it's two fewer characters to read/think about.
2021-05-12 20:38:18 +05:30
leela
72ca7e9753 refactor: remove six dependency 2021-05-07 07:42:04 +05:30
Suraj Shetty
7e5f86789c fix: Do not check permlevel > 0
- while creating has_access_to list
2021-03-23 19:53:05 +05:30
Suraj Shetty
6f774d6d0c
fix: Check for fieldlevel permission for report query (#12163)
Co-authored-by: Prssanna Desai <prssud@gmail.com>
2021-01-28 17:14:47 +05:30
Shivam Mishra
26e40a9d68
fix: data.non_standard_fieldnames is None (#12174)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-01-13 19:24:24 +05:30
Anurag Mishra
c88ef9d603 feat: removed Roles from special documents 2021-01-08 17:33:06 +05:30
prssanna
69befda08e fix: label for _assign field 2020-12-04 16:12:22 +05:30
Rushabh Mehta
742605542c fix(minor): added ignore_ddl in frappe.db.get_all to ignore missing tables, columns 2020-10-26 10:02:04 +05:30