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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
2c7b42db
Commit
2c7b42db
authored
Dec 18, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM: generate a new reference on cloned events
parent
e0135ca2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
15 deletions
+96
-15
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_afterClone.xml
...inTemplateItem/portal_skins/erp5_crm/Event_afterClone.xml
+2
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_generateReference.xml
...ateItem/portal_skins/erp5_crm/Event_generateReference.xml
+88
-0
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_init.xml
...crm/SkinTemplateItem/portal_skins/erp5_crm/Event_init.xml
+2
-14
product/ERP5/tests/testCRM.py
product/ERP5/tests/testCRM.py
+4
-0
No files found.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_afterClone.xml
View file @
2c7b42db
...
@@ -63,8 +63,9 @@ content_dict[\'destination_list\'] = content_dict.get(\'destination_list\', [])
...
@@ -63,8 +63,9 @@ content_dict[\'destination_list\'] = content_dict.get(\'destination_list\', [])
content_dict[\'source_list\'] = content_dict.get(\'source_list\', []) + \\\n
content_dict[\'source_list\'] = content_dict.get(\'source_list\', []) + \\\n
[x.getRelativeUrl() for x in context.getSourceValueList() \\\n
[x.getRelativeUrl() for x in context.getSourceValueList() \\\n
if x.getRelativeUrl() not in content_dict.get(\'source_list\', [])]\n
if x.getRelativeUrl() not in content_dict.get(\'source_list\', [])]\n
\n
context.edit(**content_dict)\n
context.edit(**content_dict)\n
# reset reference\n
context.Event_generateReference()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_generateReference.xml
0 → 100644
View file @
2c7b42db
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""Owner Proxy Role allows anonymous users to create events\n
through web sites. cf. Event_init\n
"""\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
context.setReference(reference)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Event_generateReference
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_init.xml
View file @
2c7b42db
...
@@ -52,23 +52,11 @@
...
@@ -52,23 +52,11 @@
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""Owner Proxy Role allows anonymous users to create events\n
<value>
<string>
"""Owner Proxy Role allows anonymous users to create events\n
through web sites.\n
through web sites.\n
\n
Reference will be probably generated with dedicated tool\n
in near future\n
"""\n
"""\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
# Set preferred text format and reference\n
# Set preferred text format and reference\n
context.setContentType(
context
.portal_preferences.getPreferredTextFormat())\n
context.setContentType(
portal
.portal_preferences.getPreferredTextFormat())\n
context.
setReference(reference
)\n
context.
Event_generateReference(
)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
product/ERP5/tests/testCRM.py
View file @
2c7b42db
...
@@ -725,6 +725,9 @@ class TestCRMMailIngestion(BaseTestCRM):
...
@@ -725,6 +725,9 @@ class TestCRMMailIngestion(BaseTestCRM):
self
.
assertEquals
(
new_event
.
getDestinationList
(),
[
'person_module/me'
,
self
.
assertEquals
(
new_event
.
getDestinationList
(),
[
'person_module/me'
,
'person_module/he'
])
'person_module/he'
])
# cloned event got a new reference
self
.
assertNotEqual
(
new_event
.
getReference
(),
event
.
getReference
())
def
test_follow_up
(
self
):
def
test_follow_up
(
self
):
# follow up is found automatically, based on the content of the mail, and
# follow up is found automatically, based on the content of the mail, and
# what you defined in preference regexpr.
# what you defined in preference regexpr.
...
@@ -1575,6 +1578,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1575,6 +1578,7 @@ class TestCRMMailSend(BaseTestCRM):
self
.
assertEquals
(
new_event
.
getData
(),
''
)
self
.
assertEquals
(
new_event
.
getData
(),
''
)
self
.
assertEquals
(
new_event
.
getTitle
(),
real_title
)
self
.
assertEquals
(
new_event
.
getTitle
(),
real_title
)
self
.
assertEquals
(
new_event
.
getTextContent
(),
real_content
)
self
.
assertEquals
(
new_event
.
getTextContent
(),
real_content
)
self
.
assertNotEquals
(
new_event
.
getReference
(),
event
.
getReference
())
def
test_cloneTicketAndEventList
(
self
):
def
test_cloneTicketAndEventList
(
self
):
"""
"""
...
...
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