Commit graph

985 commits

Author SHA1 Message Date
Prateeksha Singh
eb5b7a77c9 [Feature] Format Autoname (#6017)
* [Feature] Format Autoname

- Generate autoname by replacing all instances of braced params
- Independent of remaining string or separators.
- Remove autoname Concatenate option

* [autoname] add test for format autoname
2018-09-03 10:58:56 +05:30
Prateeksha Singh
eaafc4d7f5 [child-records] set name in new child records before setting password (#6048) 2018-09-03 10:56:41 +05:30
Rushabh Mehta
624703d1b9 minor: mapping now takes optional args 2018-08-30 18:23:06 +05:30
Rushabh Mehta
00fc9c9b1c fix(fetch): fetch_from will always update after save 2018-08-30 12:16:10 +05:30
Himanshu Mishra
10361383c1 [fix]: use is_async in background jobs instead of async (#5986) 2018-08-20 10:36:26 +05:30
sivankar
a48b76b940 refactored code to add support in filters to get descendant or ancest… (#5847)
* refactored code to add support in filters to get descendant or ancestor for tree type documents

* added semicolon and comments to imporve code quality

* refactored code to add not ancestor and not descendants of filters

* added test cases for ancestors of and descendants of

* Translate labels
2018-08-14 12:19:18 +05:30
Nabin Hait
39e9e306f2 Cached some queries (#5951) 2018-08-09 11:25:07 +05:30
Rushabh Mehta
b1857a5132
optimize(meta): meta is now cached in redis (#5948)
* optimize(meta): meta is now cached in redis

* fix(meta): test fixes

* fix(meta): codacy

* fix(meta): allow nulls to be serialized

* fix(form_meta): fix form meta caches

* fix(form_meta): fix form meta caches

* fix(form_meta): don't cache for developer_mode'
2018-08-09 11:24:42 +05:30
Nabin Hait
7f2a14bdf1 feat(document): frappe.get_cached_doc 2018-08-08 13:04:23 +05:30
Dominik Ottenbreit
feee6cc07e Create more clear docstring for trim_tables (#5863)
* Create more clear docstring for trim_tables

Current DocString was not clear enough. I updated the description to give background information on why this function may be needed.

* Update meta.py
2018-07-24 16:30:00 +05:30
Mohamed_Alsum
803f6b0c7b allow null when time field is not required (#5832)
* allow null when time field is not required

* Update base_document.py
2018-07-23 10:36:42 +05:30
Sushant Nadkar
f8dc45c3c1 Convert doc field value to string type before using (#5795) 2018-07-11 11:11:55 +05:30
Saurabh
a135c6c431 resolved merge conflicts 2018-07-06 13:37:51 +05:30
Ameya Shenoy
5c6b02515a regex fix (#5765)
courtesy: @netchanpfaris
initally the regex used to allow only digits 0-9, not it considers the
entire number range
2018-07-03 14:55:21 +05:30
Suraj Shetty
6ff6a98f8c Return if no link fields found (#5764) 2018-07-02 21:49:07 +05:30
Shridhar Patil
6ec17cc37d ignore save password based on fieldname (#5749)
* ignore save password based on fieldname

* ignore save password if flag is True

* if ignore_password is set  then check for field
2018-06-29 15:52:29 +05:30
Saurabh
e2b1ebe84c [Security][fix] To avoid possible sql injection via filters and or_filters parameters and tighten the field level checks (#5721)
* [fix] sanitize filters and or_filters to avoid sql injection

* add test cases for filter sanitizer

* codacy fix

* added test cases to test valid scenarios
2018-06-27 09:15:42 +05:30
Suraj Shetty
8ef543fdcc Update doctype names in skip_for_doctype field on doctype rename (#5719) 2018-06-26 10:13:37 +05:30
Suraj Shetty
26c6e2928c Move allow self approval check to transisition for more control (#5691)
* Move allow self approval check to transisition for more control

* Disable email alert from workflow test

* Add allow_self_approval to each transition of test workflow

* Remove print statement

* Remove extra blank lines
2018-06-21 09:08:27 +05:30
Shreya Shah
3135f38716 Check if hasattr track_views (#5685) 2018-06-15 11:07:20 +05:30
Shridhar Patil
3f731e904a [feature] Document View logs (#5627)
* Added track view checkbox in doctype

* Add comment to communication whenever user views a document

* typo fixed

* add view log after permission check

* doctype for view logs

* client side changes

* view log doctype updated

* add to view_log whenever a user views a document

* view log changed fields to set only once

* get and retun view logs if available

* add view logs to time line

* doctype view_log: update

* removed print statement

* View log: changed column data to link

* created joint index on reference_doctype and reserence_name

* codacy issues fixed

* changed for loop to es6

* removed frappe.db.commit

check if a doctype has track_views and then get view logs

* view logs made translatable

* set commit flag to true

* Add track views for Event doctype to run test

* test for view log

* test for view log
2018-06-15 09:08:59 +05:30
Nabin Hait
003df19442 update cached link_fields as per new 2018-06-13 17:51:38 +05:30
Suraj Shetty
9e402ec3b5 Clear cache on workflow update (#5677) 2018-06-12 21:50:36 +05:30
Charles-Henri Decultot
c2b49ce572 Slack integration (#5640)
* Slack notifications

* Codacy corrections

* Slack notifications

* Codacy corrections

* Rename Email Alert to Notification

* Migration Patch

* Refactor of notification.py

* Dev cleanup

* Test correction
2018-06-11 15:11:00 +05:30
Suraj Shetty
6b77c10cc9 [Workflow] Added a check to enable/disable workflow action emails and test fix (#5668)
* Fix build and make py3 compatible

* Remove unused test since state edit check was removed

* Add toggle to enable or disable workflow action emails
2018-06-11 15:09:42 +05:30
Suraj Shetty
944626ed5e [Minor][Fix] Workflow action (#5665)
* Fix incorrect this reference

* Fix verify request for python 3

* Fix workflow validation
2018-06-08 16:33:39 +05:30
Rushabh Mehta
dd189d4c99 [fix] set default naming_series in naming.py if not set 2018-06-06 12:00:27 +05:30
Rushabh Mehta
c32bcca4e8 [fix] set default naming_series in naming.py if not set 2018-06-06 11:24:20 +05:30
Nabin Hait
786db7de12 minor fix 2018-06-04 12:26:53 +05:30
Nabin Hait
6e00608556 import sync_user_settings in rename_field 2018-06-04 12:24:58 +05:30
Manas Solanki
a91da5f706 Update user settings (#5634)
* update the user settings on the rename of any records.

* also update the renamed fields in the user settings

* fix codacy
2018-06-04 11:53:03 +05:30
Saurabh
55eaba90f5 [fix] Sanitize blacklisted functions 2018-05-30 15:25:40 +05:30
Nabin Hait
418d654331
Fixed sanitizing fields for tabDeleted Documents (#5329) 2018-05-30 15:01:12 +05:30
tundebabzy
2efcea9bbd DocType Naming With Multiple Fields (#5497)
* Update README.md

* refactor for better readability

adds ability to name by concatenating fields

add comments

PEP 8 fixes

throw error when field option autoname fails

adds concatenation option description to DocType doctype

* codacy

* remove explicit cast to `str`

* more pep8 fixes

* revert incorrect link

* code review - move internal functions to bottom of module
2018-05-30 11:37:49 +05:30
Suraj Shetty
c71c132ba2 Workflow actions (#5598)
* Init workflow actions

- WIP code
- Add hooks to create and update
workflow action on document status changes.
- Tweak listview to show host document on list view item click
- Add new doctype "Pending Workflow Action"
- Add allow_self_approval check in Workflow master

* Rename doctypes

- Rename "Workflow Action" to "Workflow Action Master"
- Rename "Pending Workflow Action" to "Workflow Action"
- Remove irrelevant files

* Clear old workflow action on docstatus change

- Add check for user permission before creating a workflow action record
- Make doctype changes to support the Workflow Action  System

* Show host document only if workflow action status is open

* Send workflow action mail notifications

* Add patch to rename `tabWorkflow Action` to `tab Workflow Master`

- Rename table to retain data in `tabWorkflow Action` as it
will be overwritten with new structure on migration

* Enqueue email

* Remove unused files

* Add hook for custom has_permission

* Optimize send_workflow_action_email method

* Add permission_query_condition hook

* Show notification based on status

* Override get_form_link in list view

* Refactor workflow action

- Add action link
- update workflow action hooks

* Avoid repeated creation of Worklow Actions

- Update hooks entry to avoid unwanted method call

* Fix error with frappe.db.count usage

* Fix ui/ux for Workflow Action

- Fix action url and improve response on action button click
- Fix workflow action template style

* Fix Codacy

* Add self approval check

* Fix codacy

* Fix test

* Fix python version confilct and a permission error

* Fix incorrect 'this' reference

* Update with requested changes

* Add next action email template option

* Fix string formatting

* Refactor workflow Action

- Make process_workflow_action smaller

* Fix bugs and errors due to refactor

* Fix workflow field caching

* Add a workflow action test

* Fix bugs with email template
2018-05-30 11:24:49 +05:30
Nabin Hait
c49193c1c1
Fetch from property is now applicable for all fieldtypes except no_value_fields (#5624)
* Reload docperm

* Reload docperm

* Fetch from property is now applicable for all fieldtypes except no_value_fields
2018-05-29 10:54:45 +05:30
Ameya Shenoy
b0c765a8d1 [fix] check if length exists (#5621) 2018-05-28 16:30:24 +05:30
Manas Solanki
5ea4fb6157
Update db_schema.py (#5622) 2018-05-28 16:02:32 +05:30
Saurabh
56bf3bf40b [fix] resolved merge conflicts 2018-05-28 11:43:38 +05:30
Manas Solanki
78c839eb5f handle Int overflow (#5607)
* handle the int overflow

 - convert the int to the bigint if the length is more than 11

* proper formatting
2018-05-25 10:47:44 +05:30
Nabin Hait
6a4a246ad7 Fetch From also applicable for Check fields (#5611) 2018-05-25 10:46:43 +05:30
Nabin Hait
8d8c49f43b fetch_from fixes in mapper 2018-05-25 09:55:58 +05:30
Zarrar
076e1d5be0 run docfield patch prior to other patches (#5594) 2018-05-23 13:16:53 +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
tarokobear
e85e52a591 Account for documents with integer names so they can be deleted. (#5567) 2018-05-22 11:23:59 +05:30
Nabin Hait
6737f1912c Fixed merge conflict 2018-05-08 15:27:37 +05:30
Ameya Shenoy
439effed7d Rebuild help for docs which have been renamed (#5521)
After execution of a bulk rename, the help cache for the particular
doctype didn't used to change. Added this fix to ensure the help is
rebuilt for the particular doctype whose docs have been renamed
2018-05-06 11:59:00 +05:30
Nabin Hait
3bb36344a6 minor fix 2018-05-05 12:07:54 +05:30
Suraj Shetty
3109123249 Permission improvements (#5494)
* Overwrite "if owner" restriction*
- Overwrite "if owner" restriction if user has other valid roles
(with access rights) without if_owner enabled for it in doc perm
eg:
If a doctype has 2 docperm for Role A and Role B and the docperm with
Role A has  if owner enabled.

Suppose User 1 has Role A, then User 1 should see only docs
which was created by him.

Now if User 2 has Role A and Role B, User 2 should be able to see all the
records because Role B has unrestricted access on doctype.
------------------------------------------------------

Previously in case of User 2, the restriction(of if owner) from Role A
used to reflect and User 2 was only able to view only records made by
him.

This commit will overwrite the if_owner restriction in such case.
- Refactor get_role_permission method

* Add advanced control for user permission
- Add ability to skip user permission check for specific doctype

* Refactor "linked with" method
- Add option to skip linked with doctype which has
ignore_user_permission enabled against them.

* Clear "linked with doctype" cache on doctype changes

* [Minor] Fix formatting

* Fix error and bugs in linked_with method

* Format code

* Add fix to get allowed docs from user_permission

* Fix has_user_permission bug

* Add before migrate patch for user permission

* Fix typo
2018-05-04 13:13:29 +05:30
Saurabh
f3a25b3f91 Merge branch 'master' into develop 2018-05-02 14:51:46 +05:30