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

erp5_interface_cxml: .

parent 3c48ed49
...@@ -139,7 +139,7 @@ class CxmlOrderRequest(CxmlDocument): ...@@ -139,7 +139,7 @@ class CxmlOrderRequest(CxmlDocument):
buyer_vat_id = ''.join(order_request_header.xpath('//Extrinsic[@name="buyerVatID"]/text()')) 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} property_dict['destination_section'] = {'portal_type': 'Organisation', 'corporate_name': sold_to_name or bill_to_name}
if buyer_vat_id: 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['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')) property_dict['order_date'] = DateTime(order_request_header.get('orderDate'))
ship_to = order_request_header.find('ShipTo') ship_to = order_request_header.find('ShipTo')
...@@ -175,10 +175,10 @@ class CxmlOrderRequest(CxmlDocument): ...@@ -175,10 +175,10 @@ class CxmlOrderRequest(CxmlDocument):
short_name = description.find('ShortName') short_name = description.find('ShortName')
if short_name is not None: if short_name is not None:
property_dict['title'] = s(short_name.text) property_dict['title'] = s(short_name.text)
property_dict['description'] = s(short_name.tail) #property_dict['description'] = s(short_name.tail)
else: else:
property_dict['title'] = s(description.text) 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') unit_of_measure_text = get_text(item_detail, 'UnitOfMeasure')
assert unit_of_measure_text in ("EA", "PC") assert unit_of_measure_text in ("EA", "PC")
property_dict['quantity_unit'] = "unit/piece" property_dict['quantity_unit'] = "unit/piece"
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
<item>Version</item> <item>Version</item>
</portal_type> </portal_type>
<portal_type id="Sale Packing List"> <portal_type id="Sale Packing List">
<item>CxmlDelivery</item>
<item>CxmlOrder</item>
<item>CxmlOrderConstraint</item> <item>CxmlOrderConstraint</item>
</portal_type> </portal_type>
</property_sheet_list> </property_sheet_list>
\ No newline at end of file
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</item> </item>
<item> <item>
<key> <string>type_class</string> </key> <key> <string>type_class</string> </key>
<value> <string>XMLObject</string> </value> <value> <string>Coordinate</string> </value>
</item> </item>
<item> <item>
<key> <string>type_interface</string> </key> <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 @@ ...@@ -146,7 +146,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>follow_up_title</string> <string>follow_up_title</string>
<string>Sale Order</string> <string>Follow Up</string>
</tuple> </tuple>
<tuple> <tuple>
<string>from</string> <string>from</string>
......
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item> <item>
<key> <string>_bind_names</string> </key> <key> <string>_bind_names</string> </key>
<value> <value>
...@@ -20,6 +24,18 @@ ...@@ -20,6 +24,18 @@
<key> <string>_asgns</string> </key> <key> <string>_asgns</string> </key>
<value> <value>
<dictionary> <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> <item>
<key> <string>name_subpath</string> </key> <key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value> <value> <string>traverse_subpath</string> </value>
...@@ -33,24 +49,12 @@ ...@@ -33,24 +49,12 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>_params</string> </key>
<value> <string>text/xml</string> </value> <value> <string></string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SaleInvoiceTranaction_getInvoiceDetailRequest</string> </value> <value> <string>NetworkId_asText</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>
</item> </item>
</dictionary> </dictionary>
</pickle> </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'?> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.060/InvoiceDetail.dtd"> <!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: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(); cxml_url python:'%s/ERP5Site_cml' %here.getPortalObject().absolute_url();
source here/getSourceValue; source here/getSourceValue;
source_address python:here.Delivery_getSourceAddressText()[0]; source_address python:here.Delivery_getSourceAddressText()[0];
...@@ -42,8 +42,21 @@ ...@@ -42,8 +42,21 @@
<InvoiceDetailHeaderIndicator></InvoiceDetailHeaderIndicator> <InvoiceDetailHeaderIndicator></InvoiceDetailHeaderIndicator>
<InvoiceDetailLineIndicator></InvoiceDetailLineIndicator> <InvoiceDetailLineIndicator></InvoiceDetailLineIndicator>
<InvoicePartner> <InvoicePartner>
<Contact tal:attributes="addressID destination_section_address/getReference" role="billTo"> <Contact role="remitTo">
<Name tal:attributes="xml:lang language" tal:content="destination_section/Entity_getTitle"></Name> <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> <PostalAddress>
<Street tal:content="destination_section_address/getStreetAddress"></Street> <Street tal:content="destination_section_address/getStreetAddress"></Street>
<City tal:content="destination_section_address/getCity"></City> <City tal:content="destination_section_address/getCity"></City>
...@@ -61,19 +74,19 @@ ...@@ -61,19 +74,19 @@
<City tal:content="source_section/getDefaultAddressCity"></City> <City tal:content="source_section/getDefaultAddressCity"></City>
<State tal:omit-tag=""></State> <State tal:omit-tag=""></State>
<PostalCode tal:content="source_section/getDefaultAddressZipCode"></PostalCode> <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> </PostalAddress>
</Contact> </Contact>
</InvoicePartner> </InvoicePartner>
<InvoicePartner> <InvoicePartner>
<Contact tal:attributes="addressID destination_section_address/getReference" role="soldTo"> <Contact role="billFrom">
<Name tal:attributes="xml:lang language" tal:content="destination_section/Entity_getTitle"></Name> <Name tal:attributes="xml:lang language" tal:content="source_section/Entity_getTitle"></Name>
<PostalAddress> <PostalAddress>
<Street tal:content="destination_section_address/getStreetAddress"></Street> <Street tal:content="source_section/getDefaultAddressStreetAddress"></Street>
<City tal:content="destination_section_address/getCity"></City> <City tal:content="source_section/getDefaultAddressCity"></City>
<State tal:omit-tag=""></State> <State tal:omit-tag=""></State>
<PostalCode tal:content="destination_section_address/getZipCode"></PostalCode> <PostalCode tal:content="source_section/getDefaultAddressZipCode"></PostalCode>
<Country tal:attributes="isoCountryCode destination_section_address/getRegionReference" tal:content="destination_section_address/getRegionTitle"></Country> <Country tal:attributes="isoCountryCode source_section_address/getRegionReference" tal:content="python: source_section_address.getRegionId().capitalize()"></Country>
</PostalAddress> </PostalAddress>
</Contact> </Contact>
</InvoicePartner> </InvoicePartner>
...@@ -89,7 +102,7 @@ ...@@ -89,7 +102,7 @@
<Country tal:attributes="isoCountryCode source_address/getRegionReference" tal:content="source_address/getRegionTitle"></Country> <Country tal:attributes="isoCountryCode source_address/getRegionReference" tal:content="source_address/getRegionTitle"></Country>
</PostalAddress> </PostalAddress>
</Contact> </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> <Name tal:attributes="xml:lang language" tal:content="destination/Entity_getTitle"></Name>
<PostalAddress> <PostalAddress>
<Street tal:content="destination_address/getStreetAddress"></Street> <Street tal:content="destination_address/getStreetAddress"></Street>
...@@ -100,10 +113,20 @@ ...@@ -100,10 +113,20 @@
</PostalAddress> </PostalAddress>
</Contact> </Contact>
</InvoiceDetailShipping> </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="buyerVatID" tal:content="destination_section/getVatCode"></Extrinsic>
<Extrinsic name="supplierVatID" tal:content="here/SaleInvoice_getSourceSectionVatCode"></Extrinsic> <Extrinsic name="supplierVatID" tal:content="here/SaleInvoice_getSourceSectionVatCode"></Extrinsic>
<Extrinsic name="invoiceSourceDocument">PurchaseOrder</Extrinsic> <Extrinsic name="invoiceSourceDocument">PurchaseOrder</Extrinsic>
<Extrinsic name="invoiceSubmissionMethod">cXML</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> </InvoiceDetailRequestHeader>
<InvoiceDetailOrder> <InvoiceDetailOrder>
<InvoiceDetailOrderInfo> <InvoiceDetailOrderInfo>
...@@ -124,7 +147,7 @@ ...@@ -124,7 +147,7 @@
<SupplierPartID tal:content="line/DeliveryLine_getSupplierPartIdIfProvidedInOrderRequest"></SupplierPartID> <SupplierPartID tal:content="line/DeliveryLine_getSupplierPartIdIfProvidedInOrderRequest"></SupplierPartID>
<BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID> <BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID>
</ItemID> </ItemID>
<Description tal:content="line/getDescription" xml:lang="de-DE"></Description> <Description tal:content="line/getTitle" tal:attributes="xml:lang language"></Description>
</InvoiceDetailItemReference> </InvoiceDetailItemReference>
<SubtotalAmount> <SubtotalAmount>
<Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money> <Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money>
...@@ -135,6 +158,7 @@ ...@@ -135,6 +158,7 @@
<NetAmount> <NetAmount>
<Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money> <Money tal:attributes="currency line/getPriceCurrencyId" tal:content="line/getTotalPrice"></Money>
</NetAmount> </NetAmount>
<Comments tal:content="line/getDescription" tal:attributes="xml:lang language"></Comments>
</InvoiceDetailItem> </InvoiceDetailItem>
</span> </span>
</InvoiceDetailOrder> </InvoiceDetailOrder>
...@@ -153,7 +177,7 @@ ...@@ -153,7 +177,7 @@
<TaxAmount> <TaxAmount>
<Money tal:attributes="currency here/getPriceCurrencyId" tal:content="line_tax/total_price"></Money> <Money tal:attributes="currency here/getPriceCurrencyId" tal:content="line_tax/total_price"></Money>
</TaxAmount> </TaxAmount>
<Description xml:lang = "en-US"></Description> <Description tal:attributes="xml:lang language" tal:content="python: line_tax['description_text']"></Description>
</TaxDetail> </TaxDetail>
</Tax> </Tax>
</span> </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_quantity=0
total_price=0 total_price=0
description_text=''
for tax in line_tax: for tax in line_tax:
total_quantity+=tax["total_quantity"] total_quantity+=tax["total_quantity"]
total_price+=tax["total_price"] total_price+=tax["total_price"]
base_price=tax["base_price"] base_price=tax["base_price"]
description_text=tax["description_text"] or description_text
return [{"total_quantity":total_quantity, return [{"total_quantity":total_quantity,
"total_price":total_price, "total_price":total_price,
"base_price":base_price}] "base_price":base_price,
"description_text":description_text}]
...@@ -77,7 +77,7 @@ property_title_dict = { ...@@ -77,7 +77,7 @@ property_title_dict = {
"zip_code": "Postal Code", "zip_code": "Postal Code",
"default_sale_supply_line_destination_reference": "Customer Reference", "default_sale_supply_line_destination_reference": "Customer Reference",
"resource": "Product or Service", "resource": "Product or Service",
"vat_code": "VAT Code", "destination_section_vat_code": "Client VAT Code",
"payment_condition_hs_payment_condition": "Payment Condition", "payment_condition_hs_payment_condition": "Payment Condition",
} }
...@@ -161,7 +161,7 @@ def compare(document, property_dict, context_key='', context_title='', parent_co ...@@ -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 # necessary in fixit case because we need to already know about the
# organisation before we can find or create its address # organisation before we can find or create its address
for key, value in sorted(property_dict.items()): 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(): if context.getCxmlChanges():
continue continue
if context.getPortalType() in ("Sale Packing List", "Sale Invoice Transaction") and key in ('order_date', 'int_index'): 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'?> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.060/Fulfill.dtd"> <!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: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(); cxml_url python:'%s/ERP5Site_cml' %here.getPortalObject().absolute_url();
source here/getSourceValue; source here/getSourceValue;
source_address python:here.Delivery_getSourceAddressText()[0]; source_address python:here.Delivery_getSourceAddressText()[0];
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<TransportInformation tal:omit-tag=""> <TransportInformation tal:omit-tag="">
<ShippingContractNumber tal:omit-tag=""></ShippingContractNumber> <ShippingContractNumber tal:omit-tag=""></ShippingContractNumber>
<ShippingInstructions tal:omit-tag=""> <ShippingInstructions tal:omit-tag="">
<Description tal:omit-tag="" xml:lang="de-DE"></Description> <Description tal:omit-tag="" tal:attributes="xml:lang language"></Description>
</ShippingInstructions> </ShippingInstructions>
</TransportInformation> </TransportInformation>
</ShipControl> </ShipControl>
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<DocumentReference tal:attributes="payloadID order/Order_getPayloadId"></DocumentReference> <DocumentReference tal:attributes="payloadID order/Order_getPayloadId"></DocumentReference>
</OrderReference> </OrderReference>
<span tal:omit-tag="" tal:repeat="line python:here.objectValues(sort_on=[('int_index', 'ascending')], portal_type='Sale Packing List Line')"> <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> <ItemID>
<SupplierPartID tal:content="line/getResourceReference"></SupplierPartID> <SupplierPartID tal:content="line/getResourceReference"></SupplierPartID>
<BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID> <BuyerPartID tal:content="line/DeliveryLine_getResourceDestinationReference"></BuyerPartID>
...@@ -112,10 +112,11 @@ ...@@ -112,10 +112,11 @@
<UnitPrice> <UnitPrice>
<Money tal:attributes="currency line/getPriceCurrencyTitle" tal:content="line/getPrice"></Money> <Money tal:attributes="currency line/getPriceCurrencyTitle" tal:content="line/getPrice"></Money>
</UnitPrice> </UnitPrice>
<Description tal:content="line/getDescription" xml:lang="de-DE"></Description> <Description tal:content="line/getTitle" tal:attributes="xml:lang language"></Description>
</ShipNoticeItemDetail> </ShipNoticeItemDetail>
<UnitOfMeasure tal:content="line/Movement_getUnitOfMeasure"></UnitOfMeasure> <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> <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> </ShipNoticeItem>
</span> </span>
</ShipNoticePortion> </ShipNoticePortion>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <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> </tuple>
</value> </value>
</item> </item>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <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> </tuple>
</value> </value>
</item> </item>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <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> </tuple>
</value> </value>
</item> </item>
......
...@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated(): ...@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated():
return return
text_content = context.SaleInvoiceTransaction_getInvoiceDetailRequest().encode('utf-8') text_content = context.SaleInvoiceTransaction_getInvoiceDetailRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale() 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": ...@@ -6,7 +6,13 @@ if not context.Base_isCxmlRelated(): #or str(context.getVersion()) != "1":
return return
text_content = context.SaleOrder_getConfirmationRequest().encode('utf-8') text_content = context.SaleOrder_getConfirmationRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale() 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, text_content,
portal_type="Cxml Confirmation Request", portal_type="Cxml Confirmation Request",
follow_up=context.getRelativeUrl() follow_up=context.getRelativeUrl()
......
...@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated(): ...@@ -5,4 +5,10 @@ if not context.Base_isCxmlRelated():
return return
text_content = context.SalePackingList_getShipNoticeRequest().encode('utf-8') text_content = context.SalePackingList_getShipNoticeRequest().encode('utf-8')
connector = context.Base_getCxmlConnectorValueForSale() 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 ...@@ -13,4 +13,6 @@ Sale Invoice Transaction | CxmlOrderConstraint
Sale Order | CxmlOrder Sale Order | CxmlOrder
Sale Order | CxmlOrderConstraint Sale Order | CxmlOrderConstraint
Sale Order | Version Sale Order | Version
Sale Packing List | CxmlDelivery
Sale Packing List | CxmlOrder
Sale Packing List | CxmlOrderConstraint 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