OCA/edi

commercial_partner_id in _ubl_add_party

Closed this issue · 3 comments

Hi @alexis-via and @astirpe,

I have a note about the use of the commercial_partner_id field of the actual partner in the _ubl_add_party of the base_ubl module.

I have seen that in the _ubl_add_party the partner from whom the information is taken is the commercial_partner_id. This means that, when adding the required AccountingCustomerParty, the used address will be from the parent partner. This leads to the following UBL structure:

<cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PartyName>
        <cbc:Name>Parent Company Name</cbc:Name>
      </cac:PartyName>
      <cac:Language>
        <cbc:Name>English (US)</cbc:Name>
        <cbc:LocaleCode>en_US</cbc:LocaleCode>
      </cac:Language>
      <cac:PostalAddress>
        <cbc:StreetName>Parent Street</cbc:StreetName>
        <cbc:CityName>Parent City</cbc:CityName>
        <cbc:PostalZone>Parent Postal Code</cbc:PostalZone>
        <cbc:CountrySubentity>Parent State</cbc:CountrySubentity>
        <cbc:CountrySubentityCode>Parent State Code</cbc:CountrySubentityCode>
        <cac:Country>
          <cbc:IdentificationCode>Parent Country ID</cbc:IdentificationCode>
          <cbc:Name>Parent Country</cbc:Name>
        </cac:Country>
      </cac:PostalAddress>
      <cac:Contact>
        <cbc:Name>Invoice Address</cbc:Name>
      </cac:Contact>
    </cac:Party>
    <cac:AccountingContact>
      <cbc:Name>Invoice Address</cbc:Name>
    </cac:AccountingContact>
  </cac:AccountingCustomerParty>

where the parent address is shown and it is afterwards indicated in the Contact field that it is an Invoice Address. However, in my view, it would be preferable to indicate the actual invoice address of the invoice partner rather than using the commercial_partner_id to access the parent one.

The same happens if there is the need to add a PayeeParty and you want to set the invoice address of your company instead of the parent one. The current implementation would add a payee whose address would be the company's parent address. This can be avoided by simply not using the commercial_parent_id field and using the parent field that is passed as argument.

What's your view?

Could you check please? @alexis-via @astirpe

The above does not seem to be the issue, also when you add a contact you get the following when you validate the XML:

[BR-07]-An Invoice shall contain the Buyer name (BT-44).Test:(cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName) !=''

This whole entry seems to be missing from UBL

Used this site to test the ubl:
https://www.itb.ec.europa.eu/invoice/upload

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.