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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
erp5
Commits
004d5200
Commit
004d5200
authored
Dec 19, 2024
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_interface_cxml: .
parent
56c533cb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
10 deletions
+88
-10
bt5/erp5_interface_cxml/ModuleComponentTemplateItem/portal_components/document.erp5.CxmlMultipartDocument.py
.../portal_components/document.erp5.CxmlMultipartDocument.py
+63
-9
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/CxmlMultipartDocument_view/my_successor_list.xml
...ace_cxml/CxmlMultipartDocument_view/my_successor_list.xml
+4
-0
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/Order_getAribaAttachmentUrl.py
..._skins/erp5_interface_cxml/Order_getAribaAttachmentUrl.py
+4
-1
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/SaleOrder_checkCxmlOrderRequestConsistency.py
...erface_cxml/SaleOrder_checkCxmlOrderRequestConsistency.py
+4
-0
bt5/erp5_interface_cxml/WorkflowTemplateItem/portal_workflow/cxml_validation_workflow/script_CxmlOrderRequest_doValidateAction.py
...tion_workflow/script_CxmlOrderRequest_doValidateAction.py
+5
-0
bt5/erp5_interface_cxml/WorkflowTemplateItem/portal_workflow/cxml_validation_workflow/state_draft.xml
.../portal_workflow/cxml_validation_workflow/state_draft.xml
+8
-0
No files found.
bt5/erp5_interface_cxml/ModuleComponentTemplateItem/portal_components/document.erp5.CxmlMultipartDocument.py
View file @
004d5200
...
...
@@ -41,7 +41,41 @@ class CxmlMultipartDocument(XMLObject):
security
.
declareObjectProtected
(
AccessContentsInformation
)
def
getTitle
(
self
):
return
None
return
"%s %s"
%
(
self
.
portal_type
,
self
.
getId
())
security
.
declareProtected
(
ModifyPortalContent
,
'checkParts'
)
def
checkParts
(
self
):
"CHeck Parts"
portal
=
self
.
getPortalObject
()
output
=
""
content
=
"content-length: %s
\
n
Content-Type: %s
\
n
%s"
%
(
self
.
getSize
(),
self
.
getContentType
(),
self
.
getData
()
)
message
=
email
.
Parser
.
Parser
().
parsestr
(
content
)
for
part
in
message
.
walk
():
output
+=
part
.
get_content_type
()
+
"
\
n
"
if
part
.
is_multipart
():
continue
payload
=
part
.
get_payload
(
decode
=
0
)
cxml_document_list
=
[]
if
part
.
get_content_type
()
==
"application/pdf"
:
filename
=
part
.
get_filename
()
pdf_document
=
portal
.
document_module
.
newContent
(
portal_type
=
"PDF"
,
data
=
payload
,
filename
=
filename
,
title
=
filename
.
rstrip
(
'.pdf'
),
version
=
"001"
,
classification
=
"collaborative/team"
,
group
=
"woelfel/wws"
,
publication_section
=
"verkauf/auftraege"
,
)
pdf_document
.
submit
()
cxml_document_list
.
append
(
pdf_document
)
self
.
setSuccessorValueList
(
self
.
getSuccessorValueList
()
+
cxml_document_list
)
return
output
security
.
declareProtected
(
ModifyPortalContent
,
'extract'
)
def
extract
(
self
):
...
...
@@ -54,17 +88,37 @@ class CxmlMultipartDocument(XMLObject):
)
message
=
email
.
Parser
.
Parser
().
parsestr
(
content
)
cxml_document_list
=
[]
pdf_document_list
=
[]
for
part
in
message
.
walk
():
if
part
.
is_multipart
():
continue
payload
=
part
.
get_payload
(
decode
=
0
)
if
"<OrderRequest>"
in
payload
:
portal_type
=
"Cxml Order Request"
if
part
.
get_content_type
()
==
"application/pdf"
:
filename
=
part
.
get_filename
()
pdf_document
=
portal
.
document_module
.
newContent
(
portal_type
=
"PDF"
,
data
=
payload
,
filename
=
filename
,
title
=
filename
.
rstrip
(
'.pdf'
),
version
=
"001"
,
classification
=
"collaborative/team"
,
group
=
"woelfel/wws"
,
publication_section
=
"verkauf/auftraege"
,
)
pdf_document
.
submit
()
pdf_document_list
.
append
(
pdf_document
)
else
:
portal_type
=
"Cxml Document"
cxml_document_list
.
append
(
portal
.
cxml_document_module
.
newContent
(
portal_type
=
portal_type
,
text_content
=
payload
,
causality_value
=
self
))
self
.
setSuccessorValueList
(
cxml_document_list
)
if
"<OrderRequest>"
in
payload
:
portal_type
=
"Cxml Order Request"
else
:
portal_type
=
"Cxml Document"
cxml_document_list
.
append
(
portal
.
cxml_document_module
.
newContent
(
portal_type
=
portal_type
,
text_content
=
payload
,
causality_value
=
self
))
for
order_request
in
cxml_document_list
:
if
order_request
.
getPortalType
()
==
"Cxml Order Request"
:
for
pdf_document
in
pdf_document_list
:
pdf_document
.
setFollowUpValue
(
order_request
)
self
.
setSuccessorValueList
(
cxml_document_list
+
pdf_document_list
)
return
cxml_document_list
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/CxmlMultipartDocument_view/my_successor_list.xml
View file @
004d5200
...
...
@@ -95,6 +95,10 @@
<string>
Cxml Order Request
</string>
<string>
Cxml Order Request
</string>
</tuple>
<tuple>
<string>
PDF
</string>
<string>
PDF
</string>
</tuple>
</list>
</value>
</item>
...
...
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/Order_getAribaAttachmentUrl.py
View file @
004d5200
return
context
.
Order_getRelatedOrderRequestValue
().
getAribaAttachmentUrl
()
order_request
=
context
.
Order_getRelatedOrderRequestValue
()
if
order_request
is
not
None
:
return
order_request
.
getAribaAttachmentUrl
()
return
''
bt5/erp5_interface_cxml/SkinTemplateItem/portal_skins/erp5_interface_cxml/SaleOrder_checkCxmlOrderRequestConsistency.py
View file @
004d5200
...
...
@@ -199,8 +199,12 @@ def compare(document, property_dict, context_key='', context_title='', parent_co
compare
(
category_value
,
value
,
context_key
=
key
,
parent_context_title
=
context_title
)
else
:
our_value
=
document
.
getProperty
(
key
)
if
key
==
"quantity_unit"
and
value
==
"unit/piece"
and
our_value
==
"unit/set"
:
value
=
"unit/set"
if
(
our_value
or
''
)
!=
value
:
if
set_property
:
if
key
==
"quantity_unit"
and
document
.
getResourceValue
()
is
None
:
continue
document
.
setProperty
(
key
,
value
)
else
:
title
=
translate
(
property_title_dict
.
get
(
key
,
key
))
...
...
bt5/erp5_interface_cxml/WorkflowTemplateItem/portal_workflow/cxml_validation_workflow/script_CxmlOrderRequest_doValidateAction.py
View file @
004d5200
...
...
@@ -47,4 +47,9 @@ else:
error
=
translate
(
"Could not validate. The OrderID of the Follow-Up Sale Order does not match."
%
sale_order
.
getTitle
())
raise
ValidationFailed
(
Message
(
'erp5_ui'
,
error
))
sale_order_value
.
setVersion
(
context
.
getVersion
())
# Attach PDF to Sale Order
for
pdf
in
context
.
getFollowUpRelatedValueList
(
portal_type
=
"PDF"
,
checked_permission
=
"Modify portal content"
):
pdf
.
setFollowUpValueList
(
pdf
.
getFollowUpValueList
()
+
[
sale_order_value
])
context
.
validate
()
bt5/erp5_interface_cxml/WorkflowTemplateItem/portal_workflow/cxml_validation_workflow/state_draft.xml
View file @
004d5200
...
...
@@ -18,11 +18,19 @@
<tuple>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_delete
</string>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_delete_action
</string>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_invalidate
</string>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_invalidate_action
</string>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_validate
</string>
<string>
destination/portal_workflow/cxml_validation_workflow/transition_validate_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Default state of the document
</string>
</value>
...
...
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