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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
bdde7617
Commit
bdde7617
authored
Feb 10, 2020
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Avoid reference hardcoded in many places
parent
9960bba7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
7 deletions
+72
-7
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/ActiveProcess_removeItselfFromActivityTool.py
...ent_scanner/ActiveProcess_removeItselfFromActivityTool.py
+1
-1
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Alarm_removeOutdatedActiveProcess.py
...rp5_document_scanner/Alarm_removeOutdatedActiveProcess.py
+2
-2
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDefaultBackendDataAsJSON.py
...erp5_document_scanner/Base_getDefaultBackendDataAsJSON.py
+2
-1
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDocumentScannerDefaultReference.py
...cument_scanner/Base_getDocumentScannerDefaultReference.py
+1
-0
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDocumentScannerDefaultReference.xml
...ument_scanner/Base_getDocumentScannerDefaultReference.xml
+62
-0
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_postDataToActiveResult.py
...kins/erp5_document_scanner/Base_postDataToActiveResult.py
+4
-3
No files found.
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/ActiveProcess_removeItselfFromActivityTool.py
View file @
bdde7617
assert
context
.
getPortalType
()
==
"Active Process"
,
"It must be an Active Process"
assert
context
.
getPortalType
()
==
"Active Process"
,
"It must be an Active Process"
assert
context
.
getReference
()
==
"document_scanner_js"
,
"Unexpected reference"
assert
context
.
getReference
()
==
context
.
Base_getDocumentScannerDefaultReference
()
,
"Unexpected reference"
context
.
getPortalObject
().
portal_activities
.
manage_delObjects
(
context
.
getPortalObject
().
portal_activities
.
manage_delObjects
(
ids
=
[
context
.
getId
(),])
ids
=
[
context
.
getId
(),])
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Alarm_removeOutdatedActiveProcess.py
View file @
bdde7617
...
@@ -3,7 +3,7 @@ portal = context.getPortalObject()
...
@@ -3,7 +3,7 @@ portal = context.getPortalObject()
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Active Process"
,],
portal_type
=
[
"Active Process"
,],
method_id
=
'ActiveProcess_removeItselfFromActivityTool'
,
method_id
=
'ActiveProcess_removeItselfFromActivityTool'
,
reference
=
"document_scanner_js"
,
reference
=
context
.
Base_getDocumentScannerDefaultReference
()
,
# Active Process don't have creation date set
# Active Process don't have creation date set
indexation_timestamp
=
"< %s"
%
(
DateTime
()
-
4
).
earliestTime
(),
modification_date
=
"< %s"
%
(
DateTime
()
-
4
).
earliestTime
(),
)
)
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDefaultBackendDataAsJSON.py
View file @
bdde7617
import
json
import
json
active_process
=
context
.
getPortalObject
().
portal_activities
.
newActiveProcess
()
active_process
=
context
.
getPortalObject
().
portal_activities
.
newActiveProcess
(
reference
=
context
.
Base_getDocumentScannerDefaultReference
())
return
json
.
dumps
({
return
json
.
dumps
({
"active_process"
:
active_process
.
getRelativeUrl
(),
"active_process"
:
active_process
.
getRelativeUrl
(),
...
...
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDocumentScannerDefaultReference.py
0 → 100644
View file @
bdde7617
return
"document_scanner_js"
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getDocumentScannerDefaultReference.xml
0 → 100644
View file @
bdde7617
<?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>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getDocumentScannerDefaultReference
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_postDataToActiveResult.py
View file @
bdde7617
...
@@ -10,14 +10,15 @@ portal = context.getPortalObject()
...
@@ -10,14 +10,15 @@ portal = context.getPortalObject()
if
REQUEST
:
if
REQUEST
:
return
RuntimeError
(
"You cannot run this script in the url"
)
return
RuntimeError
(
"You cannot run this script in the url"
)
reference
=
context
.
Base_getDocumentScannerDefaultReference
()
if
active_process_url
:
if
active_process_url
:
active_process
=
portal
.
restrictedTraverse
(
active_process_url
)
active_process
=
portal
.
restrictedTraverse
(
active_process_url
)
else
:
else
:
active_process
=
portal
.
portal_activities
.
newActiveProcess
(
)
active_process
=
portal
.
portal_activities
.
newActiveProcess
(
active_process
.
setReference
(
"document_scanner_js"
)
reference
=
reference
)
if
generate_new_uid
:
if
generate_new_uid
:
id_group
=
(
'document_scanner_js'
,
active_process
.
getUid
())
id_group
=
(
reference
,
active_process
.
getUid
())
new_uid
=
portal
.
portal_ids
.
generateNewId
(
id_group
=
id_group
,
default
=
0
)
new_uid
=
portal
.
portal_ids
.
generateNewId
(
id_group
=
id_group
,
default
=
0
)
else
:
else
:
new_uid
=
None
new_uid
=
None
...
...
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