[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:
committed by
Nicolas Martinelli
parent
66c716d781
commit
b9473c09c6
@@ -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"
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user