[IMP] account_edi_ubl_cii: l10n_fr requires delivery address if present

Update the logic so that if there is a delivery address present
we add it in EDI.

This is the behavior of ubl2 which was erased in ubl3 overwrite.

task-id: 3098587
[community](https://github.com/odoo/odoo/pull/110118)

closes odoo/odoo#110118

Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
det
2023-01-18 17:38:01 +01:00
parent 36d7d4b956
commit c95011ce6d
9 changed files with 106 additions and 13 deletions
@@ -151,9 +151,6 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel):
and supplier.country_id.code in economic_area
and supplier.country_id != customer.country_id)
if not intracom_delivery:
return []
# [BR-IC-12]-In an Invoice with a VAT breakdown (BG-23) where the VAT category code (BT-118) is
# "Intra-community supply" the Deliver to country code (BT-80) shall not be blank.
@@ -161,17 +158,17 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel):
# "Intra-community supply" the Actual delivery date (BT-72) or the Invoicing period (BG-14)
# shall not be blank.
if 'partner_shipping_id' in invoice._fields:
partner_shipping = invoice.partner_shipping_id
else:
partner_shipping = customer
if intracom_delivery:
partner_shipping = invoice.partner_shipping_id or customer
return [{
'actual_delivery_date': invoice.invoice_date,
'delivery_location_vals': {
'delivery_address_vals': self._get_partner_address_vals(partner_shipping),
},
}]
return [{
'actual_delivery_date': invoice.invoice_date,
'delivery_location_vals': {
'delivery_address_vals': self._get_partner_address_vals(partner_shipping),
},
}]
return super()._get_delivery_vals_list(invoice)
def _get_partner_address_vals(self, partner):
# EXTENDS account.edi.xml.ubl_21
@@ -73,6 +73,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Parliament Dr</cbc:StreetName>
<cbc:CityName>Canberra</cbc:CityName>
<cbc:PostalZone>2600</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>AU</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>INV/2017/00001</cbc:PaymentID>
@@ -72,6 +72,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Parliament Dr</cbc:StreetName>
<cbc:CityName>Canberra</cbc:CityName>
<cbc:PostalZone>2600</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>AU</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>RINV/2017/00001</cbc:PaymentID>
@@ -71,6 +71,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Rue des Bourlottes 9</cbc:StreetName>
<cbc:CityName>Ramillies</cbc:CityName>
<cbc:PostalZone>1367</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>+++000/0000/26268+++</cbc:PaymentID>
@@ -70,6 +70,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Rue des Bourlottes 9</cbc:StreetName>
<cbc:CityName>Ramillies</cbc:CityName>
<cbc:PostalZone>1367</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>RINV/2017/01/0001</cbc:PaymentID>
@@ -79,6 +79,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Europaweg, 2</cbc:StreetName>
<cbc:CityName>Rotterdam</cbc:CityName>
<cbc:PostalZone>1200</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NL</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
<cbc:PaymentID>INV/2017/00002</cbc:PaymentID>
@@ -78,6 +78,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Europaweg, 2</cbc:StreetName>
<cbc:CityName>Rotterdam</cbc:CityName>
<cbc:PostalZone>1200</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NL</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
<cbc:PaymentID>RINV/2017/00001</cbc:PaymentID>
@@ -73,6 +73,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Europa-Park-Straße 2</cbc:StreetName>
<cbc:CityName>Rust</cbc:CityName>
<cbc:PostalZone>77977</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>INV/2017/01/0002</cbc:PaymentID>
@@ -72,6 +72,18 @@
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:Delivery>
<cac:DeliveryLocation>
<cac:Address>
<cbc:StreetName>Europa-Park-Straße 2</cbc:StreetName>
<cbc:CityName>Rust</cbc:CityName>
<cbc:PostalZone>77977</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:Address>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>RINV/2017/01/0001</cbc:PaymentID>