[FIX] account, sale: Intrastat delivery address

Forward-port of fix 034e1d37d9
Since there is not link module between `sale` and `account_intrastat`,
we use a common method in `account.invoice`.

opw-1878590
This commit is contained in:
Nicolas Martinelli
2018-09-19 08:07:50 +02:00
committed by Nicolas Martinelli
parent 66c716d781
commit b9473c09c6
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -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"
+5
View File
@@ -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'