OCA / multi-company

GNU Affero General Public License v3.0
97 stars 279 forks source link

[16.0] account_invoice_inter_company : partner_shipping_id propagation leads to wrong fiscal position #651

Open metaminux opened 2 weeks ago

metaminux commented 2 weeks ago

I think we shouldn't propagate the partner_shipping_address field in supplier invoices

Module

account_invoice_inter_company

Describe the bug

As of 44a3178f365bc9ec6148f4eeec4c88af23d8be36 the partner_shipping_id field is propagated from the customer invoice of company A to the inter company Vendor Bill of company B But shipping address is used in invoices to compute the fiscal position (see https://github.com/odoo/odoo/blob/54f84aedf8da14f4f3298febc44c4fec103e3a47/addons/account/models/account_move.py#L773-L781), leading to wrong tax rates

To Reproduce

16.0:

Steps to reproduce the behavior:

  1. Create a brand new database with demo data
  2. Install module account_invoice_inter_company
  3. Install module sale to be sure partner_shipping_id field exists in invoice
  4. Install module l10n_fr with demo data (to get a french company with fiscal position and taxes already set)
  5. Select the main company YourCompany
  6. Create a customer invoice with FR Company as customer
  7. Add a product (for example E-COM07, qty = 1, unit price $320)
  8. Confirm the invoice

Current behavior The generated inter company Supplier Bill from YourCompany (San Francisco) in FR Company company has a fiscal position EU privé (which is wrongly computed from FR Company partner in partner_shipping_id field in the FR Company company context) This leads to a VAT 20% rate and a total amount of $384 USD A message is created in the chatter to inform that the total amount is different from the original inter company invoice...

Expected behavior The generated inter company Supplier Bill from YourCompany (San Francisco) in FR Company company has a fiscal position Import/Export Hors Europe + DOM-TOM (which is the right position for exportation from US to France) This leads to a Export 0% rate and a total amount of $320 USD

Additional context

metaminux commented 2 weeks ago

cc @Kev-Roche