Commit 928b2449 authored by Klaus Wölfel's avatar Klaus Wölfel

erp5_interface_cxml: .

parent 3c48ed49
......@@ -139,7 +139,7 @@ class CxmlOrderRequest(CxmlDocument):
buyer_vat_id = ''.join(order_request_header.xpath('//Extrinsic[@name="buyerVatID"]/text()'))
property_dict['destination_section'] = {'portal_type': 'Organisation', 'corporate_name': sold_to_name or bill_to_name}
if buyer_vat_id:
property_dict['destination_section']['vat_code'] = buyer_vat_id
property_dict['destination_section_vat_code'] = buyer_vat_id
property_dict['destination_section_address'] = self._getAddressPropertyDict(address, corporate_name=sold_to_name or bill_to_name, name_on_address=bill_to_name)
property_dict['order_date'] = DateTime(order_request_header.get('orderDate'))
ship_to = order_request_header.find('ShipTo')
......@@ -175,10 +175,10 @@ class CxmlOrderRequest(CxmlDocument):
short_name = description.find('ShortName')
if short_name is not None:
property_dict['title'] = s(short_name.text)
property_dict['description'] = s(short_name.tail)
#property_dict['description'] = s(short_name.tail)
else:
property_dict['title'] = s(description.text)
property_dict['description'] = s(description.text)
#property_dict['description'] = s(description.text)
unit_of_measure_text = get_text(item_detail, 'UnitOfMeasure')
assert unit_of_measure_text in ("EA", "PC")
property_dict['quantity_unit'] = "unit/piece"
......
......@@ -31,6 +31,8 @@
<item>Version</item>
</portal_type>
<portal_type id="Sale Packing List">
<item>CxmlDelivery</item>
<item>CxmlOrder</item>
<item>CxmlOrderConstraint</item>
</portal_type>
</property_sheet_list>
\ No newline at end of file
......@@ -74,7 +74,7 @@
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>XMLObject</string> </value>
<value> <string>Coordinate</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
......
language = context.getLanguage()
if not language:
return "en-US"
if language == "en":
return "en-US"
if language == "de":
return "de-DE"
<?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_getCxmlLanguageCode</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -146,7 +146,7 @@
</tuple>
<tuple>
<string>follow_up_title</string>
<string>Sale Order</string>
<string>Follow Up</string>
</tuple>
<tuple>
<string>from</string>
......
......@@ -2,10 +2,14 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<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>
......@@ -20,6 +24,18 @@
<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>
......@@ -33,24 +49,12 @@
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/xml</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTranaction_getInvoiceDetailRequest</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
<value> <string>NetworkId_asText</string> </value>
</item>
</dictionary>
</pickle>
......
<?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>Organisation_getCxmlTitle</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>SaleInvoiceTransaction_getAribaNetworkPaymentTermsExplanation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document_list = context.getFollowUpRelatedValueList(portal_type="Cxml Document")
for start_date, cxml_document in reversed(sorted([(x.getStartDate(), x) for x in document_list])):
if cxml_document.getDocumentType() == "InvoiceDetailRequest":
response = cxml_document.getSuccessorValue()
if response is not None:
# Check if the response to the ShipNoticeRequest has a
# a status code 2xx. Only then we had a successfull
# ConfirmationRequest
if response.getStatusCode().startswith("2"):
return "Invoice accepted"
return "Invoice not accepted"
return "Invoice sent but no reply"
return "Invoice not sent"
<?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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_getCxmlStatusText</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.060/InvoiceDetail.dtd">
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
tal:define="language string:de-DE;
tal:define="language here/Base_getCxmlLanguageCode;
cxml_url python:'%s/ERP5Site_cml' %here.getPortalObject().absolute_url();
source here/getSourceValue;
source_address python:here.Delivery_getSourceAddressText()[0];
......@@ -42,8 +42,21 @@
<InvoiceDetailHeaderIndicator></InvoiceDetailHeaderIndicator>
<InvoiceDetailLineIndicator></InvoiceDetailLineIndicator>
<InvoicePartner>
<Contact tal:attributes="addressID destination_section_address/getReference" role="billTo">
<Name tal:attributes="xml:lang language" tal:content="destination_section/Entity_getTitle"></Name>
<Contact role="remitTo">
<Name tal:attributes="xml:lang language" tal:content="source_section/Entity_getTitle"></Name>
<PostalAddress>
<Street tal:content="source_section/getDefaultAddressStreetAddress"></Street>
<City tal:content="source_section/getDefaultAddressCity"></City>
<State tal:omit-tag=""></State>
<PostalCode tal:content="source_section/getDefaultAddressZipCode"></PostalCode>
<Country tal:attributes="isoCountryCode source_section_address/getRegionReference" tal:content="python: source_section_address.getRegionId().capitalize()"></Country>
</PostalAddress>
</Contact>
<IdReference domain="supplierTaxID" tal:attributes="identifier here/SaleInvoiceTransaction_getSupplierTaxId"></IdReference>
</InvoicePartner>
<InvoicePartner>
<Contact tal:attributes="addressID destination_section_address/getIntIndex" role="billTo">
<Name tal:attributes="xml:lang language" tal:content="here/Base_getBillToName"></Name>
<PostalAddress>
<Street tal:content="destination_section_address/getStreetAddress"></Street>
<City tal:content="destination_section_address/getCity"></City>
......@@ -61,19 +74,19 @@
<City tal:content="source_section/getDefaultAddressCity"></City>
<State tal:omit-tag=""></State>
<PostalCode tal:content="source_section/getDefaultAddressZipCode"></PostalCode>
<Country tal:attributes="isoCountryCode source_section_address/getRegionReference" tal:content="source_section_address/getRegionTitle"></Country>
<Country tal:attributes="isoCountryCode source_section_address/getRegionReference" tal:content="python: source_section_address.getRegionId().capitalize()"></Country>
</PostalAddress>
</Contact>
</InvoicePartner>
<InvoicePartner>
<Contact tal:attributes="addressID destination_section_address/getReference" role="soldTo">
<Name tal:attributes="xml:lang language" tal:content="destination_section/Entity_getTitle"></Name>
<Contact role="billFrom">
<Name tal:attributes="xml:lang language" tal:content="source_section/Entity_getTitle"></Name>
<PostalAddress>
<Street tal:content="destination_section_address/getStreetAddress"></Street>
<City tal:content="destination_section_address/getCity"></City>
<Street tal:content="source_section/getDefaultAddressStreetAddress"></Street>
<City tal:content="source_section/getDefaultAddressCity"></City>
<State tal:omit-tag=""></State>
<PostalCode tal:content="destination_section_address/getZipCode"></PostalCode>
<Country tal:attributes="isoCountryCode destination_section_address/getRegionReference" tal:content="destination_section_address/getRegionTitle"></Country>
<PostalCode tal:content="source_section/getDefaultAddressZipCode"></PostalCode>
<Country tal:attributes="isoCountryCode source_section_address/getRegionReference" tal:content="python: source_section_address.getRegionId().capitalize()"></Country>
</PostalAddress>
</Contact>
</InvoicePartner>
......@@ -89,7 +102,7 @@
<Country tal:attributes="isoCountryCode source_address/getRegionReference" tal:content="source_address/getRegionTitle"></Country>
</PostalAddress>
</Contact>
<Contact role="shipTo">
<Contact tal:attributes="addressID destination_address/getIntIndex" role="shipTo">
<Name tal:attributes="xml:lang language" tal:content="destination/Entity_getTitle"></Name>
<PostalAddress>
<Street tal:content="destination_address/getStreetAddress"></Street>
......@@ -100,10 +113,20 @@
</PostalAddress>
</Contact>
</InvoiceDetailShipping>
<PaymentTerm payInNumberOfDays="60">
<Discount>
<DiscountPercent percent="0.000"/>
</Discount>
</PaymentTerm>
<IdReference domain="supplierReference" tal:attributes="identifier here/SaleInvoiceTransaction_getSupplierReference"/>
<Extrinsic name="AribaNetwork.PaymentTermsExplanation" tal:content="here/SaleInvoiceTransaction_getAribaNetworkPaymentTermsExplanation"></Extrinsic>
<Extrinsic name="buyerVatID" tal:content="destination_section/getVatCode"></Extrinsic>
<Extrinsic name="supplierVatID" tal:content="here/SaleInvoice_getSourceSectionVatCode"></Extrinsic>
<Extrinsic name="invoiceSourceDocument">PurchaseOrder</Extrinsic>
<Extrinsic name="invoiceSubmissionMethod">cXML</Extrinsic>
<Extrinsic name="paymentNote" tal:content="here/SaleInvoiceTransaction_getPaymentNote"></Extrinsic>
<Extrinsic name="supplierCommercialIdentifier" tal:content="python: here.getSourceSectionValue().getCorporateRegistrationCode()"></Extrinsic>
<Extrinsic name="supplierCommercialCredentials" tal:content="here/SaleInvoiceTransaction_getSupplierCommercialCredentials"></Extrinsic>
</InvoiceDetailRequestHeader>
<InvoiceDetailOrder>
<InvoiceDetailOrderInfo>
......@@ -124,7 +147,7 @@
<SupplierPartID tal:content="line/DeliveryLine_getSupplierPartIdIfProvidedInOrderRequest"></SupplierPartID>
<BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID>
</ItemID>
<Description tal:content="line/getDescription" xml:lang="de-DE"></Description>
<Description tal:content="line/getTitle" tal:attributes="xml:lang language"></Description>
</InvoiceDetailItemReference>
<SubtotalAmount>
<Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money>
......@@ -135,6 +158,7 @@
<NetAmount>
<Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money>
</NetAmount>
<Comments tal:content="line/getDescription" tal:attributes="xml:lang language"></Comments>
</InvoiceDetailItem>
</span>
</InvoiceDetailOrder>
......@@ -153,7 +177,7 @@
<TaxAmount>
<Money tal:attributes="currency here/getPriceCurrencyId" tal:content="line_tax/total_price"></Money>
</TaxAmount>
<Description xml:lang = "en-US"></Description>
<Description tal:attributes="xml:lang language" tal:content="python: line_tax['description_text']"></Description>
</TaxDetail>
</Tax>
</span>
......
<?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>SaleInvoiceTransaction_getPaymentNote</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>SaleInvoiceTransaction_getSupplierCommercialCredentials</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>SaleInvoiceTransaction_getSupplierReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>SaleInvoiceTransaction_getSupplierTaxId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
total_quantity=0
total_price=0
description_text=''
for tax in line_tax:
total_quantity+=tax["total_quantity"]
total_price+=tax["total_price"]
base_price=tax["base_price"]
description_text=tax["description_text"] or description_text
return [{"total_quantity":total_quantity,
"total_price":total_price,
"base_price":base_price}]
"base_price":base_price,
"description_text":description_text}]
......@@ -77,7 +77,7 @@ property_title_dict = {
"zip_code": "Postal Code",
"default_sale_supply_line_destination_reference": "Customer Reference",
"resource": "Product or Service",
"vat_code": "VAT Code",
"destination_section_vat_code": "Client VAT Code",
"payment_condition_hs_payment_condition": "Payment Condition",
}
......@@ -161,7 +161,7 @@ def compare(document, property_dict, context_key='', context_title='', parent_co
# necessary in fixit case because we need to already know about the
# organisation before we can find or create its address
for key, value in sorted(property_dict.items()):
if document.getPortalType() == "Sale Order Line" and key == "quantity":
if document.getPortalType() in ("Sale Order Line", "Sale Packing List Line") and key == "quantity":
if context.getCxmlChanges():
continue
if context.getPortalType() in ("Sale Packing List", "Sale Invoice Transaction") and key in ('order_date', 'int_index'):
......
document_list = context.getFollowUpRelatedValueList(portal_type="Cxml Confirmation Request")
for start_date, cxml_document in reversed(sorted([(x.getStartDate(), x) for x in document_list])):
if cxml_document.getDocumentType() == "ConfirmationRequest":
response = cxml_document.getSuccessorValue()
if response is not None:
# Check if the response to the ShipNoticeRequest has a
# a status code 2xx. Only then we had a successfull
# ConfirmationRequest
if response.getStatusCode().startswith("2"):
return "Confirmation accepted"
return "Confirmation not accepted"
return "Confirmation sent but no reply"
return "Confirmation not sent"
<?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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_getCxmlStatusText</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document_list = context.getFollowUpRelatedValueList(portal_type="Cxml Document")
for start_date, cxml_document in reversed(sorted([(x.getStartDate(), x) for x in document_list])):
if cxml_document.getDocumentType() == "ShipNoticeRequest":
response = cxml_document.getSuccessorValue()
if response is not None:
# Check if the response to the ShipNoticeRequest has a
# a status code 2xx. Only then we had a successfull
# ConfirmationRequest
if response.getStatusCode().startswith("2"):
return "ASN accepted"
return "ASN not accepted"
return "ASN sent but no reply"
return "ASN not sent"
<?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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_getCxmlStatusText</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.060/Fulfill.dtd">
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
tal:define="language string:de-DE;
tal:define="language here/Base_getCxmlLanguageCode;
cxml_url python:'%s/ERP5Site_cml' %here.getPortalObject().absolute_url();
source here/getSourceValue;
source_address python:here.Delivery_getSourceAddressText()[0];
......@@ -94,7 +94,7 @@
<TransportInformation tal:omit-tag="">
<ShippingContractNumber tal:omit-tag=""></ShippingContractNumber>
<ShippingInstructions tal:omit-tag="">
<Description tal:omit-tag="" xml:lang="de-DE"></Description>
<Description tal:omit-tag="" tal:attributes="xml:lang language"></Description>
</ShippingInstructions>
</TransportInformation>
</ShipControl>
......@@ -103,7 +103,7 @@
<DocumentReference tal:attributes="payloadID order/Order_getPayloadId"></DocumentReference>
</OrderReference>
<span tal:omit-tag="" tal:repeat="line python:here.objectValues(sort_on=[('int_index', 'ascending')], portal_type='Sale Packing List Line')">
<ShipNoticeItem tal:attributes="shipNoticeLineNumber line/getIntIndex; quantity line/getQuantity; lineNumber line/DeliveryLine_getOrderLineIntIndex">
<ShipNoticeItem tal:condition="line/getQuantity" tal:attributes="shipNoticeLineNumber line/getIntIndex; quantity line/getQuantity; lineNumber line/DeliveryLine_getOrderLineIntIndex">
<ItemID>
<SupplierPartID tal:content="line/getResourceReference"></SupplierPartID>
<BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID>
......@@ -112,10 +112,11 @@
<UnitPrice>
<Money tal:attributes="currency line/getPriceCurrencyTitle" tal:content="line/getPrice"></Money>
</UnitPrice>
<Description tal:content="line/getDescription" xml:lang="de-DE"></Description>
<Description tal:content="line/getTitle" tal:attributes="xml:lang language"></Description>
</ShipNoticeItemDetail>
<UnitOfMeasure tal:content="line/Movement_getUnitOfMeasure"></UnitOfMeasure>
<AssetInfo tal:repeat="item_title python:line.getAggregateTitleList(portal_type='Item')" tal:attributes="serialNumber item_title" tagNumber=""></AssetInfo>
<Comments tal:content="line/getDescription" tal:attributes="xml:lang language"></Comments>
</ShipNoticeItem>
</span>
</ShipNoticePortion>
......
......@@ -10,7 +10,7 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>activate_script/portal_workflow/cxml_interaction_workflow/script_SaleInvoiceTransaction_sendInvoiceDetailRequest</string>
<string>after_script/portal_workflow/cxml_interaction_workflow/script_SaleInvoiceTransaction_sendInvoiceDetailRequest</string>
</tuple>
</value>
</item>
......
......@@ -10,7 +10,7 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>activate_script/portal_workflow/cxml_interaction_workflow/script_SaleOrder_sendOrderConfirmationRequest</string>
<string>after_script/portal_workflow/cxml_interaction_workflow/script_SaleOrder_sendOrderConfirmationRequest</string>
</tuple>
</value>
</item>
......
......@@ -10,7 +10,7 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>activate_script/portal_workflow/cxml_interaction_workflow/script_SalePackingList_sendShipNoticeRequest</string>
<string>after_script/portal_workflow/cxml_interaction_workflow/script_SalePackingList_sendShipNoticeRequest</string>
</tuple>
</value>
</item>
......
......@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated():
return
text_content = context.SaleInvoiceTransaction_getInvoiceDetailRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale()
connector.sendOutgoingRequest(text_content, follow_up=context.getRelativeUrl())
# calling sendOutgoingRequest should be done in an activity
# which NEVER retries.
connector.activate(
activity='SQLQueue',
conflict_retry=False,
max_retry=0,
).sendOutgoingRequest(text_content, follow_up=context.getRelativeUrl())
......@@ -6,7 +6,13 @@ if not context.Base_isCxmlRelated(): #or str(context.getVersion()) != "1":
return
text_content = context.SaleOrder_getConfirmationRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale()
connector.sendOutgoingRequest(
# calling sendOutgoingRequest should be done in an activity
# which NEVER retries.
connector.activate(
activity='SQLQueue',
conflict_retry=False,
max_retry=0,
).sendOutgoingRequest(
text_content,
portal_type="Cxml Confirmation Request",
follow_up=context.getRelativeUrl()
......
......@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated():
return
text_content = context.SalePackingList_getShipNoticeRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale()
connector.sendOutgoingRequest(text_content, follow_up=context.getRelativeUrl())
# calling sendOutgoingRequest should be done in an activity
# which NEVER retries.
connector.activate(
activity='SQLQueue',
conflict_retry=False,
max_retry=0,
).sendOutgoingRequest(text_content, follow_up=context.getRelativeUrl())
......@@ -13,4 +13,6 @@ Sale Invoice Transaction | CxmlOrderConstraint
Sale Order | CxmlOrder
Sale Order | CxmlOrderConstraint
Sale Order | Version
Sale Packing List | CxmlDelivery
Sale Packing List | CxmlOrder
Sale Packing List | CxmlOrderConstraint
\ No newline at end of file
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