Skip to content

account_invoice_import: company default tax silently overrides the taxes parsed from the file #1393

Open

Description

@risto42

In wizard/account_invoice_import.py (16.0, checked on 76c2cc0):

  • _last_update_import_config() (l.544-550) injects company.account_purchase_tax_id into import_config["taxes"] when the partner has no import config;
  • in the line loop (l.455-460), the config taxes take precedence over bdio._match_taxes() on the parsed file taxes (if not taxes: only) — so with a company default set, the file's taxes are never looked at.

Consequence: a multi-rate invoice (e.g. 5.5% + 20%) is imported with the default tax on every line; the total VAT is then "forced" to match, silently producing a wrong per-rate breakdown. Worst case for a French construction buyer: a subcontractor invoice under domestic reverse charge (AE, 0%) imported with the default 20% VAT.

Suggested fix (~4 lines): don't apply the company default when parsed_inv["lines"] carry taxes, restoring the intended priority product > partner config > file > company default. Caveat for the implementer: the "Cleanup" block further down accesses import_config["taxes"] without .get(), so the key must still be set.

Activity

  1. akarazhev commented on Sep 24, 2026

    @akarazhev

    This is addressed on 18.0 by #1407 (merged 9 September), and #1409 backports it to 16.0: taxes parsed from the file are now matched first, then the product's, and the import config — where the company default ends up — only as a last resort.

    One difference from the order you suggested: file taxes now also take precedence over product taxes, not only over the company default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions