Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
erp5
Commits
73b4299a
Commit
73b4299a
authored
7 years ago
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_base: Fix owner_title scriptable key.
This was broken since the use of user_id on Person. Also, add a test.
parent
f26fa93b
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
10 deletions
+47
-10
bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.py
...erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.py
+7
-10
product/ERP5/tests/testERP5Base.py
product/ERP5/tests/testERP5Base.py
+40
-0
No files found.
bt5/erp5_base/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeOwnerTitleSearchQuery.py
View file @
73b4299a
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
return
SimpleQuery
(
owner
=
[
portal
=
context
.
getPortalObject
()
x
.
user_id
for
x
in
context
.
getPortalObject
().
portal_catalog
(
reference_list
=
[
x
.
reference
for
x
in
select_list
=
[
'user_id'
],
portal
.
portal_catalog
(
SimpleQuery
(
reference
=
None
,
title
=
value
,
comparison_operator
=
"is not"
),
)
select_list
=
[
'reference'
],
]
or
value
or
-
1
)
portal_type
=
"Person"
,
title
=
value
)]
return
SimpleQuery
(
owner
=
reference_list
or
value
or
-
1
)
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testERP5Base.py
View file @
73b4299a
...
@@ -1411,6 +1411,46 @@ class TestERP5Base(ERP5TypeTestCase):
...
@@ -1411,6 +1411,46 @@ class TestERP5Base(ERP5TypeTestCase):
self
.
portal
.
BankAccount_validateBIC
(
self
.
portal
.
BankAccount_validateBIC
(
'X'
,
request
=
None
))
'X'
,
request
=
None
))
def
test_user_title
(
self
):
newContent
=
self
.
portal
.
person_module
.
newContent
login
=
super
(
TestERP5Base
,
self
).
login
# User 1 and 2 have the same title (picked from user 1's user id),
# hopefully not shared with other users.
# User 3 has a different title, also hopefully not shared.
user_1
=
newContent
(
portal_type
=
'Person'
)
common_user_title
=
user_1
.
Person_getUserId
()
user_1
.
setTitle
(
common_user_title
)
user_2
=
newContent
(
portal_type
=
'Person'
)
user_2
.
setTitle
(
common_user_title
)
user_3
=
newContent
(
portal_type
=
'Person'
)
user_3
.
setTitle
(
user_3
.
Person_getUserId
())
# any member can add persons
self
.
portal
.
person_module
.
manage_permission
(
'Add portal content'
,
roles
=
[
'Member'
,
'Manager'
],
acquire
=
0
,
)
self
.
tic
()
# Create whatever documents.
must_find_path_list
=
[]
login
(
user_1
.
Person_getUserId
())
must_find_path_list
.
append
(
newContent
(
portal_type
=
'Person'
,
title
=
'Owned by user_1'
).
getPath
())
login
(
user_2
.
Person_getUserId
())
must_find_path_list
.
append
(
newContent
(
portal_type
=
'Person'
,
title
=
'Owned by user_2'
).
getPath
())
login
(
user_3
.
Person_getUserId
())
newContent
(
portal_type
=
'Person'
,
title
=
'Owned by user_3'
)
login
()
self
.
tic
()
self
.
assertItemsEqual
(
must_find_path_list
,
[
x
.
path
for
x
in
self
.
portal
.
portal_catalog
(
owner_title
=
common_user_title
,
portal_type
=
'Person'
,
)
],
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment