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
144
Merge Requests
144
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
fdf0a96f
Commit
fdf0a96f
authored
Nov 06, 2019
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Use proxy role as manager where is required
parent
31eaf348
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
10 deletions
+161
-10
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.py
...rtal_skins/erp5_document_scanner/Base_getTempImageList.py
+16
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.xml
...tal_skins/erp5_document_scanner/Base_getTempImageList.xml
+70
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_removeActiveProcessFromActivityTool.py
...ument_scanner/Base_removeActiveProcessFromActivityTool.py
+2
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_removeActiveProcessFromActivityTool.xml
...ment_scanner/Base_removeActiveProcessFromActivityTool.xml
+70
-0
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_uploadDocumentFromCamera.py
...ns/erp5_document_scanner/Base_uploadDocumentFromCamera.py
+3
-10
No files found.
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.py
0 → 100644
View file @
fdf0a96f
"""
Proxy role as Manager is required here to access getResultList
"""
if
REQUEST
:
return
RuntimeError
(
"You cannot run this script in the url"
)
image_module
=
context
.
getPortalObject
().
image_module
pdf_data_list
=
[]
for
result
in
active_process
.
getResultList
():
pdf_data_list
.
append
(
image_module
.
newContent
(
data
=
result
.
detail
,
portal_type
=
"Image"
,
temp_object
=
True
).
convert
(
format
=
"pdf"
)[
1
])
return
pdf_data_list
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.xml
0 → 100644
View file @
fdf0a96f
<?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>
active_process, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getTempImageList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_removeActiveProcessFromActivityTool.py
0 → 100644
View file @
fdf0a96f
context
.
getPortalObject
().
portal_activities
.
manage_delObjects
(
ids
=
[
active_process
.
getId
(),])
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_removeActiveProcessFromActivityTool.xml
0 → 100644
View file @
fdf0a96f
<?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>
active_process
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_removeActiveProcessFromActivityTool
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_uploadDocumentFromCamera.py
View file @
fdf0a96f
...
@@ -4,23 +4,16 @@ class StringIOWithFileName(StringIO):
...
@@ -4,23 +4,16 @@ class StringIOWithFileName(StringIO):
filename
=
"{}.pdf"
.
format
(
filename
=
"{}.pdf"
.
format
(
kw
.
get
(
"title"
)
or
DateTime
().
strftime
(
'%d-%m-%Y_%Hh%M'
))
kw
.
get
(
"title"
)
or
DateTime
().
strftime
(
'%d-%m-%Y_%Hh%M'
))
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
pdf_data_list
=
[]
image_module
=
portal
.
image_module
active_process
=
portal
.
restrictedTraverse
(
active_process_url
)
active_process
=
portal
.
restrictedTraverse
(
active_process_url
)
for
result
in
active_process
.
getResultList
():
pdf_data_list
=
context
.
Base_getTempImageList
(
active_process
)
pdf_data_list
.
append
(
image_module
.
newContent
(
data
=
result
.
detail
,
portal_type
=
"Image"
,
temp_object
=
True
).
convert
(
format
=
"pdf"
)[
1
])
pdf_data
=
context
.
ERP5Site_mergePDFList
(
pdf_data_list
=
pdf_data_list
)
pdf_data
=
context
.
ERP5Site_mergePDFList
(
pdf_data_list
=
pdf_data_list
)
file_object
=
StringIOWithFileName
(
pdf_data
)
file_object
=
StringIOWithFileName
(
pdf_data
)
doc
=
context
.
Base_contribute
(
file
=
file_object
,
doc
=
context
.
Base_contribute
(
file
=
file_object
,
batch_mode
=
True
,
batch_mode
=
True
,
redirect_to_document
=
False
,
follow_up_list
=
[
context
.
getRelativeUrl
(),],
follow_up_list
=
[
context
.
getRelativeUrl
(),],
**
kw
)
**
kw
)
...
@@ -36,4 +29,4 @@ else:
...
@@ -36,4 +29,4 @@ else:
for
action
in
action_list
:
for
action
in
action_list
:
getattr
(
doc
,
action
)()
getattr
(
doc
,
action
)()
portal
.
portal_activities
.
manage_delObjects
(
ids
=
[
active_process
.
getId
(),]
)
context
.
Base_removeActiveProcessFromActivityTool
(
active_process
)
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