mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[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
This commit is contained in:
committed by
Joan Mateu Jordi
parent
d2ba5623a1
commit
ac15663f94
@@ -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"],
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
* Aaron Henriquez <ahenriquez@forgeflow.com>
|
||||
* Denis Roussel <denis.roussel@acsone.eu>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user