Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FIX] intrastat_product: Set the correct country code when the country of the delivery address is different (and to be consistent with the src_dest_country_id field) #216

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions intrastat_product/models/intrastat_product_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ def _gather_invoices(self, notedict):
domain = self._prepare_invoice_domain()
order = "journal_id, name"
invoices = self.env["account.move"].search(domain, order=order)
partner_model = self.env["res.partner"]

for invoice in invoices:

Expand Down Expand Up @@ -692,8 +693,8 @@ def _gather_invoices(self, notedict):
# When the country is the same as the company's country must be skipped.
if partner_country == self.company_id.country_id:
continue
partner_country_code = (
invoice.commercial_partner_id._get_intrastat_country_code()
partner_country_code = partner_model._get_intrastat_country_code(
country=partner_country, state=invoice.partner_shipping_id.state_id
)

if inv_intrastat_line:
Expand Down
1 change: 1 addition & 0 deletions intrastat_product/tests/test_brexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_brexit_sale(self):
inv_out_xi = self.inv_obj.with_context(default_move_type="out_invoice").create(
{
"partner_id": self.partner_xi.id,
"partner_shipping_id": self.partner_xi.id,
"fiscal_position_id": self.position.id,
}
)
Expand Down