Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBL for communication with suppliers #143

Closed
jbaudoux opened this issue Oct 22, 2019 · 2 comments
Closed

UBL for communication with suppliers #143

jbaudoux opened this issue Oct 22, 2019 · 2 comments
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@jbaudoux
Copy link
Contributor

jbaudoux commented Oct 22, 2019

Specifications for implementation of EDI in logistics for exchanges with suppliers.

Order

The purchase order (Sales Order at supplier side) creation is performed 2 steps. First step is the creation of the order.

The format is compliant with UBL 2.2. PEPPOL specialization is not used but it respects the PEPPOL clarifications given on their website on the usage and values.

Document source :
UBL 2.2.
http://docs.oasis-open.org/ubl/UBL-2.2.html

http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/UBL-Order-2.2.html
http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/UBL-OrderResponse-2.2.html

https://docs.peppol.eu/poacc/upgrade-3/profiles/3-order-only/ (documentation)
https://docs.peppol.eu/poacc/upgrade-3/syntax/Order/ (Order description)

PEPPOL:
https://docs.peppol.eu/poacc/upgrade-3/profiles/28-ordering/
https://peppol.eu/wp-content/uploads/2017/12/PEPPOL_Policy-for-use-of-identifiers-300-11_certificates.pdf
https://docs.peppol.eu/poacc/billing/3.0/codelist/UNECERec20/

Check compliancy here : https://peppol.helger.com/public/menuitem-validation-bis2

Clarifications

OrderResponseCode

  • ​Order is acknowledge
    OrderResponseCode value is AP.
  • Order completely rejected
    OrderResponseCode value is RE.
    The Order is completely rejected. No lines should be sent (they won’t be processed). The purchase order is canceled at the buyer party and no more message can follow. End of the process.
    The Note node can be filled with some details
  • Order completely accepted
    OrderResponseCode value is AP.
    The Order is completely accepted without amendment. No lines should be sent (they won’t be processed).
  • Order accepted with amendments
    OrderResponseCode value is CA.
    The Order is accepted with amendment on line level. All lines (Order/OrderLine/LineItem in xml file) must be sent. That means accepted lines and amended lines.

The Note node can be filled with some details

LineStatusCode

For each LineItem, a status code is returned in the xml element Order/OrderLine//LineItem/LineStatusCode:

  • LineStatusCode is 7 : The order line is refused. The quantity = 0, and there is a note with the error
  • LineStatusCode is 3 : The order line is accepted with change. In case some quantity cannot be processed.
  • LineStatusCode is 5 : The order line is accepted without changes.
  • LineStatusCode is 1 : The order line has been added. This value is not supported.
  • LineStatusCode is 42 : The order line has already been delivered. This value is not supported.

Details about codes are available here : https://docs.peppol.eu/poacc/upgrade-3/codelist/UNCL1229/

​MaximumBackorderQuantity

If the element Order/OrderLine/LineItem/MaximumBackorderQuantity is used, Odoo will create a back order corresponding to the remain quantity to deliver. The back order will contain all products for the same supplier and same PO.
The quantity specified in the element MaximumBackorderQuantity represents the confirmed quantity that will be delivered at a later unknown date. For example, if ordered quantity is 5 but only 3 will be delivered, the Quantity=3 and the MaximumBackorderQuantity=2.
So the total confirmed quantity is Quantity + MaximumBackorderQuantity
The quantity that is not confirmed will be canceled at the Buyer Party and is not expected to be received. In this case, for example, if ordered quantity is 5 but only 3 will be delivered, the Quantity=3 and the MaximumBackorderQuantity=0.​
If the total quantity is equal to the ordered quantity, LineStatusCode=5
If the total quantity is less than the ordered quantity, LineStatusCode=3

Examples

Order

<Order xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2"xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:UBLVersionID>2.2</cbc:UBLVersionID>
  <cbc:ID>PO03907</cbc:ID>
  <cbc:IssueDate>2019-06-13</cbc:IssueDate>
  <cbc:IssueTime>12:30:00</cbc:IssueTime>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cac:BuyerCustomerParty>
    <cac:Party>
      <cac:PartyIdentification>
       <cbc:ID schemeID="BE;VAT">BE0421812344</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>My company</cbc:Name>
      </cac:PartyName>
    </cac:Party>
  </cac:BuyerCustomerParty>
  <cac:SellerSupplierParty>
    <cac:Party>
      <cac:PartyIdentification>
       <cbc:ID schemeID="BE;VAT">BE0421845677</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>My supplier</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>Rue du Moulin</cbc:StreetName>
        <cbc:BuildingNumber>20</cbc:BuildingNumber>
        <cbc:CityName>Louvain-La-Neuve</cbc:CityName>
        <cbc:PostalZone>1348</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>BE</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
    </cac:Party>
  </cac:SellerSupplierParty>
  <cac:Delivery>
    <cac:DeliveryLocation>
      <cac:Address>
        <cbc:StreetName>Place Cathedrale</cbc:StreetName>
        <cbc:BuildingNumber>30</cbc:BuildingNumber>
        <cbc:CityName>Liège</cbc:CityName>
        <cbc:PostalZone>4000</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>BE</cbc:IdentificationCode>
        </cac:Country>
      </cac:Address>
    </cac:DeliveryLocation>
  </cac:Delivery>
<cac:OrderLine>
  <cac:LineItem>
    <cbc:ID>196471</cbc:ID>
    <cbc:Quantity unitCode="PCE">300</cbc:Quantity>
    <cbc:LineExtensionAmount currencyID="EUR">6194.64</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Description>Beers</cbc:Description>
      <cac:SellersItemIdentification>
        <cbc:ID>10012542</cbc:ID>
      </cac:SellersItemIdentification>
      <cac:BuyersItemIdentification>
        <cbc:ID>10323322</cbc:ID>
      </cac:BuyersItemIdentification>
    </cac:Item>
  </cac:LineItem>
</cac:OrderLine>
<cac:OrderLine>
...
</cac:OrderLine>
</Order>

OrderResponse

<OrderResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2"xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:UBLVersionID>2.2</cbc:UBLVersionID>
  <cbc:ID>PO03907</cbc:ID>
  <cbc:OrderReference>PO03907</cbc:OrderReference>
  <cbc:IssueDate>2019-06-13</cbc:IssueDate>
  <cbc:IssueTime>12:30:00</cbc:IssueTime>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cac:BuyerCustomerParty>
    <cac:Party>
      <cac:PartyIdentification>
       <cbc:ID schemeID="BE;VAT">BE0421812344</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>Belux</cbc:Name>
      </cac:PartyName>
    </cac:Party>
  </cac:BuyerCustomerParty>
  <cac:SellerSupplierParty>
    <cac:Party>
      <cac:PartyName>
        <cbc:Name>My Supplier</cbc:Name>
      </cac:PartyName>
      <cac:PartyIdentification>
       <cbc:ID schemeID="BE;VAT">BE0421845677</cbc:ID>
      </cac:PartyIdentification>
      <cac:PostalAddress>
        <cbc:StreetName>street</cbc:StreetName>
        <cbc:BuildingNumber>20</cbc:BuildingNumber>
        <cbc:CityName>City</cbc:CityName>
        <cbc:PostalZone>1152</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>BE</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
    </cac:Party>
  </cac:SellerSupplierParty>
  <cbc:OrderResponseCode>CA</cbc:OrderResponseCode>
  <cbc:Note>any error messsage</cbc:Note>
  <cac:OrderLine>
    <cac:LineItem>
      <cbc:ID>196471</cbc:ID>
      <cbc:Quantity unitCode="PCE">300</cbc:Quantity>
      <cbc:LineStatusCode>confirmed</cbc:LineStatusCode>
    </cac:LineItem>
  </cac:OrderLine>
  <cac:OrderLine>
    <cac:LineItem>
      <cbc:ID>196472</cbc:ID>
      <cbc:Quantity unitCode="PCE">6</cbc:Quantity>
      <cbc:LineStatusCode>confirmed</cbc:LineStatusCode>
    </cac:LineItem>
  </cac:OrderLine>
  <cac:OrderLine>
  ...
  </cac:OrderLine>
