Commit graph

59 commits

Author SHA1 Message Date
Ankush Menat
5e2ace4c08
perf: Use set for tracking whitelisted methods (#23905)
List look ups are O(N). This is still a microoptimization at best
considering other overhead.
2023-12-21 23:19:06 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Sagar Vora
d74e5d2e8a chore: fix typo in comment 2023-12-07 09:31:53 +05:30
Deepesh Garg
20a7521c92 chore: Provision to ignore child mapping using get mapped doc 2023-11-26 14:33:42 +05:30
Smit Vora
bf50952662 fix: after_mapping hook to run custom mapping functions 2023-11-24 17:45:38 +05:30
David Arnold
14cc0ac29b
feat(model): implement into-child table mapper 2023-09-29 18:32:50 +02:00
Ankush Menat
cc292d6789 fix!: Last overriden method should be considered
Following same principle of last writer wins everywhere
2023-09-25 16:35:12 +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
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
Ankush Menat
d35d7ffbe2 fix: remove bare exception catching
A bare except catches lots of things (like generator iteration end) and should never be used.
2022-06-28 18:05:00 +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
phot0n
266e1f95ed chore: adding back idx column
This is needed for ordering in display of links as it keeps
track of the clicks on a particular link item
2022-02-07 16:40:01 +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
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
6fb14120d9 fix: Remove trailing whitespace in translatable str
Simplify conditional block and str appending
2021-05-27 13:47:55 +05:30
Gavin D'souza
e2ee75e3cb fix: Translate strings passed in frappe.throw
* Remove trailing whitespaces in translatable strings
* Sort imports appropriately
2021-05-27 13:47:21 +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
Rohan Bansal
77062721ed feat: allow mapper functions to be overriden 2020-05-30 19:15:04 +05:30
marination
e65486f0c7 fix: Removed annotations due to py>=3.7 compatibility. 2020-01-27 11:59:40 +05:30
marination
f61ae3fd1a fix: Comment to docstring and minor changes
- added description for args with example
- 'yield' might not be the best idea, barely any improvement, so changed back to 'return'
2020-01-24 12:02:46 +05:30
marination
d110b744d9 fix: Modified map_docs to accomodate 'args' sent from client call 2020-01-21 15:13:30 +05:30
marination
56bdbaadc6 fix: (User Permissions) Allow user to fetch details into mapped doc
Check if apply strict user permissions is enabled
Accordingly restrict user permission
2019-09-27 15:57:08 +05:30
Suraj Shetty
757953851b fix: Move permission check code in get_mapped_doc method
- Check target_doc creation permission only after
completely mapping target doc with source_doc
2019-09-17 15:47:49 +05:30
Faris Ansari
3b86f16b73 New Control: Table MultiSelect (#6675)
* feat(control): Add Table MultiSelect control

* fix: Use btn-group instead of span

* fix: Remove functionality

* fix: Add 'Table MultiSelect' to Field doctypes

* fix: Replace usage of string 'Table' with array `table_fields`

* fix: Use internal array to store values instead of building from HTML elements

* fix(style): Add semicolon

* fix: Read only mode and click to navigate to form

* style: indent

* fix: fallback to empty array

* fix: Add formatters in js and py

* style: missing semicolon

* fix: Add docfield validation
2018-12-28 15:36:59 +05:30
Rushabh Mehta
624703d1b9 minor: mapping now takes optional args 2018-08-30 18:23:06 +05:30
Nabin Hait
8d8c49f43b fetch_from fixes in mapper 2018-05-25 09:55:58 +05:30
Zarrar
e76b3eef4e [Enhance] New DocField - 'Fetch From' (#5563)
* add new docfield fetch_from - serves as add_fetch

* replace options.split with fetch_from.split

* copied data from options to fetch_from

* patch to update fetch_from for docfield, custom_field and property_setter

* update tests according to fetch_from change
2018-05-23 11:07:57 +05:30
rohitwaghchaure
553702d671 Read only fields not update if the field has already value (#5126) 2018-03-08 12:02:17 +05:30
Aditya Hase
769338f136 Replaced all instances of basestring with six.string_types 2017-08-11 00:10:11 +05:30
Prateeksha Singh
b23aa1446b Multiselect dialog for getting items (#3255)
* First approach by making a control

* Implement multi select for child tables

* Basic UI and items fetch in place

* Multiselect with checkboxes

* Functional modal with filters and new_doc

* Map filter fields to target_doc

* pass json arrays instead of strings

* Get items from quotation (in SO) working

* [minor] fix link route in list

* [minor] cleanup

* Add date, select first by default

* map_docs test, default date field

* [minor][fix] make new button bug

* [minor] move map_docs to erpnext

* [minor] format dates
2017-05-15 11:29:41 +05:30
Rushabh Mehta
9ba8a4a23a [fix] mapper.py 2016-12-15 15:41:52 +05:30
Rushabh Mehta
ac69247325 [feature] checkboxes in grid #2451 2016-12-15 14:48:43 +05:30
Kanchan Chauhan
e590e37f3d ignore child table parameter added to mapper.py 2016-07-02 18:43:21 +05:30
Anand Doshi
1ff7dff91b [fix] get linked doc only if add fetch option is found 2015-09-07 19:58:58 +05:30
Rushabh Mehta
dc7b13ceef [hot] [fix] target doctype 2015-07-06 16:59:38 +05:30
James T. Nixon III
f46092198f Map child table if not mentioned in table_map but have the same fieldname and same table and both hhave no_copy unchecked 2015-07-02 12:53:38 -07:00
Nabin Hait
589c402941 set onload properties 2015-05-13 11:16:04 +05:30
Rushabh Mehta
3be7d4b2c0 [fix] mapper 2015-03-27 10:58:53 +05:30
Anand Doshi
2995f02f3b Web Notes to Frappe, better alerts, css fixes, fixed splash 2015-03-03 15:09:34 +05:30
Nabin Hait
84c2a3abc3 Minor fix in mapper 2014-08-21 17:33:02 +05:30
Nabin Hait
e7b3c2fa4a Fixes for mapping fetch fields 2014-08-21 12:20:51 +05:30
Anand Doshi
d109389a51 [mapper] Apply add fetch 2014-08-18 14:50:13 +05:30
Anand Doshi
36a9a4f3ce [mapper] Auto-map Link fields in target doc, having options as source doctype or source parent's doctype 2014-08-18 13:21:36 +05:30
Anand Doshi
87459483e6 Mapper Function: map_child_doc 2014-07-07 12:25:20 +05:30
Anand Doshi
2ead90fc6e Misc fixes 2014-06-27 20:59:00 +05:30
Rushabh Mehta
4facc14ef7 bugfix for add_if_empty in mapper.py fixes frappe/erpnext#1683 2014-05-26 16:11:26 +05:30
Anand Doshi
f1ff388563 Fix in open mapped doc. Fixes frappe/erpnext#1575 2014-05-04 18:36:10 +05:30
Anand Doshi
e16c8235d9 Fixed No permissiont to, Linked with doctype loading 2014-04-30 18:53:06 +05:30
Anand Doshi
1b0c74a93c Do not map table fields in mapper 2014-04-28 16:04:59 +05:30