* fix: call `frappe.db.exists` only if `options` are set and value is truthy
* fix: sider issue
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* fix: use `get_value` instead of `exists`
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* test: ensure currency formatting works without currency set in df options or param
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* feat: utility methods for docstatus
* refactor: use utility method for doctsatus
* refactor: enum for docstatus
* refactor: docstatus as property
* fix: set docstatus
* feat: docstatus extends int class
* test: docstatus of BaseDocument
* refactor: occurrences of docstatus
* fix: typo
* refactor: move docstatus to a separate file
* test: docstatus
* fix: sider
This means you don't have to write a custom controller or change backend
code to use Virtual DocFields! Write it in the options column for the
virtual field in Customize Form
Added doc and safe globals (from safe_exec) into the evaluation
namespace
If you have a @property in the controller class, this data used to not
be accessible anywhere other than directly through the object via
`frappe.get_doc`. This fix changes that.
* Handle inconsistencies in type handling in DatabaseQuery & Database
APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests
fix: db independent syntax for user_type
fix: handle postgres datetime values
feat: add ability to auto commit on db inserts
feat: add ability to escape underscore in postgres
fix: handle missing data in test runner bootstrapping
fix: db independent syntax for queries
fix: refactor to use qb
fix: update cache for language
fix: use pluck in email_queue
Co-authored-by: gavin <gavin18d@gmail.com>
fix: don't auto insert on tests for make_property_setter
fix: remove auto_commit in custom_field insertion
fix: remove auto_commit functionality
fix: review comments
fix: revert link validation
fix: style suggestion for readability
Co-authored-by: gavin <gavin18d@gmail.com>
fix: revert .lower() in link validation
fix: add rollback for setup_wizard
Revert "fix: add rollback for setup_wizard"
This reverts commit 83b3b0913d.
Revert "feat: add ability to escape underscore in postgres"
This reverts commit 8ed9c2aa33.
fix: more concise representation of order fields
Co-authored-by: gavin <gavin18d@gmail.com>
* Revert "feat(minor): Implement __getitem__ in Base Document (#14855)"
This reverts commit 583a7ef239.
(cherry picked from commit d165fb3d47)
* fix: keyerror in auto email report
(cherry picked from commit aac20f5d15)
Co-authored-by: Ankush Menat <ankush@frappe.io>
* feat(minor): Implement __getitem__ in Base Document
This addition allows for syntactic sugars like writing doc["name"] to
access document name. This addition is solely for the sake of code
simplicity. Since dictionaries in Python follow this standard, we can
write code that works for both Vanilla Dicts, Frappe Dicts & all
Document objects
* fix: Use getattr over get in getitem
For the sake of consistency and some level of sanity in the universe.
Co-authored-by: Ankush Menat <ankush@frappe.io>
* fix: Raise KeyError instead of AttributeError
why: shit breaks down. Specifically stuff in Jinja templates, attributes
that are conditional. Either this is acceptable or subscripting objects
cannot and probably should not be possible along with our pre-condiitons
* chore: Use hasattr instead of get default
Couldn't decide between a style commit or a chore
Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 583a7ef239)
Co-authored-by: gavin <gavin18d@gmail.com>
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.
* 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
- 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.
in get_controller, if cached value doesn't exist for a DocType in the
frappe.db.value_cache, then query the db as fallback before the final
fallback of assuming module as Core and non custom
(cherry picked from commit 05712abc60)
in get_controller, if cached value doesn't exist for a DocType in the
frappe.db.value_cache, then query the db as fallback before the final
fallback of assuming module as Core and non custom