diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index c739bdf18d4..8241811e1ca 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1525,6 +1525,8 @@ class AccountInvoice(models.Model): 'url': self.get_portal_url(), } + def _get_intrastat_country_id(self): + return self.partner_id.country_id.id class AccountInvoiceLine(models.Model): _name = "account.invoice.line" diff --git a/addons/sale/models/account_invoice.py b/addons/sale/models/account_invoice.py index 295f53db3a5..bcbd21350fc 100644 --- a/addons/sale/models/account_invoice.py +++ b/addons/sale/models/account_invoice.py @@ -81,6 +81,11 @@ class AccountInvoice(models.Model): def _get_refund_common_fields(self): return super(AccountInvoice, self)._get_refund_common_fields() + ['team_id', 'partner_shipping_id'] + def _get_intrastat_country_id(self): + if self.type in ['out_invoice', 'out_refund']: + return self.partner_shipping_id.country_id.id or super(AccountInvoice, self)._get_intrastat_country_id() + return super(AccountInvoice, self)._get_intrastat_country_id() + class AccountInvoiceLine(models.Model): _inherit = 'account.invoice.line'