Commit dbc347b0 authored by Klaus Wölfel's avatar Klaus Wölfel

erp5_interface_cxml: .

parent b9911437
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/CxmlDocument_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>9.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Documents</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_viewDocumentList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
##############################################################################
#
# Copyright (c) 2024 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from erp5.component.document.CxmlDocument import CxmlDocument
from AccessControl import ClassSecurityInfo
from DateTime import DateTime
from Products.ERP5Type.Permissions import AccessContentsInformation
class CxmlConfirmationRequest(CxmlDocument):
meta_type = 'ERP5 Cxml Confirmation Request'
portal_type = 'Cxml Confirmation Request'
security = ClassSecurityInfo()
security.declareObjectProtected(AccessContentsInformation)
security.declareProtected(AccessContentsInformation, 'getConfirmId')
def getConfirmId(self):
"""
Get the ConfirmID from the ConfirmationHeader in cXML
"""
et = self.getElementTree()
if et is None:
return
confirmation_request_header = et.xpath('/cXML/Request/ConfirmationRequest/ConfirmationHeader')[0]
return confirmation_request_header.get('confirmID')
security.declareProtected(AccessContentsInformation, 'getLinePropertyDict')
def getLinePropertyDict(self):
"""
Get Sale Order Line properties and values from ConfirmationRequest cXML
"""
#self.validateXML()
et = self.getElementTree()
line_dict = {}
for confirmation_item in et.xpath('/cXML/Request/ConfirmationRequest/ConfirmationItem'):
property_dict = {}
property_dict['int_index'] = int_index = int(confirmation_item.get("lineNumber"))
confirmation_status = confirmation_item.find("ConfirmationStatus")
start_date = confirmation_status.get("shipmentDate")
if start_date is not None:
property_dict['start_date'] = DateTime(start_date)
stop_date = confirmation_status.get("deliveryDate")
if stop_date is not None:
property_dict['stop_date'] = DateTime(stop_date)
property_dict['quantity'] = float(confirmation_status.get("quantity"))
line_dict[int_index] = property_dict
return line_dict
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CxmlConfirmationRequest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.CxmlConfirmationRequest</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<allowed_content_type_list>
<portal_type id="Cxml Document Module">
<item>Cxml Confirmation Request</item>
<item>Cxml Document</item>
<item>Cxml Order Request</item>
</portal_type>
......
<base_category_list>
<portal_type id="Cxml Confirmation Request">
<item>causality</item>
<item>follow_up</item>
<item>predecessor</item>
<item>successor</item>
</portal_type>
<portal_type id="Cxml Document">
<item>causality</item>
<item>follow_up</item>
......
<property_sheet_list>
<portal_type id="Cxml Confirmation Request">
<item>Reference</item>
<item>Task</item>
<item>TextDocument</item>
</portal_type>
<portal_type id="Cxml Connector">
<item>Login</item>
<item>Reference</item>
......@@ -15,6 +20,7 @@
<portal_type id="Cxml Order Request">
<item>Reference</item>
<item>TextDocument</item>
<item>WoelfelCxmlOrderRequest</item>
</portal_type>
<portal_type id="Network Id">
<item>Reference</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>content_icon</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addXMLObject</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Cxml Confirmation Request</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
</item>
<item>
<key> <string>searchable_text_property_id</string> </key>
<value>
<tuple>
<string>title</string>
<string>description</string>
<string>reference</string>
<string>short_title</string>
</tuple>
</value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>CxmlConfirmationRequest</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<workflow_chain>
<chain>
<type>Cxml Confirmation Request</type>
<workflow>edit_workflow</workflow>
</chain>
<chain>
<type>Cxml Connector</type>
<workflow>edit_workflow, validation_workflow</workflow>
......
......@@ -67,7 +67,7 @@ property_title_dict = {
"": "",
"address_extension": "Address Extension",
"city": "City",
"corporate_name": "Corportate Name",
"corporate_name": "Corporate Name",
"destination_section": "Client",
"destination_section_address": "Invoicing Address",
"destination": "Recipient or Beneficiary",
......@@ -102,7 +102,7 @@ def findCreateOrganisation(organisation_dict, create=False):
address_key_tuple = ("address_extension", "street_address", "city", "zip_code", "region_title")
def findCreateAddress(category, address_dict, organisation, create=False):
wrong_value_list = []
for address_value in organisation.objectValues(portal_type="Address"):
for address_value in organisation.objectValues(portal_type="Address", checked_permission="View"):
# the address is correct if all values are same as in the order request.
# only for the addressID (int_index), we overwrite with the value from cXML
for key, value in address_dict.items():
......@@ -201,6 +201,8 @@ def compare(document, property_dict, context_key='', context_title='', parent_co
our_value = document.getProperty(key)
if key == "quantity_unit" and value == "unit/piece" and our_value == "unit/set":
value = "unit/set"
if document.getPortalType() == "Organisation" and key == "corporate_name" and value == "Vestas Northern EuropeA/S":
value = "Vestas Northern Europe A/S"
if (our_value or '') != value:
if set_property:
if key == "quantity_unit" and document.getResourceValue() is None:
......
from collections import OrderedDict
item_dict = OrderedDict()
for line in context.objectValues(sort_on=[('int_index', 'ascending')],
portal_type='Sale Order Line',
checked_permission='View'):
if line.SaleOrderLine_isConfirmationItem():
line_list = item_dict.setdefault(line.getIntIndex(), [])
line_list.append(line.getObject())
return [{'index': k,
'order_quantity': v[0].SaleOrderLine_getCxmlOrderQuantity(),
'line_list': v} for k, v in item_dict.items()]
<?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>SaleOrder_getConfirmationItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -35,10 +35,11 @@
<OrderReference tal:attributes="orderDate python:here.getOrderDate().ISO8601(); orderID here/getDestinationReference">
<DocumentReference tal:attributes="payloadID here/Order_getPayloadId"></DocumentReference>
</OrderReference>
<span tal:omit-tag="" tal:repeat="line python:here.objectValues(sort_on=[('int_index', 'ascending')], portal_type='Sale Order Line')">
<ConfirmationItem tal:condition="line/SaleOrderLine_isConfirmationItem" tal:attributes="lineNumber line/getIntIndex; quantity line/SaleOrderLine_getCxmlOrderQuantity">
<span tal:omit-tag="" tal:repeat="item here/SaleOrder_getConfirmationItemList">
<ConfirmationItem tal:attributes="lineNumber item/index; quantity item/order_quantity">
<UnitOfMeasure>EA</UnitOfMeasure>
<ConfirmationStatus tal:condition="python: line.getQuantity()-line.SaleOrderLine_getCxmlOrderQuantity() == 0" tal:attributes="shipmentDate python:line.getStartDate().ISO8601(); deliveryDate python:line.getStopDate().ISO8601(); quantity line/getQuantity" type="accept">
<span tal:omit-tag="" tal:repeat="line item/line_list">
<ConfirmationStatus tal:attributes="deliveryDate python:line.getStopDate().ISO8601(); quantity line/getQuantity" type="accept">
<UnitOfMeasure tal:content="line/Movement_getUnitOfMeasure"></UnitOfMeasure>
<ItemIn tal:condition="python: False" tal:attributes="lineNumber line/getIntIndex; quantity line/getQuantity">
<ItemID>
......@@ -59,9 +60,7 @@
</ItemDetail>
</ItemIn>
</ConfirmationStatus>
<ConfirmationStatus tal:condition="python: line.SaleOrderLine_getCxmlOrderQuantity() - line.getQuantity()" tal:attributes="quantity python:line.SaleOrderLine_getCxmlOrderQuantity() - line.getQuantity()" type="reject">
<UnitOfMeasure tal:content="line/Movement_getUnitOfMeasure"></UnitOfMeasure>
</ConfirmationStatus>
</span>
</ConfirmationItem>
</span>
</ConfirmationRequest>
......
......@@ -33,10 +33,11 @@ else:
if sale_order_value.getDestinationReference() != context.getReference():
error = translate("Cannot FollowUp to Sale Order %s because it is related to another Order Request and the OrderID does not match." %sale_order.getTitle())
raise ValidationFailed(Message('erp5_ui', error))
if portal.portal_workflow.isTransitionPossible(sale_order_value, 'replan'):
sale_order_value.replan()
clone_order = sale_order_value.Order_cloneAndUpdateVersion()
previous_order_request.setFollowUpValue(clone_order)
if portal.portal_workflow.isTransitionPossible(sale_order_value, 'update'):
sale_order_value.update()
sale_order_value.setVersion(context.getVersion())
break
else:
# we did not find another order request, so no need to clone
......@@ -46,6 +47,8 @@ else:
elif sale_order_value.getDestinationReference() != context.getReference():
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))
if sale_order_value.getSimulationState() == 'confirmed':
sale_order_value.update()
sale_order_value.setVersion(context.getVersion())
# Attach PDF to Sale Order
......
Cxml Confirmation Request | view
Cxml Connector | view
Cxml Document Module | view
Cxml Document | view
Cxml Multipart Document Module | view
Cxml Multipart Document | view
Cxml Order Request | document_list
Cxml Order Request | view
Network Id | view
Organisation | cxml
......
document.erp5.CxmlConnector
document.erp5.CxmlDocument
document.erp5.CxmlMultipartDocument
document.erp5.CxmlConfirmationRequest
document.erp5.CxmlOrderRequest
\ No newline at end of file
Cxml Document Module | Cxml Confirmation Request
Cxml Document Module | Cxml Document
Cxml Document Module | Cxml Order Request
Cxml Multipart Document Module | Cxml Multipart Document
......
Cxml Confirmation Request | causality
Cxml Confirmation Request | follow_up
Cxml Confirmation Request | predecessor
Cxml Confirmation Request | successor
Cxml Document Module | business_application
Cxml Document | causality
Cxml Document | follow_up
......
Cxml Confirmation Request
Cxml Connector
Cxml Document
Cxml Document Module
......
Cxml Confirmation Request | Reference
Cxml Confirmation Request | Task
Cxml Confirmation Request | TextDocument
Cxml Connector | Login
Cxml Connector | Reference
Cxml Connector | Url
......@@ -7,6 +10,7 @@ Cxml Document | TextDocument
Cxml Multipart Document | Data
Cxml Order Request | Reference
Cxml Order Request | TextDocument
Cxml Order Request | WoelfelCxmlOrderRequest
Network Id | Reference
Organisation | CxmlNode
Sale Invoice Transaction | CxmlOrder
......
Cxml Confirmation Request | edit_workflow
Cxml Connector | edit_workflow
Cxml Connector | validation_workflow
Cxml Document | edit_workflow
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment