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
Labels
Merge Requests
137
Merge Requests
137
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
17669c01
Commit
17669c01
authored
Oct 02, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crm: fix pylint messages and enable coding style
parent
6db1da77
Pipeline
#11765
failed with stage
Changes
22
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
29 additions
and
46 deletions
+29
-46
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/AcknowledgementTool_getUserUnreadAcknowledgementList.py
...m/AcknowledgementTool_getUserUnreadAcknowledgementList.py
+4
-5
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
...portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/ERP5Site_getFollowUpItemList.py
...tem/portal_skins/erp5_crm/ERP5Site_getFollowUpItemList.py
+4
-3
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Entity_createEventFromDefaultEventPath.py
..._skins/erp5_crm/Entity_createEventFromDefaultEventPath.py
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventActivityReportSectionList.py
...erp5_crm/EventModule_getEventActivityReportSectionList.py
+1
-4
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedLineList.py
...al_skins/erp5_crm/EventModule_getEventDetailedLineList.py
+4
-4
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedReportSectionList.py
...erp5_crm/EventModule_getEventDetailedReportSectionList.py
+1
-3
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_statEventActivityLineList.py
...l_skins/erp5_crm/EventModule_statEventActivityLineList.py
+0
-4
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_statEventDetailedLineList.py
...l_skins/erp5_crm/EventModule_statEventDetailedLineList.py
+0
-4
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createDocumentFromAttachment.py
...rtal_skins/erp5_crm/Event_createDocumentFromAttachment.py
+2
-2
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createDocumentFromAttachment.xml
...tal_skins/erp5_crm/Event_createDocumentFromAttachment.xml
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRelatedEvent.py
...ateItem/portal_skins/erp5_crm/Event_createRelatedEvent.py
+2
-3
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.py
...ateItem/portal_skins/erp5_crm/Event_createRespondEvent.py
+0
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentFastInputList.py
...portal_skins/erp5_crm/Event_getAttachmentFastInputList.py
+1
-2
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getPropertyDictFromContent.py
...portal_skins/erp5_crm/Event_getPropertyDictFromContent.py
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_setTextContentFromNotificationMessage.py
...s/erp5_crm/Event_setTextContentFromNotificationMessage.py
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/NotificationMessage_getSubstitutionMappingDictFromEvent.py
...otificationMessage_getSubstitutionMappingDictFromEvent.py
+0
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
...eItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
+1
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_init.py
...crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_init.py
+2
-0
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRMNotificationTool.py
...em/portal_components/test.erp5.testCRMNotificationTool.py
+1
-1
bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_checkConsistency.py
...ent_simulation_workflow/scripts/Event_checkConsistency.py
+1
-2
bt5/erp5_crm/bt/skip_coding_style_test
bt5/erp5_crm/bt/skip_coding_style_test
+0
-1
No files found.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/AcknowledgementTool_getUserUnreadAcknowledgementList.py
View file @
17669c01
...
...
@@ -4,14 +4,14 @@ connected. This script will use efficiently caches in order to slow
down as less a possible the user interface
"""
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
user_name
=
context
.
portal_membership
.
getAuthenticatedMember
().
getId
()
user_name
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getId
()
def
getUnreadAcknowledgementListForUser
(
user_name
=
None
):
# We give the portal type "Mass Notification" for now, we can
# have a getPortalAcknowledgeableTypeList method in the future
portal_acknowledgements
=
getattr
(
context
.
getPortalObject
(),
"portal_acknowledgements"
,
None
)
portal_acknowledgements
=
getattr
(
portal
,
"portal_acknowledgements"
,
None
)
result
=
[]
if
portal_acknowledgements
is
not
None
:
result
=
context
.
portal_acknowledgements
.
getUnreadDocumentUrlList
(
...
...
@@ -23,13 +23,12 @@ from Products.ERP5Type.Cache import CachingMethod
# Cache for every user the list of url of not acknowledge documents
getUnreadAcknowledgementList
=
CachingMethod
(
getUnreadAcknowledgementListForUser
,
"getUnreadAcknowledgementListForUser"
)
portal
=
context
.
getPortalObject
()
return_list
=
[]
url_list
=
getUnreadAcknowledgementList
(
user_name
=
user_name
)
# For every not acknowledge document, check that documents are still not
# acknowledged and return them for the user interface
if
len
(
url_list
)
>
0
:
acknowledgement_list
=
context
.
portal_acknowledgements
.
getUnreadAcknowledgementList
(
acknowledgement_list
=
portal
.
portal_acknowledgements
.
getUnreadAcknowledgementList
(
url_list
=
url_list
,
user_name
=
user_name
)
for
acknowledgement
in
acknowledgement_list
:
#bulletin = acknowledgement.getCausalityValue()
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Base_getEntityListFromFromHeader.py
View file @
17669c01
...
...
@@ -3,7 +3,7 @@ getResultValue = context.portal_catalog.getResultValue
from
Products.ERP5Type.Utils
import
Email_parseAddressHeader
result
=
[]
for
name
,
recipient
in
Email_parseAddressHeader
(
text
):
for
_
,
recipient
in
Email_parseAddressHeader
(
text
):
if
recipient
:
email
=
getResultValue
(
url_string
=
{
'query'
:
recipient
,
'key'
:
'ExactMatch'
},
portal_type
=
'Email'
,
parent_portal_type
=
'Person'
)
if
email
is
None
:
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/ERP5Site_getFollowUpItemList.py
View file @
17669c01
...
...
@@ -2,6 +2,7 @@
This script returns all possible projects or tickets
which can be used a follow up to a CRM event.
"""
type_list
=
context
.
getPortalTicketTypeList
()
+
context
.
getPortalProjectTypeList
()
node_list
=
context
.
portal_catalog
(
portal_type
=
type_list
,
simulation_state
=
[
'draft'
,
'open'
,
'validated'
,
'contacted'
])
return
map
(
lambda
x
:(
x
.
getTitle
(),
x
.
getRelativeUrl
()),
node_list
)
portal
=
context
.
getPortalObject
()
type_list
=
portal
.
getPortalTicketTypeList
()
+
portal
.
getPortalProjectTypeList
()
node_list
=
portal
.
portal_catalog
(
portal_type
=
type_list
,
simulation_state
=
[
'draft'
,
'open'
,
'validated'
,
'contacted'
])
return
[(
x
.
getTitle
(),
x
.
getRelativeUrl
)
for
x
in
node_list
]
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Entity_createEventFromDefaultEventPath.py
View file @
17669c01
...
...
@@ -15,7 +15,7 @@ notification_message = portal.notification_message_module.NotificationTool_getDo
language
=
language
)
assert
notification_message
is
not
None
,
"%s not found."
%
resource_reference
event
=
context
.
Base_addEvent
(
title
=
''
,
context
.
Base_addEvent
(
title
=
''
,
direction
=
'outgoing'
,
portal_type
=
event_portal_type
,
resource
=
notification_message
.
getSpecialise
(),
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventActivityReportSectionList.py
View file @
17669c01
from
Products.ERP5Form.Report
import
ReportSection
result
=
[]
request
=
context
.
REQUEST
params
=
{}
result
=
[]
selection_columns
=
[(
'simulation_state'
,
'State'
)]
#Add dynamicaly ticket type columns to the form
#The name of column must be without spaces
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedLineList.py
View file @
17669c01
...
...
@@ -31,14 +31,14 @@ unassigned_dic['ticket_type']=portal.Base_translateString("Unassigned")
#column_list.append(new_dic)
#Return index of uid into the list and append if not exists
def
createReturnLine
(
uid
,
list
):
for
i
in
xrange
(
len
(
list
)):
def
createReturnLine
(
uid
,
list_
):
for
i
in
xrange
(
len
(
list
_
)):
if
list
[
i
][
'uid'
]
==
uid
:
return
i
new_dic
=
default_dic
.
copy
()
new_dic
[
'uid'
]
=
uid
list
.
append
(
new_dic
)
return
len
(
list
)
-
1
list
_
.
append
(
new_dic
)
return
len
(
list
_
)
-
1
# Prepare the parameters to filter
query_dict
=
{}
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedReportSectionList.py
View file @
17669c01
from
Products.ERP5Form.Report
import
ReportSection
result
=
[]
request
=
context
.
REQUEST
result
=
[]
selection_columns
=
[(
'ticket_title'
,
'Title'
)]
selection_columns
.
append
((
'ticket_type'
,
'Module'
))
selection_columns
.
append
((
'resource'
,
'Type'
))
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_statEventActivityLineList.py
View file @
17669c01
from
Products.PythonScripts.standard
import
Object
request
=
container
.
REQUEST
RESPONSE
=
request
.
RESPONSE
stat_line
=
request
.
get
(
'stat_line'
,
None
)
return
stat_line
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_statEventDetailedLineList.py
View file @
17669c01
from
Products.PythonScripts.standard
import
Object
request
=
container
.
REQUEST
RESPONSE
=
request
.
RESPONSE
stat_line
=
request
.
get
(
'stat_line'
,
None
)
return
stat_line
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createDocumentFromAttachment.py
View file @
17669c01
...
...
@@ -8,7 +8,7 @@ if dms_module is not None:
# index is numeric and comes with uid
attachment_index
=
int
(
uid
.
split
(
'index_'
)[
-
1
])
attachment_info
=
[
i
for
i
in
attachment_info_list
if
i
[
'index'
]
==
attachment_index
][
0
]
file
=
context
.
getAttachmentData
(
index
=
attachment_index
)
file
_
=
context
.
getAttachmentData
(
index
=
attachment_index
)
document
=
dms_module
.
newContent
(
follow_up
=
context
.
getFollowUp
(),
portal_type
=
line
[
'content_type'
],
description
=
line
[
'description'
],
...
...
@@ -17,7 +17,7 @@ if dms_module is not None:
language
=
line
[
'language'
],
reference
=
line
[
'reference'
],
title
=
line
[
'title'
])
document
.
edit
(
source_reference
=
attachment_info
[
'file_name'
],
file
=
file
)
document
.
edit
(
source_reference
=
attachment_info
[
'file_name'
],
file
=
file
_
)
if
len
(
uids
)
==
1
:
message
=
Base_translateString
(
'${portal_type} created successfully.'
,
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createDocumentFromAttachment.xml
View file @
17669c01
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
uids=
[]
, listbox=None, **kw
</string>
</value>
<value>
<string>
uids=
()
, listbox=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRelatedEvent.py
View file @
17669c01
...
...
@@ -2,15 +2,14 @@
# the current event
from
DateTime
import
DateTime
from
Products.CMFCore.WorkflowCore
import
WorkflowException
N_
=
context
.
Base_translateString
date
=
DateTime
()
portal
=
context
.
getPortalObject
()
if
portal_type
not
in
portal
.
event_module
.
getVisibleAllowedContentTypeList
():
raise
WorkflowException
,
"You Don't Have Permission to Add New Event"
raise
WorkflowException
(
"You Don't Have Permission to Add New Event"
)
# Create the draft Event
related_event
=
portal
.
event_module
.
newContent
(
portal
.
event_module
.
newContent
(
portal_type
=
portal_type
,
title
=
title
,
description
=
description
,
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createRespondEvent.py
View file @
17669c01
...
...
@@ -4,7 +4,6 @@
"""
# this script allows to create a new follow up ticket for a given event
event_object
=
context
event_module
=
context
.
getPortalObject
().
getDefaultModule
(
respond_event_portal_type
)
# Create the outgoing
respond_event
=
event_module
.
newContent
(
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentFastInputList.py
View file @
17669c01
from
Products.ERP5Type.Document
import
newTempBase
contribution_registry
=
context
.
portal_contribution_registry
base_list
=
[]
for
attachment
in
context
.
getAttachmentInformationList
():
...
...
@@ -8,7 +7,7 @@ for attachment in context.getAttachmentInformationList():
if
attachment
[
'uid'
]
not
in
[
'part_1'
,
'part_0'
]:
filename
=
context
.
getTitle
()
if
attachment
.
has_key
(
"file_name"
):
filename
=
attachment
[
"file_name"
]
filename
=
attachment
[
"file_name"
]
pt
=
"File"
temp_base_id
=
'index_'
.
join
([
attachment
[
"uid"
],
str
(
attachment
[
"index"
])])
base_list
.
append
(
newTempBase
(
context
,
id
=
temp_base_id
,
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getPropertyDictFromContent.py
View file @
17669c01
...
...
@@ -45,7 +45,7 @@ subject = content_information.get('Subject', '')
body
=
context
.
asText
()
portal_type
=
None
for
text
in
(
subject
,
body
):
portal_type
,
matched_value
=
context
.
Base_findPortalTypeNameAndMatchedValueForEvent
(
text
)
portal_type
,
_
=
context
.
Base_findPortalTypeNameAndMatchedValueForEvent
(
text
)
if
portal_type
is
not
None
:
break
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_setTextContentFromNotificationMessage.py
View file @
17669c01
...
...
@@ -20,7 +20,7 @@ if notification_message is not None:
target_format
=
"txt"
if
context
.
getContentType
()
==
'text/html'
:
target_format
=
"html"
mime
,
text_content
=
notification_message
.
convert
(
target_format
,
_
,
text_content
=
notification_message
.
convert
(
target_format
,
substitution_method_parameter_dict
=
substitution_method_parameter_dict
)
context
.
setTextContent
(
text_content
)
context
.
setAggregateSet
(
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/NotificationMessage_getSubstitutionMappingDictFromEvent.py
View file @
17669c01
portal
=
context
.
getPortalObject
()
hmac
=
portal
.
Base_getHMACHexdigest
(
key
=
portal
.
Base_getEventHMACKey
(),
message
=
event_value
.
getId
())
def
getSubstitutionMappingDict
():
destination
=
event_value
.
getDestinationValue
()
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
View file @
17669c01
...
...
@@ -75,7 +75,7 @@ def getResourceItemList():
getCategoryTitle
=
getCategoryTitle_
else
:
getCategoryTitle
=
lambda
category
,
depth
:
None
def
getResourceTitle
(
resource
,
category
,
depth
):
def
getResourceTitle
(
resource
,
category
,
depth
):
# pylint:disable=function-redefined
resource_title
=
getattr
(
resource
,
accessor_id
)()
# depth - 1 because we are at category's child level
category_path
=
getCategoryTitle_
(
category
,
depth
-
1
)
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_init.py
View file @
17669c01
"""
"""
# XXX: Tickets are not documents, so content_type on them has no sense at all
# Set preferred text format
#context.edit(content_type = context.portal_preferences.getPreferredTextFormat())
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRMNotificationTool.py
View file @
17669c01
...
...
@@ -56,7 +56,7 @@ class TestCRMNotificationTool(TestNotificationTool):
message
=
'Message'
)
self
.
tic
()
last_message
,
=
self
.
portal
.
MailHost
.
_message_list
mfrom
,
mto
,
messageText
=
last_message
mfrom
,
mto
,
_
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_checkConsistency.py
View file @
17669c01
object
=
state_change
[
'object'
]
object
.
Base_checkConsistency
()
state_change
[
'object'
].
Base_checkConsistency
()
bt5/erp5_crm/bt/skip_coding_style_test
deleted
100644 → 0
View file @
6db1da77
1
\ No newline at end of file
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