From 4aac593f944d9cfa261c64588584e0b4ff5c87c8 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Tue, 25 Jul 2017 17:54:04 +0200 Subject: [PATCH 1/5] region attrs invisible --- intrastat_product/models/account_invoice.py | 2 ++ intrastat_product/models/res_company.py | 2 ++ intrastat_product/models/stock_warehouse.py | 2 ++ intrastat_product/views/account_invoice.xml | 8 ++++++-- intrastat_product/views/res_company.xml | 4 +++- intrastat_product/views/stock_warehouse.xml | 3 ++- 6 files changed, 17 insertions(+), 4 deletions(-) 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 @@ - + + From 0dd91318efbe4b770eccd4ca6dfd7b4f0d60b1d6 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Wed, 26 Jul 2017 08:47:37 +0200 Subject: [PATCH 2/5] fix supplier invoice view --- intrastat_product/views/account_invoice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrastat_product/views/account_invoice.xml b/intrastat_product/views/account_invoice.xml index 4b65b68..fae7050 100644 --- a/intrastat_product/views/account_invoice.xml +++ b/intrastat_product/views/account_invoice.xml @@ -46,7 +46,7 @@ + attrs="{'invisible': [('src_dest_country_code', 'not in', ['BE'])]}"/> From a5a92b826708171c4953ba214ae73d2bd4d462ab Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Mon, 28 Aug 2017 09:34:10 +0200 Subject: [PATCH 3/5] update version number --- intrastat_product/__openerp__.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/intrastat_product/__openerp__.py b/intrastat_product/__openerp__.py index c559fe3..032b038 100644 --- a/intrastat_product/__openerp__.py +++ b/intrastat_product/__openerp__.py @@ -1,30 +1,11 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Intrastat Product module for Odoo -# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) -# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) -# @author Alexis de Lattre -# @author Luc de Meyer -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2011-2017 Akretion (http://www.akretion.com) +# Copyright 2009-2017 Noviat +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Intrastat Product', - 'version': '8.0.1.4.1', + 'version': '8.0.1.5.0', 'category': 'Intrastat', 'license': 'AGPL-3', 'summary': 'Base module for Intrastat Product', From 5f44338f13be8df6018d9946fbb71c4c6ddf3857 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Mon, 28 Aug 2017 16:08:29 +0200 Subject: [PATCH 4/5] readonly=True on src_dest_country_code --- intrastat_product/__openerp__.py | 2 +- intrastat_product/models/account_invoice.py | 29 ++++----------------- intrastat_product/models/res_company.py | 29 ++++----------------- intrastat_product/models/stock_warehouse.py | 26 +++--------------- 4 files changed, 15 insertions(+), 71 deletions(-) diff --git a/intrastat_product/__openerp__.py b/intrastat_product/__openerp__.py index 032b038..3e04803 100644 --- a/intrastat_product/__openerp__.py +++ b/intrastat_product/__openerp__.py @@ -16,7 +16,7 @@ 'stock_picking_invoice_link', 'sale_stock', 'purchase', - ], + ], 'conflicts': ['report_intrastat'], 'data': [ 'views/hs_code.xml', diff --git a/intrastat_product/models/account_invoice.py b/intrastat_product/models/account_invoice.py index a51281e..96b7068 100644 --- a/intrastat_product/models/account_invoice.py +++ b/intrastat_product/models/account_invoice.py @@ -1,28 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Intrastat Product module for Odoo -# Copyright (C) 2011-2016 Akretion (http://www.akretion.com) -# Copyright (C) 2009-2016 Noviat (http://www.noviat.com) -# @author Alexis de Lattre -# @author Luc de Meyer -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2011-2017 Akretion (http://www.akretion.com) +# Copyright 2009-2017 Noviat +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from openerp import api, fields, models class AccountInvoice(models.Model): @@ -44,7 +25,7 @@ class AccountInvoice(models.Model): 'res.country', string='Origin/Destination Country', ondelete='restrict') src_dest_country_code = fields.Char( - related='company_id.country_id.code') + related='company_id.country_id.code', readonly=True) 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 f69d6c0..58e713b 100644 --- a/intrastat_product/models/res_company.py +++ b/intrastat_product/models/res_company.py @@ -1,28 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Intrastat Product module for Odoo -# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) -# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) -# @author Alexis de Lattre -# @author Luc de Meyer -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2011-2017 Akretion (http://www.akretion.com) +# Copyright 2009-2017 Noviat +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from openerp import api, fields, models class ResCompany(models.Model): @@ -47,7 +28,7 @@ class ResCompany(models.Model): string='Intrastat Declaration', store=True, readonly=True, compute='_compute_intrastat') country_code = fields.Char( - related='country_id.code') + related='country_id.code', readonly=True) 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 1ff96c3..2cedd7c 100644 --- a/intrastat_product/models/stock_warehouse.py +++ b/intrastat_product/models/stock_warehouse.py @@ -1,26 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# -# Copyright (c) 2009-2015 Noviat nv/sa (www.noviat.com). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2009-2017 Noviat +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from openerp import api, fields, models class StockWarehouse(models.Model): @@ -30,7 +12,7 @@ class StockWarehouse(models.Model): 'intrastat.region', string='Intrastat region') country_code = fields.Char( - related='company_id.country_id.code') + related='company_id.country_id.code', readonly=True) class StockLocation(models.Model): From f94a47a614ca33ed9cd0ef0d5bf959e78aae80a5 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Tue, 29 Aug 2017 18:32:48 +0200 Subject: [PATCH 5/5] rename invoice src_dest_country_code --- intrastat_product/models/account_invoice.py | 2 +- intrastat_product/views/account_invoice.xml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/intrastat_product/models/account_invoice.py b/intrastat_product/models/account_invoice.py index 96b7068..4a69418 100644 --- a/intrastat_product/models/account_invoice.py +++ b/intrastat_product/models/account_invoice.py @@ -24,7 +24,7 @@ class AccountInvoice(models.Model): src_dest_country_id = fields.Many2one( 'res.country', string='Origin/Destination Country', ondelete='restrict') - src_dest_country_code = fields.Char( + company_country_code = fields.Char( related='company_id.country_id.code', readonly=True) src_dest_region_id = fields.Many2one( 'intrastat.region', string='Origin/Destination Region', diff --git a/intrastat_product/views/account_invoice.xml b/intrastat_product/views/account_invoice.xml index fae7050..10fbc87 100644 --- a/intrastat_product/views/account_invoice.xml +++ b/intrastat_product/views/account_invoice.xml @@ -18,9 +18,9 @@ attrs="{'invisible': [('intrastat', '!=', 'extended')]}" widget="selection"/> - + + attrs="{'invisible': [('company_country_code', 'not in', ['BE'])]}"/> @@ -44,9 +44,9 @@ attrs="{'invisible': [('intrastat', '!=', 'extended')]}" widget="selection"/> - + + attrs="{'invisible': [('company_country_code', 'not in', ['BE'])]}"/>