diff --git a/product_category_tax/README.rst b/product_category_tax/README.rst index aceee36fa..e7d0b50ec 100644 --- a/product_category_tax/README.rst +++ b/product_category_tax/README.rst @@ -40,10 +40,6 @@ In case all the products within the category will use the same tax setup: #. Select the taxes in the product category form #. Click on "Apply to Products" -In case a specific product need a different tax configuration you have to -either to include it in a subcategory or adjust its taxes after applying those -to the others - Bug Tracker =========== diff --git a/product_category_tax/__manifest__.py b/product_category_tax/__manifest__.py index 2f83813ec..0f0b9259b 100644 --- a/product_category_tax/__manifest__.py +++ b/product_category_tax/__manifest__.py @@ -9,5 +9,5 @@ "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", "depends": ["account"], - "data": ["views/product_category.xml"], + "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 5372c6468..23f269912 100644 --- a/product_category_tax/models/product_category.py +++ b/product_category_tax/models/product_category.py @@ -32,5 +32,7 @@ class ProductCategory(models.Model): ) def update_product_taxes(self): - for template in self.product_template_ids: + for template in self.product_template_ids.filtered( + lambda p: p.taxes_updeatable_from_category + ): template.set_tax_from_category() diff --git a/product_category_tax/models/product_template.py b/product_category_tax/models/product_template.py index 23c024734..bd4c3f8e7 100644 --- a/product_category_tax/models/product_template.py +++ b/product_category_tax/models/product_template.py @@ -1,12 +1,14 @@ # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com) # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from odoo import api, models +from odoo import api, fields, models class ProductTemplate(models.Model): _inherit = "product.template" + taxes_updeatable_from_category = fields.Boolean(default=True) + @api.onchange("categ_id") def onchange_categ_id(self): if self.categ_id: diff --git a/product_category_tax/readme/CONFIGURATION.rst b/product_category_tax/readme/CONFIGURATION.rst new file mode 100644 index 000000000..2b1382c66 --- /dev/null +++ b/product_category_tax/readme/CONFIGURATION.rst @@ -0,0 +1,3 @@ +In case a specific product need a different tax configuration you have to +check the option "Taxes Updeatable From Category" in the Accounting tab in the +product form. diff --git a/product_category_tax/readme/USAGE.rst b/product_category_tax/readme/USAGE.rst index 2136550f5..47d8f208b 100644 --- a/product_category_tax/readme/USAGE.rst +++ b/product_category_tax/readme/USAGE.rst @@ -2,7 +2,3 @@ In case all the products within the category will use the same tax setup: #. Select the taxes in the product category form #. Click on "Apply to Products" - -In case a specific product need a different tax configuration you have to -either to include it in a subcategory or adjust its taxes after applying those -to the others diff --git a/product_category_tax/static/description/index.html b/product_category_tax/static/description/index.html index c6b60d41c..06199707f 100644 --- a/product_category_tax/static/description/index.html +++ b/product_category_tax/static/description/index.html @@ -389,9 +389,6 @@ ul.auto-toc {
In case a specific product need a different tax configuration you have to -either to include it in a subcategory or adjust its taxes after applying those -to the others