diff --git a/intrastat_product/models/account_invoice.py b/intrastat_product/models/account_invoice.py index b62d4db..a51281e 100644 --- a/intrastat_product/models/account_invoice.py +++ b/intrastat_product/models/account_invoice.py @@ -43,6 +43,8 @@ class AccountInvoice(models.Model): src_dest_country_id = fields.Many2one( 'res.country', string='Origin/Destination Country', ondelete='restrict') + src_dest_country_code = fields.Char( + related='company_id.country_id.code') src_dest_region_id = fields.Many2one( 'intrastat.region', string='Origin/Destination Region', default=lambda self: self._default_src_dest_region_id(), diff --git a/intrastat_product/models/res_company.py b/intrastat_product/models/res_company.py index 2995486..f69d6c0 100644 --- a/intrastat_product/models/res_company.py +++ b/intrastat_product/models/res_company.py @@ -46,6 +46,8 @@ class ResCompany(models.Model): intrastat = fields.Char( string='Intrastat Declaration', store=True, readonly=True, compute='_compute_intrastat') + country_code = fields.Char( + related='country_id.code') intrastat_region_id = fields.Many2one( 'intrastat.region', string='Default Intrastat Region') diff --git a/intrastat_product/models/stock_warehouse.py b/intrastat_product/models/stock_warehouse.py index 90509b8..1ff96c3 100644 --- a/intrastat_product/models/stock_warehouse.py +++ b/intrastat_product/models/stock_warehouse.py @@ -29,6 +29,8 @@ class StockWarehouse(models.Model): region_id = fields.Many2one( 'intrastat.region', string='Intrastat region') + country_code = fields.Char( + related='company_id.country_id.code') class StockLocation(models.Model): diff --git a/intrastat_product/views/account_invoice.xml b/intrastat_product/views/account_invoice.xml index 26332cd..4b65b68 100644 --- a/intrastat_product/views/account_invoice.xml +++ b/intrastat_product/views/account_invoice.xml @@ -18,7 +18,9 @@ attrs="{'invisible': [('intrastat', '!=', 'extended')]}" widget="selection"/> - + + @@ -42,7 +44,9 @@ attrs="{'invisible': [('intrastat', '!=', 'extended')]}" widget="selection"/> - + + diff --git a/intrastat_product/views/res_company.xml b/intrastat_product/views/res_company.xml index 2d61383..40c5b7f 100644 --- a/intrastat_product/views/res_company.xml +++ b/intrastat_product/views/res_company.xml @@ -15,7 +15,9 @@ - + + diff --git a/intrastat_product/views/stock_warehouse.xml b/intrastat_product/views/stock_warehouse.xml index 163cf0f..71f33fa 100644 --- a/intrastat_product/views/stock_warehouse.xml +++ b/intrastat_product/views/stock_warehouse.xml @@ -8,7 +8,8 @@ - + +