Skip to content

Commit

Permalink
new file: product_category_tax/README.rst
Browse files Browse the repository at this point in the history
	new file:   product_category_tax/__init__.py
	new file:   product_category_tax/__manifest__.py
	new file:   product_category_tax/i18n/product_category_tax.pot
	new file:   product_category_tax/models/__init__.py
	new file:   product_category_tax/models/product_category.py
	new file:   product_category_tax/models/product_product.py
	new file:   product_category_tax/models/product_template.py
	new file:   product_category_tax/readme/CONFIGURATION.rst
	new file:   product_category_tax/readme/CONTRIBUTORS.rst
	new file:   product_category_tax/readme/DESCRIPTION.rst
	new file:   product_category_tax/readme/USAGE.rst
	new file:   product_category_tax/static/description/icon.png
	new file:   product_category_tax/static/description/index.html
	new file:   product_category_tax/tests/__init__.py
	new file:   product_category_tax/tests/test_product_category_tax.py
	new file:   product_category_tax/views/product_category.xml
	new file:   product_category_tax/views/product_template.xml
  • Loading branch information
nuprodRomainF committed Sep 22, 2023
1 parent eb3e35e commit 4701ce0
Show file tree
Hide file tree
Showing 18 changed files with 835 additions and 0 deletions.
82 changes: 82 additions & 0 deletions product_category_tax/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
======================
Product Category Taxes
======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/15.0/product_category_tax
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-15-0/account-financial-tools-15-0-product_category_tax
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

Edit taxes directly in the product category.

**Table of contents**

.. contents::
:local:

Usage
=====

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"

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20product_category_tax%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ForgeFlow S.L.

Contributors
~~~~~~~~~~~~

* Aaron Henriquez <[email protected]>
* Denis Roussel <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/15.0/product_category_tax>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_category_tax/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions product_category_tax/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# 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": "16.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", "product_category_product_link"],
"data": ["views/product_category.xml", "views/product_template.xml"],
}
70 changes: 70 additions & 0 deletions product_category_tax/i18n/product_category_tax.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_tax
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_category_tax
#: model_terms:ir.ui.view,arch_db:product_category_tax.product_category_form_view
msgid "-> Apply to Products"
msgstr ""

#. module: product_category_tax
#: model:ir.model.fields,field_description:product_category_tax.field_product_category__taxes_id
msgid "Customer Taxes"
msgstr ""

#. module: product_category_tax
#: model:ir.model.fields,help:product_category_tax.field_product_category__supplier_taxes_id
msgid "Default taxes used when buying the product."
msgstr ""

#. module: product_category_tax
#: model:ir.model.fields,help:product_category_tax.field_product_category__taxes_id
msgid "Default taxes used when selling the product."
msgstr ""

#. module: product_category_tax
#: model:ir.model,name:product_category_tax.model_product_product
msgid "Product"
msgstr ""

#. module: product_category_tax
#: model:ir.model,name:product_category_tax.model_product_category
msgid "Product Category"
msgstr ""

#. module: product_category_tax
#: model:ir.model,name:product_category_tax.model_product_template
msgid "Product Template"
msgstr ""

#. module: product_category_tax
#: model_terms:ir.ui.view,arch_db:product_category_tax.product_category_form_view
msgid "Taxes"
msgstr ""

#. module: product_category_tax
#: model:ir.model.fields,field_description:product_category_tax.field_product_product__taxes_updeatable_from_category
#: model:ir.model.fields,field_description:product_category_tax.field_product_template__taxes_updeatable_from_category
msgid "Taxes Updeatable From Category"
msgstr ""

#. module: product_category_tax
#: model_terms:ir.ui.view,arch_db:product_category_tax.product_category_form_view
msgid "This will apply to all products in the category"
msgstr ""

#. module: product_category_tax
#: model:ir.model.fields,field_description:product_category_tax.field_product_category__supplier_taxes_id
msgid "Vendor Taxes"
msgstr ""
3 changes: 3 additions & 0 deletions product_category_tax/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import product_category
from . import product_product
from . import product_template
35 changes: 35 additions & 0 deletions product_category_tax/models/product_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ProductCategory(models.Model):
_inherit = "product.category"

taxes_id = fields.Many2many(
"account.tax",
"product_category_taxes_rel",
"categ_id",
"tax_id",
help="Default taxes used when selling the product.",
string="Customer Taxes",
domain=[("type_tax_use", "=", "sale")],
default=lambda self: self.env.company.account_sale_tax_id,
)
supplier_taxes_id = fields.Many2many(
"account.tax",
"product_category_supplier_taxes_rel",
"categ_id",
"tax_id",
string="Vendor Taxes",
help="Default taxes used when buying the product.",
domain=[("type_tax_use", "=", "purchase")],
default=lambda self: self.env.company.account_purchase_tax_id,
)

def update_product_taxes(self):
for template in self.product_template_ids.filtered(
lambda p: p.taxes_updeatable_from_category
):
template.set_tax_from_category()
18 changes: 18 additions & 0 deletions product_category_tax/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2022 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


class ProductProduct(models.Model):
_inherit = "product.product"

@api.onchange("categ_id")
def onchange_categ_id(self):
if self.categ_id:
self.set_tax_from_category()

def set_tax_from_category(self):
self.ensure_one()
self.taxes_id = [(6, 0, self.categ_id.taxes_id.ids)]
self.supplier_taxes_id = [(6, 0, self.categ_id.supplier_taxes_id.ids)]
20 changes: 20 additions & 0 deletions product_category_tax/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

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:
self.set_tax_from_category()

def set_tax_from_category(self):
self.ensure_one()
self.taxes_id = [(6, 0, self.categ_id.taxes_id.ids)]
self.supplier_taxes_id = [(6, 0, self.categ_id.supplier_taxes_id.ids)]
3 changes: 3 additions & 0 deletions product_category_tax/readme/CONFIGURATION.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions product_category_tax/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Aaron Henriquez <[email protected]>
* Denis Roussel <[email protected]>
1 change: 1 addition & 0 deletions product_category_tax/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Edit taxes directly in the product category.
4 changes: 4 additions & 0 deletions product_category_tax/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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"
Binary file added product_category_tax/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4701ce0

Please sign in to comment.