Repository navigation
[18.0][FIX] account_invoice_import: apply the fiscal position Odoo would determine for the partner - #1302
Conversation
|
Hi @alexis-via, |
2103d7d to
e83c606
Compare
There was a problem hiding this comment.
Hello,
Thank you for this change. I agree it is really needed because in previous code, if partner.property_account_position_id is empty, the fiscal position of the invoice can be set wrongly.
A call to the native method res_partner._get_fiscal_position should indeed replace the partner.property_account_position_id
I have a few suggestions to let the code simple to read
e83c606 to
58f7e36
Compare
58f7e36 to
b2ab15f
Compare
arnaudlayec
left a comment
There was a problem hiding this comment.
All good for me, I think it is very helpful
|
@alexis-via could you maybe give this PR a second review? |
|
@OCA/edi-maintainers can someon merge this one? |
b2ab15f to
12e3696
Compare
|
I did a rebase and added some tests. @OCA/edi-maintainers @alexis-via could this please merged? |
12e3696 to
34de857
Compare
When building invoice lines, the import wizard mapped accounts and taxes using only
partner.property_account_position_id. That differs from what Odoo does when aninvoice is created manually:
set but one applies automatically (by country, country group, VAT requirement, …),
the lines kept the unmapped account and taxes, while the move header still got the
fiscal position through its own compute. The header and the lines no longer agreed.
property_account_position_idis company-dependent and wasread in the environment's current company, not the company the invoice is imported
into. With multiple companies, the fiscal position of the wrong company could be
applied, or none at all.
Changes
_get_fiscal_position()calls the standardaccount.fiscal.position._get_fiscal_position(partner, delivery)in the importcompany (
import_config["company"]). It respects the fiscal position set on thepartner and the auto-apply rules, just like
account.move._map_account_and_taxes()holds the mapping that used to be duplicatedin
_prepare_line_vals_1line()and_prepare_line_vals_nline(). Both methods nowcall it, and other modules can override it.