From ac15663f94e98ae4ad8d96e3fc47ee55037980e2 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Tue, 23 Mar 2021 17:53:17 +0100 Subject: [PATCH] [14.0][MIG] product_category_tax * Migrate from 13.0 * Synchronize licensing versions * Move product_template_ids field on product category to product_category_product_link module --- product_category_tax/__manifest__.py | 6 +++--- product_category_tax/models/product_category.py | 5 +---- product_category_tax/models/product_template.py | 2 +- product_category_tax/readme/CONTRIBUTORS.rst | 1 + .../tests/test_product_category_tax.py | 14 +++++++------- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/product_category_tax/__manifest__.py b/product_category_tax/__manifest__.py index 0f0b9259b..7778e8e51 100644 --- a/product_category_tax/__manifest__.py +++ b/product_category_tax/__manifest__.py @@ -1,13 +1,13 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Product Category Taxes", "summary": "Configure taxes in the product category", - "version": "13.0.1.1.0", + "version": "14.0.1.0.0", "license": "AGPL-3", "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", - "depends": ["account"], + "depends": ["account", "product_category_product_link"], "data": ["views/product_category.xml", "views/product_template.xml"], } diff --git a/product_category_tax/models/product_category.py b/product_category_tax/models/product_category.py index 23f269912..c1459e960 100644 --- a/product_category_tax/models/product_category.py +++ b/product_category_tax/models/product_category.py @@ -1,5 +1,5 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models @@ -27,9 +27,6 @@ class ProductCategory(models.Model): domain=[("type_tax_use", "=", "purchase")], default=lambda self: self.env.company.account_purchase_tax_id, ) - product_template_ids = fields.One2many( - "product.template", "categ_id", string="Products Templates" - ) def update_product_taxes(self): for template in self.product_template_ids.filtered( diff --git a/product_category_tax/models/product_template.py b/product_category_tax/models/product_template.py index bd4c3f8e7..e8e838530 100644 --- a/product_category_tax/models/product_template.py +++ b/product_category_tax/models/product_template.py @@ -1,5 +1,5 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models diff --git a/product_category_tax/readme/CONTRIBUTORS.rst b/product_category_tax/readme/CONTRIBUTORS.rst index 2e524967e..b1f19cd8b 100644 --- a/product_category_tax/readme/CONTRIBUTORS.rst +++ b/product_category_tax/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Aaron Henriquez +* Denis Roussel diff --git a/product_category_tax/tests/test_product_category_tax.py b/product_category_tax/tests/test_product_category_tax.py index bc1d0b393..b5b4cbe0a 100644 --- a/product_category_tax/tests/test_product_category_tax.py +++ b/product_category_tax/tests/test_product_category_tax.py @@ -1,5 +1,5 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import odoo.tests.common as common @@ -7,7 +7,7 @@ import odoo.tests.common as common class ProductCategoryTax(common.SavepointCase): @classmethod def setUpClass(cls): - super(ProductCategoryTax, cls).setUpClass() + super().setUpClass() cls.categ_obj = cls.env["product.category"] cls.product_obj = cls.env["product.product"] cls.tax_model = cls.env["account.tax"] @@ -53,7 +53,7 @@ class ProductCategoryTax(common.SavepointCase): {"name": "TEST 01", "categ_id": test_categ.id, "list_price": 155.0} ) self.product_test.product_tmpl_id.onchange_categ_id() - self.assertEquals(self.product_test.supplier_taxes_id, self.tax_purchase) + self.assertEqual(self.product_test.supplier_taxes_id, self.tax_purchase) def test_02_update_taxes(self): """ Default update """ @@ -72,10 +72,10 @@ class ProductCategoryTax(common.SavepointCase): "supplier_taxes_id": [(6, 0, self.tax_purchase.ids)], } ) - self.assertEquals(self.product_test.supplier_taxes_id, self.tax_purchase2) + self.assertEqual(self.product_test.supplier_taxes_id, self.tax_purchase2) self.product_test.categ_id = test_categ.id test_categ.update_product_taxes() - self.assertEquals(self.product_test.supplier_taxes_id, self.tax_purchase) + self.assertEqual(self.product_test.supplier_taxes_id, self.tax_purchase) def test_03_taxes_not_updeatable(self): """ Avoid update specific products""" @@ -106,5 +106,5 @@ class ProductCategoryTax(common.SavepointCase): self.product_test3.categ_id = test_categ.id self.product_test4.categ_id = test_categ.id test_categ.update_product_taxes() - self.assertEquals(self.product_test3.supplier_taxes_id, self.tax_purchase) - self.assertNotEquals(self.product_test4.supplier_taxes_id, self.tax_purchase) + self.assertEqual(self.product_test3.supplier_taxes_id, self.tax_purchase) + self.assertNotEqual(self.product_test4.supplier_taxes_id, self.tax_purchase)