</OrderResponse>

Delivery

The delivery process support the full process of receiving goods into a warehouse.

The supplier prepare the delivery and send a despach advice (called delivery order in Odoo) to the supplier. The file is transfered by the seller party, twice :

  • when the delivery is planned and
  • when it is delivered.
    There is one file per delivery.

The despach advice describes how the goods are packed and delivered. A delivery is taken to be a number of items that are despatched as a single consignment to a single delivery address.
It contains the quantity of goods shipped and what is outstanding.

Despach advice are identified with a unique reference and a delivery order number. The same delivery order number could be used for all disptach advice related to an order. For example in case of outstanding quantities and multiple deliveries.

During the reception of the products by the buyer party, the operator cannot enter into Odoo quantities greater than those of the order. In this case, the additional products, will require the creation of an additional order (purchase order) in Odoo. This purchase order will not be sent automatically to the supplier.
That means that Odoo must allow the configuration of the automatic sending of the order when confirming a purchase order.
Products will be received separately. The supplier must not send a despach advice for these products. The supplier will produce a separate invoice for these items.

The format is compliant with UBL 2.2. PEPPOL specialization is not used but it respects the PEPPOL clarifications given on their website on the usage and values.

Document source :
UBL 2.2.
http://docs.oasis-open.org/ubl/UBL-2.2.html
http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/UBL-DespatchAdvice-2.2.html
https://docs.peppol.eu/poacc/upgrade-3/profiles/30-despatchadvice/ (documentation)

PEPPOL:
https://docs.peppol.eu/poacc/upgrade-3/profiles/30-despatchadvice/
https://docs.peppol.eu/poacc/billing/3.0/codelist/UNECERec20/

Check compliancy here : https://peppol.helger.com/public/menuitem-validation-bis2

Clarifications

DespatchAdvice Type Code

The DespatchAdvice is used for notifying the planned delivery date and for notifying the effective delivery. This is can be identified with the content of DespatchAdviceTypeCode:
scheduled
delivered

Order Reference

Used to provide a reference to the purchase order on which the Despatch Advice is based. There may be multiple Despatch Advices to cover one purchase order.

Usually, each Despatch Advice relates to one purchase order. The reference to Order Line-ID is required in the UBL syntax.

It is also possible to refer to more than one order in one single despatch advice. In this case there must not be an order reference on header level.

Example header level

<cac:OrderReference>
        <cbc:ID>4321</cbc:ID>
</cac:OrderReference>

Example 1 of Line level

<cac:OrderLineReference>
  <cbc:LineID>1</cbc:LineID>
  <cac:OrderReference>
    <cbc:ID>879865</cbc:ID>
  </cac:OrderReference>
</cac:OrderLineReference>

Outstanding quantity

The outstanding element on the Despatch line is both used to signal the outstanding quantity and to inform about delivery discrepancies.
In this case Odoo will create a back order corresponding to the remaining quantity to deliver or use an existing back order if it is related to the same supplier and same PO.
The handling of “The outstanding quantity which will never be delivered” is done like this: The amount that is declared in the element OutstandingQuantity is equivalent to the amount that will be delivered in a later Despatch. This implicitly means that the missing items that are NOT declared in the OutstandingQuantity can’t or will not be delivered.

####​ Batch/Lot numbers, Expiry Date and Best Before Date
The Batch number (Lot number) applies to all items in the despatch line.
Expiry date is used for products with a lot number (typically medical).
Best before date is used for products without lot number (typically food).

Example 1:

