From 5f44338f13be8df6018d9946fbb71c4c6ddf3857 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Mon, 28 Aug 2017 16:08:29 +0200 Subject: [PATCH] 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):