Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Global Search (again) #2710

Merged
merged 60 commits into from Feb 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
33abc08
[start] global search frappe/erpnext#6674
rmehta Nov 14, 2016
89f0324
[fix] setup before running test
rmehta Nov 23, 2016
b7a4088
[start] global search frappe/erpnext#6674
rmehta Nov 14, 2016
5f66c7b
Display result as rudimentary list, rebuild old doctypes
pratu16x7 Dec 6, 2016
416080e
Media view, child tables, delete document updates, searchable fields
pratu16x7 Dec 16, 2016
8419315
More results UI
pratu16x7 Dec 22, 2016
f8bd0b8
Code clean up
pratu16x7 Dec 22, 2016
80c0b01
remove msgprint from document.py to resolve merge conflict
pratu16x7 Dec 22, 2016
c4ee745
Modularization stage 1, get show more to work with it
pratu16x7 Dec 26, 2016
8e8efd9
Dedicated modal Search bar works, some clean up needed
pratu16x7 Dec 26, 2016
c7a8192
Can't data-dismiss on links, Bootstrap issue, use hashchange
pratu16x7 Dec 26, 2016
d08b18f
Accomodate missing field content syndrome
pratu16x7 Dec 26, 2016
ca6efe6
Search in boolean mode, make GS default in awesome bar, fix double mo…
pratu16x7 Dec 27, 2016
492783a
Add in Meta
pratu16x7 Dec 27, 2016
51cec60
Add in customize form
pratu16x7 Dec 27, 2016
d8f402a
Modularise Global Search
pratu16x7 Dec 29, 2016
7b3c13f
Search object
pratu16x7 Dec 30, 2016
616fa42
Commonify Search UI: Stage I
pratu16x7 Dec 31, 2016
8453e5e
II: save list state, UI, default condensed view, refactor
pratu16x7 Jan 11, 2017
a516f97
Fix SQL bug, Refactor awesome bar, Fix unicode bug, add nav results
pratu16x7 Jan 19, 2017
f8fb82e
Refactor using separate search objects, some async issues
pratu16x7 Jan 24, 2017
604cbe6
Fix async flow
pratu16x7 Jan 24, 2017
61fd10b
Fix preceding more list bug
pratu16x7 Jan 25, 2017
d6e817f
UI additions
pratu16x7 Jan 25, 2017
d4e4e79
another async fix, back link
pratu16x7 Jan 26, 2017
cdc9983
Help: Stage I
pratu16x7 Jan 27, 2017
52927d4
Help: Stage II
pratu16x7 Jan 27, 2017
3dc3f95
Background jobs, fix route options bug
pratu16x7 Jan 27, 2017
920fb47
Fix GS syncing on install
pratu16x7 Jan 27, 2017
5a3b8e0
Add GS options in awesome bar: test
pratu16x7 Jan 29, 2017
a7e974f
Input now remembers search type state
pratu16x7 Jan 29, 2017
d8eed31
More UI updates
pratu16x7 Jan 29, 2017
2a02403
Add description for GS results in awesome bar
pratu16x7 Jan 29, 2017
f11c6e9
Fix help modal bug
pratu16x7 Jan 30, 2017
077bb68
Fix: not commit during install
pratu16x7 Jan 30, 2017
f5cb617
Test cases, some fixes
pratu16x7 Feb 2, 2017
92c0bc5
Update in_test flag in enqueue
pratu16x7 Feb 2, 2017
cfc7375
Disable GS sync when not install_db
pratu16x7 Feb 2, 2017
0c0b180
Add flag check
pratu16x7 Feb 2, 2017
c232d99
Disable field in child tables
pratu16x7 Feb 2, 2017
1582e8f
Cleanups
pratu16x7 Feb 2, 2017
91c0d48
Create table fix
pratu16x7 Feb 2, 2017
c51f97a
Fix redis exception, remove commit enqueue, add gs in migrate
pratu16x7 Feb 5, 2017
8f87492
Fix tests
pratu16x7 Feb 6, 2017
de52b3f
Single enqueue
pratu16x7 Feb 6, 2017
80c4ba6
cleanups
pratu16x7 Feb 6, 2017
c1223f5
Fix tests
pratu16x7 Feb 6, 2017
5ef597a
Fix event test
pratu16x7 Feb 7, 2017
bfbd108
Fix duplication, search as first option
pratu16x7 Feb 8, 2017
26cfd7b
Add show name in global search
pratu16x7 Feb 9, 2017
7086cb3
fix event tests and desk.less
pratu16x7 Feb 9, 2017
11e6a26
Fix communication.json
pratu16x7 Feb 9, 2017
f0e371b
Merge branch 'develop' into new-search
rmehta Feb 9, 2017
1f32ccd
Merge branch 'new-search' of https://github.com/pratu16x7/frappe into…
rmehta Feb 13, 2017
3aa0f5a
[fixes] wip
rmehta Feb 13, 2017
dd86063
[fix] tests
rmehta Feb 13, 2017
a45f4a0
[minor] for tests
rmehta Feb 13, 2017
e28fe57
[minor] for tests
rmehta Feb 13, 2017
351cf75
[minor] for tests
rmehta Feb 13, 2017
4396764
[minor] for tests
rmehta Feb 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2,615 changes: 1,353 additions & 1,262 deletions frappe/core/doctype/communication/communication.json

Large diffs are not rendered by default.

2,334 changes: 1,218 additions & 1,116 deletions frappe/core/doctype/docfield/docfield.json

Large diffs are not rendered by default.

81 changes: 78 additions & 3 deletions frappe/core/doctype/doctype/doctype.json

Large diffs are not rendered by default.

31 changes: 28 additions & 3 deletions frappe/core/doctype/doctype/doctype.py
Expand Up @@ -33,7 +33,7 @@ def validate(self):
- Validate series
- Check fieldnames (duplication etc)
- Clear permission table for child tables
- Add `amended_from` and `ameneded_by` if Amendable"""
- Add `amended_from` and `amended_by` if Amendable"""
self.check_developer_mode()

self.validate_name()
Expand All @@ -59,6 +59,12 @@ def validate(self):

self.make_amendable()
self.validate_website()

try:
self.before_update = frappe.get_doc('DocType', self.name)
except frappe.DoesNotExistError:
pass

if not self.is_new():
self.setup_fields_to_fetch()

Expand Down Expand Up @@ -162,6 +168,7 @@ def validate_series(self, autoname=None, name=None):
self.autoname = "naming_series:"

# validate field name if autoname field:fieldname is used

if autoname and autoname.startswith('field:'):
field = autoname.split(":")[1]
if not field or field not in [ df.fieldname for df in self.fields ]:
Expand Down Expand Up @@ -201,13 +208,31 @@ def on_update(self):
delete_notification_count_for(doctype=self.name)
frappe.clear_cache(doctype=self.name)

if not frappe.flags.in_install and hasattr(self, 'before_update'):
self.sync_global_search()

def sync_global_search(self):
'''If global search settings are changed, rebuild search properties for this table'''
global_search_fields_before_update = [d.fieldname for d in
self.before_update.fields if d.in_global_search]
if self.before_update.show_name_in_global_search:
global_search_fields_before_update.append('name')

global_search_fields_after_update = [d.fieldname for d in
self.fields if d.in_global_search]
if self.show_name_in_global_search:
global_search_fields_after_update.append('name')

if set(global_search_fields_before_update) != set(global_search_fields_after_update):
frappe.enqueue('frappe.utils.global_search.rebuild_for_doctype',
now=frappe.flags.in_test, doctype=self.name)

def run_module_method(self, method):
from frappe.modules import load_doctype_module
module = load_doctype_module(self.name, self.module)
if hasattr(module, method):
getattr(module, method)()


def before_rename(self, old, new, merge=False):
"""Throw exception if merge. DocTypes cannot be merged."""
if not self.custom and frappe.session.user != "Administrator":
Expand Down Expand Up @@ -263,7 +288,7 @@ def import_doc(self):
import_from_files(record_list=[[self.module, 'doctype', self.name]])

def make_controller_template(self):
"""Make boilderplate controller template."""
"""Make boilerplate controller template."""
make_boilerplate("controller.py", self)

if not (self.istable or self.issingle):
Expand Down
1 change: 1 addition & 0 deletions frappe/custom/doctype/customize_form/customize_form.py
Expand Up @@ -43,6 +43,7 @@
'ignore_user_permissions': 'Check',
'in_list_view': 'Check',
'in_standard_filter': 'Check',
'in_global_search': 'Check',
'hidden': 'Check',
'collapsible': 'Check',
'collapsible_depends_on': 'Data',
Expand Down
Expand Up @@ -51,7 +51,8 @@ def test_fetch_to_customize(self):
d = self.get_customize_form("User")
self.assertEquals(d.doc_type, "User")

self.assertEquals(len(d.get("fields")), len(frappe.get_doc("DocType", d.doc_type).fields) + 1)
self.assertEquals(len(d.get("fields")),
len(frappe.get_doc("DocType", d.doc_type).fields) + 1)
self.assertEquals(d.get("fields")[-1].fieldname, "test_custom_field")
self.assertEquals(d.get("fields", {"fieldname": "location"})[0].in_list_view, 1)

Expand Down