From 3d189d87a1bcbc1f254b7baf25a9996609389f91 Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:11:36 +0000 Subject: [PATCH 1/7] odoo-module-migrator 16 --- product_create_stock_picking/__manifest__.py | 2 +- .../models/product_template.py | 1 - product_library/__manifest__.py | 2 +- product_library/models/product_template.py | 12 ++++++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/product_create_stock_picking/__manifest__.py b/product_create_stock_picking/__manifest__.py index 37b527a..ff02431 100644 --- a/product_create_stock_picking/__manifest__.py +++ b/product_create_stock_picking/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Product Create Stock Picking', 'category': 'Warehouse', 'summary': 'Add an action to create a stock picking from a selection of products.', - 'version': '12.0.0.0.1', + 'version': "16.0.1.0.0", 'description': """ Add an action to create a stock picking from a selection of products. diff --git a/product_create_stock_picking/models/product_template.py b/product_create_stock_picking/models/product_template.py index fc6609b..9b8c8e9 100644 --- a/product_create_stock_picking/models/product_template.py +++ b/product_create_stock_picking/models/product_template.py @@ -11,7 +11,6 @@ from odoo import tools, models, fields, api, _ class ProductTemplate(models.Model): _inherit = "product.template" - @api.multi def create_stock_picking(self): picking_vals = self.env['stock.picking'].default_get(self.env['stock.picking']._fields.keys()) picking_vals.update({ diff --git a/product_library/__manifest__.py b/product_library/__manifest__.py index e4f7ce9..ea071f7 100644 --- a/product_library/__manifest__.py +++ b/product_library/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Product Library', 'category': 'Product', 'summary': 'Add library related fields to product', - 'version': '12.0.1.0.2', + 'version': '13.0.0.1', 'description': """ Addon mejora de Odoo para librerías y tiendas de discos diff --git a/product_library/models/product_template.py b/product_library/models/product_template.py index 4719c0a..59ca65d 100644 --- a/product_library/models/product_template.py +++ b/product_library/models/product_template.py @@ -11,16 +11,16 @@ _logger = logging.getLogger(__name__) class ProductTemplate(models.Model): _inherit = "product.template" - subtitle = fields.Char('Subtítulo') + subtitle = fields.Char('Subtitulo') editorial = fields.Char('Editorial') formato = fields.Char('Formato') - pais_edicion = fields.Char('País de Edicion') - colacion = fields.Char('Colación') + pais_edicion = fields.Char('Pais de edicion') + colacion = fields.Char('Colacion') autor = fields.Char('Autor') isbn = fields.Char('ISBN') - coleccion = fields.Char('Colección') - subcoleccion = fields.Char('Subcolección') + coleccion = fields.Char('Coleccion') + subcoleccion = fields.Char('Subcoleccion') idioma = fields.Char('Idioma') fecha_entrada = fields.Char('Fecha de entrada') fecha_edicion = fields.Char('Fecha de edición') - genero = fields.Char('Género') + genero = fields.Char('Genero') From 3b0d37a0ac3d4a3ef5997d38aef2759c86695004 Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:14:13 +0000 Subject: [PATCH 2/7] [MIG] product_library: Migration to 16.0 --- product_library/__manifest__.py | 2 +- product_library/models/product_product.py | 1 - product_library/views/product.xml | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/product_library/__manifest__.py b/product_library/__manifest__.py index ea071f7..fc8ce0b 100644 --- a/product_library/__manifest__.py +++ b/product_library/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Product Library', 'category': 'Product', 'summary': 'Add library related fields to product', - 'version': '13.0.0.1', + 'version': "16.0.1.0.0", 'description': """ Addon mejora de Odoo para librerías y tiendas de discos diff --git a/product_library/models/product_product.py b/product_library/models/product_product.py index 0cb6f82..c584498 100644 --- a/product_library/models/product_product.py +++ b/product_library/models/product_product.py @@ -10,7 +10,6 @@ from odoo import models, fields, api class ProductProduct(models.Model): _inherit = 'product.product' - @api.multi @api.depends('image') def _compute_has_image(self): for product in self: diff --git a/product_library/views/product.xml b/product_library/views/product.xml index 938faef..210c30f 100644 --- a/product_library/views/product.xml +++ b/product_library/views/product.xml @@ -1,6 +1,5 @@ - - + product.template.library.form product.template @@ -27,5 +26,4 @@ - - + From 6e42b9c38ca339a8e00c9ad3b54edde15c43bc2e Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:14:13 +0000 Subject: [PATCH 3/7] [MIG] product_retail_cm: Migration to 16.0 --- product_retail_cm/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product_retail_cm/__manifest__.py b/product_retail_cm/__manifest__.py index 5d29d6c..a1e8465 100644 --- a/product_retail_cm/__manifest__.py +++ b/product_retail_cm/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Product Retail', 'category': 'Product', 'summary': 'Gestiona productos en distribución / Venta a minoristas', - 'version': '12.0.1.0.0', + 'version': "16.0.1.0.0", 'description': """ Gestiona productos en distribución / Venta a minoristas From a796e31f22c75345408a3e84bd27e86b7cb9deb3 Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:14:13 +0000 Subject: [PATCH 4/7] [MIG] product_state: Migration to 16.0 --- product_state/__manifest__.py | 2 +- product_state/migrations/12.0.2.0.0/post-migration.py | 7 ------- product_state/views/product_views.xml | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 product_state/migrations/12.0.2.0.0/post-migration.py diff --git a/product_state/__manifest__.py b/product_state/__manifest__.py index ea49465..0e54111 100644 --- a/product_state/__manifest__.py +++ b/product_state/__manifest__.py @@ -7,7 +7,7 @@ "author": "ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/product-attribute", "category": "Product", - "version": "12.0.2.0.2", + "version": "16.0.1.0.0", "license": "AGPL-3", "depends": ["sale", "product"], "data": [ diff --git a/product_state/migrations/12.0.2.0.0/post-migration.py b/product_state/migrations/12.0.2.0.0/post-migration.py deleted file mode 100644 index 541449c..0000000 --- a/product_state/migrations/12.0.2.0.0/post-migration.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2020 Tecnativa - Pedro M. Baeza -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo.addons.product_state.hooks import post_init_hook - - -def migrate(cr, version): - post_init_hook(cr, False) diff --git a/product_state/views/product_views.xml b/product_state/views/product_views.xml index 5967949..663825c 100644 --- a/product_state/views/product_views.xml +++ b/product_state/views/product_views.xml @@ -129,7 +129,6 @@ State product.state - form kanban,form,tree Date: Wed, 28 Aug 2024 18:14:13 +0000 Subject: [PATCH 5/7] [MIG] stock_picking_deposito: Migration to 16.0 --- stock_picking_deposito/__manifest__.py | 2 +- stock_picking_deposito/data/data.xml | 4 ++-- stock_picking_deposito/models/res_partner.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stock_picking_deposito/__manifest__.py b/stock_picking_deposito/__manifest__.py index a0483a2..3373b27 100644 --- a/stock_picking_deposito/__manifest__.py +++ b/stock_picking_deposito/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Picking Depósito", "summary": "Permite la gestión de depósitos en el almacén y su facturación.", - "version": "12.0.1.0.1", + "version": "16.0.1.0.0", "development_status": "Alpha", "category": "Warehouse Management", "website": "https://criptomart.net", diff --git a/stock_picking_deposito/data/data.xml b/stock_picking_deposito/data/data.xml index 24b37c1..0544833 100644 --- a/stock_picking_deposito/data/data.xml +++ b/stock_picking_deposito/data/data.xml @@ -1,5 +1,5 @@ - + Depósito Salidas @@ -21,7 +21,7 @@ - + Depósitos Entradas diff --git a/stock_picking_deposito/models/res_partner.py b/stock_picking_deposito/models/res_partner.py index e271dd2..935296d 100644 --- a/stock_picking_deposito/models/res_partner.py +++ b/stock_picking_deposito/models/res_partner.py @@ -55,7 +55,6 @@ class ResPartner(models.Model): }).id return super().create(vals) - @api.multi def write(self, vals): if ( vals.get('deposit_sale_accept', False) == True ) and not self.deposit_sale_location_id: vals['deposit_sale_location_id'] = self.env['stock.location'].create({ From f9efd08ff5024e3a14a27fa4258685b4efeb4c83 Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:20:23 +0000 Subject: [PATCH 6/7] [MIG] product_sequence: Migration to 16.0 --- product_sequence/__manifest__.py | 2 +- product_sequence/models/product_category.py | 1 - product_sequence/models/product_product.py | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/product_sequence/__manifest__.py b/product_sequence/__manifest__.py index 3736a23..3a8c8e1 100644 --- a/product_sequence/__manifest__.py +++ b/product_sequence/__manifest__.py @@ -6,7 +6,7 @@ { 'name': 'Product Sequence', - 'version': '12.0.2.0.2', + 'version': "16.0.1.0.0", 'author': "Zikzakmedia SL,Sodexis,Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/product-attribute', 'license': 'AGPL-3', diff --git a/product_sequence/models/product_category.py b/product_sequence/models/product_category.py index 817f5a7..3f80e31 100644 --- a/product_sequence/models/product_category.py +++ b/product_sequence/models/product_category.py @@ -36,7 +36,6 @@ class ProductCategory(models.Model): } return vals - @api.multi def write(self, vals): prefix = vals.get("code_prefix") if prefix: diff --git a/product_sequence/models/product_product.py b/product_sequence/models/product_product.py index 0c7db9c..a8797a6 100644 --- a/product_sequence/models/product_product.py +++ b/product_sequence/models/product_product.py @@ -13,7 +13,7 @@ class ProductProduct(models.Model): default_code = fields.Char( required=True, default='/', - track_visibility='onchange', + tracking=True, help="Set to '/' and save if you want a new internal reference " "to be proposed." ) @@ -35,7 +35,6 @@ class ProductProduct(models.Model): vals['default_code'] = sequence.next_by_id() return super().create(vals) - @api.multi def write(self, vals): """To assign a new internal reference, just write '/' on the field. Note this is up to the user, if the product category is changed, @@ -55,7 +54,6 @@ class ProductProduct(models.Model): return True return super().write(vals) - @api.multi def copy(self, default=None): if default is None: default = {} From 663479e4a22944ffa62df388698a96ddcbd09925 Mon Sep 17 00:00:00 2001 From: santi Date: Wed, 28 Aug 2024 18:21:20 +0000 Subject: [PATCH 7/7] [MIG] product_sequence: Migration to 16.0 --- product_sequence/tests/__init__.py | 1 - .../tests/test_product_sequence.py | 140 ------------------ 2 files changed, 141 deletions(-) delete mode 100644 product_sequence/tests/__init__.py delete mode 100644 product_sequence/tests/test_product_sequence.py diff --git a/product_sequence/tests/__init__.py b/product_sequence/tests/__init__.py deleted file mode 100644 index 29b6235..0000000 --- a/product_sequence/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_product_sequence diff --git a/product_sequence/tests/test_product_sequence.py b/product_sequence/tests/test_product_sequence.py deleted file mode 100644 index f327c7b..0000000 --- a/product_sequence/tests/test_product_sequence.py +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright 2016 Sodexis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo.tests.common import TransactionCase -from ..hooks import pre_init_hook - - -class TestProductSequence(TransactionCase): - """Tests for creating product with and without Product Sequence""" - - def setUp(self): - super(TestProductSequence, self).setUp() - self.product_product = self.env['product.product'] - self.product_category = self.env['product.category'] - self.product_template = self.env['product.template'].create({ - 'name': 'Demo Product', - }) - - def test_product_create_with_default_code(self): - product = self.product_product.create(dict( - name="Apple", - default_code='PROD01' - )) - self.assertEqual(product.default_code, 'PROD01') - product_new = self.product_product.create(dict( - name="Demo Apple", - product_tmpl_id=self.product_template.id - )) - self.assertTrue(product_new.default_code) - - def test_product_create_without_default_code(self): - product_1 = self.product_product.create(dict( - name="Orange", - default_code='/')) - self.assertRegexpMatches(str(product_1.default_code), r'PR/*') - - def test_product_copy(self): - product_2 = self.product_product.create(dict( - name="Apple", - default_code='PROD02' - )) - copy_product_2 = product_2.copy() - self.assertEqual(copy_product_2.default_code, 'PROD02-copy') - - def test_pre_init_hook(self): - product_3 = self.product_product.create(dict( - name="Apple", - default_code='PROD03' - )) - sql = "update product_product set default_code='/' where id=%s" - self.cr.execute(sql, (product_3.id,)) - product_3.invalidate_cache() - self.assertEqual(product_3.default_code, '/') - pre_init_hook(self.cr) - product_3.invalidate_cache() - self.assertEqual(product_3.default_code, '!!mig!!%s' % (product_3.id,)) - - def test_product_category_sequence(self): - categ_grocery = self.product_category.create(dict( - name="Grocery", - code_prefix="GRO", - )) - self.assertTrue(categ_grocery.sequence_id) - self.assertEqual(categ_grocery.sequence_id.prefix, "GRO") - self.assertFalse(categ_grocery.sequence_id.company_id) - product_3 = self.product_product.create(dict( - name="Apple", - categ_id=categ_grocery.id, - )) - self.assertEqual(product_3.default_code[:3], "GRO") - self.assertEqual(product_3.product_tmpl_id.default_code[:3], "GRO") - categ_electronics = self.product_category.create(dict( - name="Electronics", - code_prefix="ELE", - )) - product_3.write({'default_code': '/', - 'categ_id': categ_electronics.id}) - self.assertEqual(product_3.default_code[:3], "ELE") - self.assertEqual(product_3.product_tmpl_id.default_code[:3], "ELE") - - product_4 = self.product_product.create(dict( - name="Truck", - default_code='PROD04' - )) - product_4.write({'default_code': '/'}) - self.assertTrue(product_4.categ_id, 'Category is not set.') - - categ_car = self.product_category.create(dict( - name="Car", - code_prefix="CAR", - )) - product_3.product_tmpl_id.categ_id = categ_car - product_3.product_tmpl_id.default_code = '/' - product_3.refresh() - self.assertEqual(product_3.default_code[:3], "CAR") - self.assertEqual(product_3.product_tmpl_id.default_code[:3], "CAR") - categ_car.write(dict( - name="Bike", - code_prefix="BIK", - )) - self.assertEqual(categ_car.sequence_id.prefix, "BIK") - categ_car.sequence_id = False - categ_car.write({'code_prefix': 'KIA'}) - self.assertEqual(categ_car.sequence_id.prefix, "KIA") - - def test_product_parent_category_sequence(self): - parent_categ = self.product_category.create(dict( - name="Parents", - code_prefix="PAR", - )) - categ = self.product_category.create(dict( - name="Child", - parent_id=parent_categ.id, - )) - - product_anna = self.product_product.create(dict( - name="Anna", - categ_id=categ.id, - )) - self.assertEqual(product_anna.default_code[:2], "PR") - self.assertEqual(product_anna.product_tmpl_id.default_code[:2], "PR") - - self.env.user.company_id.use_parent_categories_to_determine_prefix = True - - product_claudia = self.product_product.create(dict( - name="Claudia", - categ_id=categ.id, - )) - self.assertEqual(product_claudia.default_code[:3], "PAR") - self.assertEqual(product_claudia.product_tmpl_id.default_code[:3], "PAR") - - def test_product_copy_with_default_values(self): - product_2 = self.product_product.create(dict( - name="Apple", - default_code='PROD02' - )) - copy_product_2 = product_2.copy({ - 'default_code': 'product test sequence', - }) - self.assertEqual(copy_product_2.default_code, 'product test sequence')