Dhia' Alhaq Shalabi
efff6ebba7
fix: doctype name localization ( #21197 )
...
[skip ci]
2023-06-01 12:09:25 +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
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
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
Shariq Ansari
0f6f599c55
Merge pull request #19871 from developsessions/fix_possible_none_value
2023-02-01 16:40:10 +05:30
developsessions
bcbcc87f4b
fix: possible none value evaluation in get_formatted function
2023-02-01 09:24:42 +01:00
Gavin D'souza
7ce0c4c8b3
Merge branch 'develop' into permlevel-apis
2023-01-31 17:47:59 +05:30
barredterra
4bcb12617c
fix: assertAlmostEqual with precision
2023-01-26 11:39:41 +01:00
Gavin D'souza
6b0e4695a8
Merge branch 'develop' into permlevel-apis
2023-01-25 12:08:47 +05:30
Gavin D'souza
4c1b2ae67c
refactor: get_valid_dict
...
* Util get_permitted_fields checks for valid columns instead of planned logic
* Remove virtual field from dict if not in permitted fields
* Remove reliance on sentinel object _DOC_DELETED_ATTR
2023-01-25 12:04:34 +05:30
Gavin D'souza
550261b3dc
fix(db_query): Set & use existing constants
2023-01-24 13:01:05 +05:30
Sagar Vora
71420eb4e6
refactor: simplified get_controller ( #19684 )
...
* refactor: simplified `get_controller`
* chore: more refactor, better error if not subclass
* chore: more correct condition
* refactor: `class_` > `_class`
* chore: use `Meta` instead of DB calls
* chore: `_get_controller` => `import_controller`
* style: remove else block
2023-01-24 01:27:26 +05:30
gavin
d1b7a69141
Merge branch 'develop' into permlevel-apis
2023-01-16 14:54:36 +05:30
Ankush Menat
327300b6c9
fix(UX): Better message for update after submit. ( #19558 )
...
[skip ci]
2023-01-10 19:35:45 +05:30
Gavin D'souza
ae81cd2dd3
fix(doc): Maintain virtual df data in as_valid_dict
2023-01-09 18:44:42 +05:30
Gavin D'souza
c28e4590e8
fix(rest): Delete doc attr if insufficient field permissions
2023-01-09 15:47:21 +05:30
Ankush Menat
a1132075a0
Merge pull request #19326 from resilient-tech/get-latest-fix
...
perf: reuse `_doc_before_save` in `doc.get_latest`
2022-12-19 12:30:30 +05:30
Sagar Vora
2fd2d426cc
fix: better check of whether doctype is child table ( #19329 )
...
* fix: better check of whether doctype is child table
* perf: init `_table_fields` earlier
2022-12-19 11:50:16 +05:30
Sagar Vora
c453ad2d97
perf: reuse _doc_before_save in doc.get_latest
2022-12-17 07:56:54 +00:00
Hussain Nagaria
da7fd35e49
fix: handle HTML code field's has_content
2022-12-14 19:36:07 +05:30
Raffael Meyer
bb5b0e5e64
refactor!: remove compare util from frappe package ( #19234 )
...
Use `from frappe.utils import compare` instead of `frappe.compare`.
2022-12-11 23:20:21 +05:30
Sagar Vora
7f3ea7a520
chore(BaseDocument): simplify _table_fieldnames property init
2022-11-12 00:36:15 +05:30
Ankush Menat
bd21398252
fix: ignore perm level validation if row deleted ( #18290 )
2022-10-05 11:16:28 +05:30
Ankush Menat
b8ed8d624c
fix: ignore child tables when init-ing parent doc
2022-10-04 14:27:25 +05:30
Ankush Menat
0e0e7f276c
fix: dont assume issingle exists ( #18236 )
2022-09-29 10:45:37 +05:30
Faris Ansari
d11692c52f
fix: has_content check for fieldtype TextEditor
...
When a TextEditor field contains only an image, while checking for
content, HTML tags are stripped off including the only image.
This change adds a loose but explicit check for img tag.
2022-08-17 14:40:40 +05:30
Sagar Sharma
d88d9f5186
fix: max_positive_value for Integer types ( #17712 )
...
* fix: max_positive_value for Integer types
* style: formatting
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2022-08-02 15:48:54 +05:30
Ankush Menat
e652811d55
fix: ignore virtual fields when doing db_update
2022-07-11 18:33:50 +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
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
Sagar Vora
c6d8f3bc7f
fix: dont clear _meta when caching doc ( #17115 )
...
fix: dont clear meta when caching doc
2022-06-22 12:13:35 +05:30
Gavin D'souza
5ec2690160
Merge branch 'develop' into refactor-file
2022-06-01 15:47:55 +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
ccc82e2c4c
Merge pull request #15538 from noahjacob/phone_field_control
...
feat: Phone Control Type
2022-04-28 10:27:52 +05:30
Sagar Vora
224dd319e8
perf(BaseDocument): remove duplicate code ( #16733 )
2022-04-26 15:52:03 +05:30
Ankush Menat
fb0cd4c3a9
Merge pull request #16649 from ankush/testing_overhaul
...
test: better test utils
2022-04-26 12:02:06 +05:30
Sagar Vora
fa7ea4bce8
perf(BaseDocument): ~50% faster as_dict ( #16549 )
...
Co-authored-by: Pruthvi Patel <pruthvipatel145@gmail.com>
2022-04-23 09:01:20 +05:30
Ankush Menat
f748ae85fc
fix: set docstatus to 0 if None present
2022-04-22 19:47:54 +05:30
Gavin D'souza
c691537e61
chore: Add typing for ease of development
2022-04-21 13:32:13 +05:30
Suraj Shetty
8f94cb655f
Merge branch 'develop' into phone_field_control
2022-04-19 16:28:18 +05:30
Gavin D'souza
4b51b72119
Merge branch 'develop' of github.com:frappe/frappe into refactor-file
2022-04-18 17:28:56 +05:30
Ankush Menat
b409a7eeba
fix: extend autoname validation to child items
2022-04-14 15:16:59 +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
Suraj Shetty
48cd1c2ad4
refactor: Fix naming and simpify code
...
- Ability to clear code, by hiting backspace
2022-04-14 14:14:00 +05:30
Shridhar Patil
39f8267a15
feat: added support for data type json ( #16187 )
...
> Please provide enough information so that others can review your pull request:
Added json support for postgres and mariadb
> Explain the **details** for making this change. What existing problem does the pull request solve?
https://github.com/frappe/frappe/projects/4#card-50160428
> Screenshots/GIFs

---
**Previous attempts:**
https://github.com/frappe/frappe/pull/8128
https://github.com/frappe/frappe/pull/7096
Docs: https://frappeframework.com/docs/v13/user/en/basics/doctypes/fieldtypes#json
2022-04-14 04:21:41 +00:00
Gavin D'souza
97e911e069
Merge branch 'develop' of github.com:frappe/frappe into refactor-file
2022-04-13 10:49:26 +05:30
Noah Jacob
c2f2fc10e7
Merge branch develop into phone_field_control
2022-04-12 20:40:29 +05:30
Nabin Hait
b4476e0257
feat: Ignore permlevel for specific fields
2022-04-12 12:24:23 +05:30