<cac:ItemInstance>
  <cac:LotIdentification>
    <cbc:LotNumberID>898A129</cbc:LotNumberID>
    <cbc:ExpiryDate>2025-07-01</cbc:ExpiryDate>
  </cac:LotIdentification>
</cac:ItemInstance>

Example 2:

<cac:ItemInstance>
  <cbc:BestBeforeDate>2025-04-15</cbc:BestBeforeDate>
</cac:ItemInstance>

When multiple lots of a same product are delivered, those are put in separate DespatchLine. In case of outstanding quantity, one of the line will contain the outstanding quantity. If the planned lot is not known, the outstanding quantity can be put in another DespatchLine without lot.

Example

<DespatchAdvice xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2">
  <cbc:UBLVersionID>2.2</cbc:UBLVersionID>
  <cbc:ID>565899</cbc:ID>
  <cbc:IssueDate>2019-06-20</cbc:IssueDate>
  <cbc:DespatchAdviceTypeCode>scheduled/delivered</cbc:DespatchAdviceTypeCode>
  <cac:OrderReference>
    <cbc:ID>PO03907</cbc:ID>
    <cbc:SalesOrderID>CON0095678</cbc:SalesOrderID>
  </cac:OrderReference>
  <cac:DespatchSupplierParty>
    <cac:Party>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>XLETZR BELGIUM</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:PartyIdentification>
        <cbc:ID schemeID="BE;VAT">BE040153456</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
      <cbc:Name>My Supplier</cbc:Name>
    </cac:PartyName>
    <cac:PostalAddress>
      <cbc:StreetName>Street</cbc:StreetName>
      <cbc:BuildingNumber>20</cbc:BuildingNumber>
      <cbc:CityName>City</cbc:CityName>
      <cbc:PostalZone>2352</cbc:PostalZone>
      <cac:Country>
        <cbc:IdentificationCode>BE</cbc:IdentificationCode>
      </cac:Country>
     </cac:PostalAddress>
    </cac:Party>
  </cac:DespatchSupplierParty>
  <cac:DeliveryCustomerParty>
    <cac:Party>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Alcyon Belux</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:PartyIdentification>
         <cbc:ID>ALCYONID</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>Belux</cbc:Name>
      </cac:PartyName>
    </cac:Party>
  </cac:DeliveryCustomerParty>
  <cac:Shipment>
    <cbc:ID>OUT/009523</cbc:ID>
    <cac:Delivery>
      <cbc:EstimatedDeliveryDate>2019-07-02</cbc:EstimatedDeliveryDate>
    </cac:Delivery>
  </cac:Shipment>
  <cac:DespatchLine>
    <cbc:ID>1315123</cbc:ID>
    <cbc:DeliveredQuantity unitCode="PCE">200</cbc:DeliveredQuantity>
    <cbc:OutstandingQuantity unitCode="PCE">100</cbc:OutstandingQuantity>
    <cac:OrderLineReference>
      <cbc:LineID>196471</cbc:LineID>
       <cac:OrderReference>
       <cbc:ID>PO03907</cbc:ID>
       <cbc:SalesOrderID>CON0095678</cbc:SalesOrderID>
    </cac:OrderReference>
    </cac:OrderLineReference>
    <cac:Item>
      <cbc:Name>SIMPARICA 80MG 20,1/40KG 3CP</cbc:Name>
      <cac:SellersItemIdentification>
        <cbc:ID>10012542</cbc:ID>
      </cac:SellersItemIdentification>
      <cac:ItemInstance>
        <cbc:BestBeforeDate>2025-04-15</cbc:BestBeforeDate>
      </cac:ItemInstance>
    </cac:Item>
  </cac:DespatchLine>
</DespatchAdvice>
@jbaudoux
Copy link
Contributor Author

I have updated the issue according to the implementation of lmignon. I have added additional clarification and updated the examples.

@github-actions
Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

No branches or pull requests

1 participant