From 837369b780df723f7ac25fbfc2f6045e37ea2a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Gonz=C3=A1lez=20=5BVauxoo=5D?= Date: Wed, 18 Mar 2020 00:10:40 -0600 Subject: [PATCH] [IMP] company_country: Don't create DB table for model (#1791) That model is intended only to set config and has no fields, so there is no need for creating a DB table for it. This is achieved by switching the model type from transient to abstract. --- company_country/__manifest__.py | 2 +- .../migrations/13.0.1.0.2/pre-migration.py | 18 ++++++++++++++++++ company_country/models/res_config.py | 2 +- company_country/readme/CONTRIBUTORS.rst | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 company_country/migrations/13.0.1.0.2/pre-migration.py diff --git a/company_country/__manifest__.py b/company_country/__manifest__.py index f27d4f5cd..16f54cf3b 100644 --- a/company_country/__manifest__.py +++ b/company_country/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Company Country", "summary": "Set country to main company", - "version": "13.0.1.0.1", + "version": "13.0.1.0.2", "category": "base", "website": "https://github.com/OCA/server-tools/tree/13.0/company_country", "maintainers": ["moylop260", "luisg123v"], diff --git a/company_country/migrations/13.0.1.0.2/pre-migration.py b/company_country/migrations/13.0.1.0.2/pre-migration.py new file mode 100644 index 000000000..619d4bfce --- /dev/null +++ b/company_country/migrations/13.0.1.0.2/pre-migration.py @@ -0,0 +1,18 @@ +import logging + +from psycopg2.extensions import AsIs + +from odoo import tools + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + drop_table_model_company_country(cr) + + +def drop_table_model_company_country(cr): + tablename = "company_country_config_settings" + if tools.table_exists(cr, tablename): + _logger.info("Dropping table %s", tablename) + cr.execute("DROP TABLE IF EXISTS %s;", (AsIs(tablename),)) diff --git a/company_country/models/res_config.py b/company_country/models/res_config.py index e5683d99f..044c85f8c 100644 --- a/company_country/models/res_config.py +++ b/company_country/models/res_config.py @@ -9,7 +9,7 @@ from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) -class CompanyCountryConfigSettings(models.TransientModel): +class CompanyCountryConfigSettings(models.AbstractModel): _name = "company.country.config.settings" _description = "Company Country Configuration Settings" diff --git a/company_country/readme/CONTRIBUTORS.rst b/company_country/readme/CONTRIBUTORS.rst index aecc7027e..35b8beda4 100644 --- a/company_country/readme/CONTRIBUTORS.rst +++ b/company_country/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Moisés López +* Luis González