Initial commit: OCA Financial packages (186 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:04 +02:00
commit 3e0e8473fb
8757 changed files with 947473 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Ecotax Management (with Odoo tax)
Odoo addon: account_ecotax_tax
## Installation
```bash
pip install odoo-bringout-oca-account-fiscal-rule-account_ecotax_tax
```
## Dependencies
This addon depends on:
- account_ecotax
- account_tax_python
## Manifest Information
- **Name**: Ecotax Management (with Odoo tax)
- **Version**: 16.0.1.0.1
- **Category**: Localization/Account Taxes
- **License**: AGPL-3
- **Installable**: True
## Source
Based on [OCA/account-fiscal-rule](https://github.com/OCA/account-fiscal-rule) branch 16.0, addon `account_ecotax_tax`.
## License
This package maintains the original AGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,142 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association
=================================
Ecotax Management (with Odoo tax)
=================================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:325b4d53ac93f3760030128a6c45ca9e12cef59c1998fc54a3044f230150da9a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/license-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--fiscal--rule-lightgray.png?logo=github
:target: https://github.com/OCA/account-fiscal-rule/tree/16.0/account_ecotax_tax
:alt: OCA/account-fiscal-rule
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-fiscal-rule-16-0/account-fiscal-rule-16-0-account_ecotax_tax
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-fiscal-rule&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to compute the ecotax amounts from Odoo tax mechanism.
The advantages compared to the base account_ecotax module is that it allows to :
- Manage ecotax amount as included or excluded from the price of the product
- Isolate the amount of the ecotax in a specific accounting account (set on the tax)
Then the ecotax amounts are not considered as turnover, which could be good or not depending on your country's legislation or accountant preferences.
**Table of contents**
.. contents::
:local:
Usage
=====
1. Create a tax group named **"Ecotaxes"**. The sequence must be lower than other tax groups.
- Set the **Preceding Subtotal** field to **"Without Ecotax"**.
2. Create two taxes named **"Fixed Ecotax"** and **"Weight-Based Ecotax"**.
- Check the **Ecotax** checkbox.
- Set the correct Python code:
- For the fixed ecotax:
.. code-block:: python
result = quantity and product.fixed_ecotax * quantity or 0.0
- For the weight-based ecotax:
.. code-block:: python
result = quantity and product.weight_based_ecotax * quantity or 0.0
- Check the **Included in Base Amount** option.
- The sequence for Ecotax must be lower than the VAT tax.
3. For VAT taxes, check the **Base Affected by Previous Taxes?** option.
4. Add an ecotax classification via the menu **Accounting > Configuration > Taxes > Ecotax Classification**.
- The ecotax classification can be either a fixed ecotax or a weight-based ecotax.
- Ecotax classification information can be used for legal declarations.
- For the fixed ecotax, the ecotax amount is used as a default value, which can be overridden on the product.
- For the weight-based ecotax, define one ecotax by a coefficient applied to the weight (depending on the product's materials).
- Set the appropriate tax in the **Sale Ecotax** field.
5. Assign one or more ecotax classifications to a product.
- The ecotax amount can also be manually overridden on the product.
Known issues / Roadmap
======================
Since an update in Odoo https://github.com/odoo/odoo/commit/13e9833e0bc809a26843890363586f61a37d061c the case with ecotax as tax included and another tax included does not work anymore.
The ecotax tax should only be used along with price excluded tax, or be configured as price excluded itself.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-fiscal-rule/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-fiscal-rule/issues/new?body=module:%20account_ecotax_tax%0Aversion:%2016.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
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
* Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
* Florian da Costa <florian.dacosta@akretion.com>
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.
.. |maintainer-mourad-ehm| image:: https://github.com/mourad-ehm.png?size=40px
:target: https://github.com/mourad-ehm
:alt: mourad-ehm
.. |maintainer-florian-dacosta| image:: https://github.com/florian-dacosta.png?size=40px
:target: https://github.com/florian-dacosta
:alt: florian-dacosta
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-mourad-ehm| |maintainer-florian-dacosta|
This module is part of the `OCA/account-fiscal-rule <https://github.com/OCA/account-fiscal-rule/tree/16.0/account_ecotax_tax>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,24 @@
# © 2014-2023 Akretion (http://www.akretion.com)
# @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Ecotax Management (with Odoo tax)",
"summary": "Use Odoo tax mechanism to compute the ecotaxes ",
"version": "16.0.1.0.1",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-fiscal-rule",
"category": "Localization/Account Taxes",
"license": "AGPL-3",
"maintainers": ["mourad-ehm", "florian-dacosta"],
"depends": [
"account_ecotax",
"account_tax_python",
],
"data": [
"views/account_ecotax_classification_view.xml",
"views/account_tax_view.xml",
"views/account_move_view.xml",
"report/invoice.xml",
],
"installable": True,
}

View file

@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_ecotax_tax
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_ecotax_classification
msgid "Account Ecotax Classification"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__subtotal_ecotax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_tax__is_ecotax
msgid "Ecotax"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__ecotax_amount_unit
msgid "Ecotax Unit"
msgstr ""
#. module: account_ecotax_tax
#: model_terms:ir.ui.view,arch_db:account_ecotax_tax.ecotax_classification_form
msgid "Ecotaxes"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_move_line
msgid "Journal Item"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__purchase_ecotax_ids
msgid "Purchase EcoTax"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__sale_ecotax_ids
msgid "Sale EcoTax"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_tax
msgid "Tax"
msgstr ""
#. module: account_ecotax_tax
#: model:ir.model.fields,help:account_ecotax_tax.field_account_tax__is_ecotax
msgid ""
"Warning : To include Ecotax in the VAT tax check this :\n"
"1: check \"included in base amount \"\n"
"2: The Ecotax sequence must be less then VAT tax (in sale and purchase)"
msgstr ""

View file

@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_ecotax_tax
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_ecotax_classification
msgid "Account Ecotax Classification"
msgstr "Ecotax klasifikacija računa"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__subtotal_ecotax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_tax__is_ecotax
msgid "Ecotax"
msgstr "Ecotax"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__ecotax_amount_unit
msgid "Ecotax Unit"
msgstr "Ecotax jedinica"
#. module: account_ecotax_tax
#: model_terms:ir.ui.view,arch_db:account_ecotax_tax.ecotax_classification_form
msgid "Ecotaxes"
msgstr "Ecotax-i"
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_move_line
msgid "Journal Item"
msgstr "Stavka žurnala"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__purchase_ecotax_ids
msgid "Purchase EcoTax"
msgstr "Nabavni ecotax"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__sale_ecotax_ids
msgid "Sale EcoTax"
msgstr "Prodajni ecotax"
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_tax
msgid "Tax"
msgstr "Porez"
#. module: account_ecotax_tax
#: model:ir.model.fields,help:account_ecotax_tax.field_account_tax__is_ecotax
msgid ""
"Warning : To include Ecotax in the VAT tax check this :\n"
"1: check \"included in base amount \"\n"
"2: The Ecotax sequence must be less then VAT tax (in sale and purchase)"
msgstr ""

View file

@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_ecotax_tax
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-02-07 00:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_ecotax_classification
msgid "Account Ecotax Classification"
msgstr "Classificazione conto imposta ecologica"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__subtotal_ecotax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_tax__is_ecotax
msgid "Ecotax"
msgstr "Imposta ecologica"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_move_line__ecotax_amount_unit
msgid "Ecotax Unit"
msgstr "Unità imposta ecologica"
#. module: account_ecotax_tax
#: model_terms:ir.ui.view,arch_db:account_ecotax_tax.ecotax_classification_form
msgid "Ecotaxes"
msgstr "Imposte ecologiche"
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_move_line
msgid "Journal Item"
msgstr "Movimento contabile"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__purchase_ecotax_ids
msgid "Purchase EcoTax"
msgstr "Imposta ecologica acquisti"
#. module: account_ecotax_tax
#: model:ir.model.fields,field_description:account_ecotax_tax.field_account_ecotax_classification__sale_ecotax_ids
msgid "Sale EcoTax"
msgstr "Imposta ecologica vendite"
#. module: account_ecotax_tax
#: model:ir.model,name:account_ecotax_tax.model_account_tax
msgid "Tax"
msgstr "Imposta"
#. module: account_ecotax_tax
#: model:ir.model.fields,help:account_ecotax_tax.field_account_tax__is_ecotax
msgid ""
"Warning : To include Ecotax in the VAT tax check this :\n"
"1: check \"included in base amount \"\n"
"2: The Ecotax sequence must be less then VAT tax (in sale and purchase)"
msgstr ""
"Attenzione: per includere l'imposta ecologica nell'imposta IVA, controllare "
"quanto segue:\n"
"1: seleziona \"incluso nell'importo base\"\n"
"2: la sequenza dell'imposta ecologica deve essere inferiore all'imposta IVA ("
"in vendita e acquisto)"

View file

@ -0,0 +1,3 @@
from . import account_ecotax_classification
from . import account_move_line
from . import account_tax

View file

@ -0,0 +1,26 @@
# © 2014-2023 Akretion (http://www.akretion.com)
# @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountEcotaxClassification(models.Model):
_inherit = "account.ecotax.classification"
sale_ecotax_ids = fields.Many2many(
"account.tax",
"ecotax_classif_taxes_rel",
"ecotax_classif_id",
"tax_id",
string="Sale EcoTax",
domain=[("is_ecotax", "=", True), ("type_tax_use", "=", "sale")],
)
purchase_ecotax_ids = fields.Many2many(
"account.tax",
"ecotax_classif_purchase_taxes_rel",
"ecotax_classif_id",
"tax_id",
string="Purchase EcoTax",
domain=[("is_ecotax", "=", True), ("type_tax_use", "=", "purchase")],
)

View file

@ -0,0 +1,96 @@
# © 2014-2023 Akretion (http://www.akretion.com)
# @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AcountMoveLine(models.Model):
_inherit = "account.move.line"
# replace compute method because we want to change the invalidation fields
# (api.depends) and not add some. (we want to remove the ones on ecotax_line_ids)
# because ecotax_line_ids now depends on the 2 next fields.
subtotal_ecotax = fields.Float(compute="_compute_ecotax_tax")
ecotax_amount_unit = fields.Float(
compute="_compute_ecotax_tax",
)
def _get_ecotax_amounts(self):
self.ensure_one()
ecotax_ids = self.tax_ids.filtered(lambda tax: tax.is_ecotax)
if self.display_type == "tax" or not ecotax_ids:
return 0.0, 0.0
if self.display_type == "product" and self.move_id.is_invoice(True):
amount_currency = self.price_unit * (1 - self.discount / 100)
handle_price_include = True
quantity = self.quantity
else:
amount_currency = self.amount_currency
handle_price_include = False
quantity = 1
compute_all_currency = ecotax_ids.compute_all(
amount_currency,
currency=self.currency_id,
quantity=quantity,
product=self.product_id,
partner=self.move_id.partner_id or self.partner_id,
is_refund=self.is_refund,
handle_price_include=handle_price_include,
include_caba_tags=self.move_id.always_tax_exigible,
)
subtotal_ecotax = 0.0
for tax in compute_all_currency["taxes"]:
subtotal_ecotax += tax["amount"]
amount_unit = subtotal_ecotax / quantity if quantity else subtotal_ecotax
return amount_unit, subtotal_ecotax
@api.depends(
"currency_id",
"tax_ids",
"quantity",
"product_id",
)
def _compute_ecotax_tax(self):
return self._compute_ecotax()
def _get_new_vals_list(self):
if not self.subtotal_ecotax:
return []
return super()._get_new_vals_list()
# ensure lines are re-generated in case ecotax_amount_unit of invoice line change
# without changing the product
@api.depends("ecotax_amount_unit", "subtotal_ecotax")
def _compute_ecotax_line_ids(self):
return super()._compute_ecotax_line_ids()
def _get_computed_taxes(self):
tax_ids = super()._get_computed_taxes()
ecotax_ids = self.env["account.tax"]
if self.move_id.is_sale_document(include_receipts=True):
# Out invoice.
sale_ecotaxs = self.product_id.all_ecotax_line_product_ids.mapped(
"classification_id"
).mapped("sale_ecotax_ids")
ecotax_ids = sale_ecotaxs.filtered(
lambda tax: tax.company_id == self.move_id.company_id
)
elif self.move_id.is_purchase_document(include_receipts=True):
# In invoice.
purchase_ecotaxs = self.product_id.all_ecotax_line_product_ids.mapped(
"classification_id"
).mapped("purchase_ecotax_ids")
ecotax_ids = purchase_ecotaxs.filtered(
lambda tax: tax.company_id == self.move_id.company_id
)
if ecotax_ids and self.move_id.fiscal_position_id:
ecotax_ids = self.move_id.fiscal_position_id.map_tax(ecotax_ids)
if ecotax_ids:
tax_ids |= ecotax_ids
return tax_ids

View file

@ -0,0 +1,32 @@
# © 2014-2024 Akretion (http://www.akretion.com)
# @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AccountTax(models.Model):
_inherit = "account.tax"
is_ecotax = fields.Boolean(
"Ecotax",
help="Warning : To include Ecotax "
"in the VAT tax check this :\n"
'1: check "included in base amount "\n'
"2: The Ecotax sequence must be less then "
"VAT tax (in sale and purchase)",
)
@api.onchange("is_ecotax")
def onchange_is_ecotax(self):
if self.is_ecotax:
self.amount_type = "code"
self.include_base_amount = True
self.python_compute = """
# price_unit
# product: product.product object or None
# partner: res.partner object or None
# for weight based ecotax
# result = quantity and product.weight_based_ecotax * quantity or 0.0
result = quantity and product.fixed_ecotax * quantity or 0.0
"""

View file

@ -0,0 +1,2 @@
* Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
* Florian da Costa <florian.dacosta@akretion.com>

View file

@ -0,0 +1,6 @@
This module allows to compute the ecotax amounts from Odoo tax mechanism.
The advantages compared to the base account_ecotax module is that it allows to :
- Manage ecotax amount as included or excluded from the price of the product
- Isolate the amount of the ecotax in a specific accounting account (set on the tax)
Then the ecotax amounts are not considered as turnover, which could be good or not depending on your country's legislation or accountant preferences.

View file

@ -0,0 +1,2 @@
Since an update in Odoo https://github.com/odoo/odoo/commit/13e9833e0bc809a26843890363586f61a37d061c the case with ecotax as tax included and another tax included does not work anymore.
The ecotax tax should only be used along with price excluded tax, or be configured as price excluded itself.

View file

@ -0,0 +1,35 @@
1. Create a tax group named **"Ecotaxes"**. The sequence must be lower than other tax groups.
- Set the **Preceding Subtotal** field to **"Without Ecotax"**.
2. Create two taxes named **"Fixed Ecotax"** and **"Weight-Based Ecotax"**.
- Check the **Ecotax** checkbox.
- Set the correct Python code:
- For the fixed ecotax:
.. code-block:: python
result = quantity and product.fixed_ecotax * quantity or 0.0
- For the weight-based ecotax:
.. code-block:: python
result = quantity and product.weight_based_ecotax * quantity or 0.0
- Check the **Included in Base Amount** option.
- The sequence for Ecotax must be lower than the VAT tax.
3. For VAT taxes, check the **Base Affected by Previous Taxes?** option.
4. Add an ecotax classification via the menu **Accounting > Configuration > Taxes > Ecotax Classification**.
- The ecotax classification can be either a fixed ecotax or a weight-based ecotax.
- Ecotax classification information can be used for legal declarations.
- For the fixed ecotax, the ecotax amount is used as a default value, which can be overridden on the product.
- For the weight-based ecotax, define one ecotax by a coefficient applied to the weight (depending on the product's materials).
- Set the appropriate tax in the **Sale Ecotax** field.
5. Assign one or more ecotax classifications to a product.
- The ecotax amount can also be manually overridden on the product.

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_invoice_document"
inherit_id="account.report_invoice_document"
priority="150"
>
<xpath expr="//t[@t-set='taxes']" position="replace">
<t
t-set="taxes"
t-value="', '.join([(tax.description or tax.name) for tax in line.tax_ids.filtered(lambda t: not t.is_ecotax)])"
/>
</xpath>
</template>
<template
id="document_tax_totals"
inherit_id="account.document_tax_totals"
priority="150"
>
<xpath expr="//tr[@name='ecotax_line']" position="replace">
</xpath>
</template>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,489 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document">
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="ecotax-management-with-odoo-tax">
<h1>Ecotax Management (with Odoo tax)</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:325b4d53ac93f3760030128a6c45ca9e12cef59c1998fc54a3044f230150da9a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-fiscal-rule/tree/16.0/account_ecotax_tax"><img alt="OCA/account-fiscal-rule" src="https://img.shields.io/badge/github-OCA%2Faccount--fiscal--rule-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-fiscal-rule-16-0/account-fiscal-rule-16-0-account_ecotax_tax"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-fiscal-rule&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to compute the ecotax amounts from Odoo tax mechanism.
The advantages compared to the base account_ecotax module is that it allows to :
- Manage ecotax amount as included or excluded from the price of the product
- Isolate the amount of the ecotax in a specific accounting account (set on the tax)</p>
<p>Then the ecotax amounts are not considered as turnover, which could be good or not depending on your countrys legislation or accountant preferences.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<ol class="arabic">
<li><p class="first">Create a tax group named <strong>“Ecotaxes”</strong>. The sequence must be lower than other tax groups.
- Set the <strong>Preceding Subtotal</strong> field to <strong>“Without Ecotax”</strong>.</p>
</li>
<li><p class="first">Create two taxes named <strong>“Fixed Ecotax”</strong> and <strong>“Weight-Based Ecotax”</strong>.
- Check the <strong>Ecotax</strong> checkbox.
- Set the correct Python code:</p>
<blockquote>
<ul>
<li><p class="first">For the fixed ecotax:</p>
<pre class="code python literal-block">
<span class="n">result</span> <span class="o">=</span> <span class="n">quantity</span> <span class="ow">and</span> <span class="n">product</span><span class="o">.</span><span class="n">fixed_ecotax</span> <span class="o">*</span> <span class="n">quantity</span> <span class="ow">or</span> <span class="mf">0.0</span>
</pre>
</li>
<li><p class="first">For the weight-based ecotax:</p>
<pre class="code python literal-block">
<span class="n">result</span> <span class="o">=</span> <span class="n">quantity</span> <span class="ow">and</span> <span class="n">product</span><span class="o">.</span><span class="n">weight_based_ecotax</span> <span class="o">*</span> <span class="n">quantity</span> <span class="ow">or</span> <span class="mf">0.0</span>
</pre>
</li>
</ul>
</blockquote>
<ul class="simple">
<li>Check the <strong>Included in Base Amount</strong> option.</li>
<li>The sequence for Ecotax must be lower than the VAT tax.</li>
</ul>
</li>
<li><p class="first">For VAT taxes, check the <strong>Base Affected by Previous Taxes?</strong> option.</p>
</li>
<li><p class="first">Add an ecotax classification via the menu <strong>Accounting &gt; Configuration &gt; Taxes &gt; Ecotax Classification</strong>.</p>
<ul class="simple">
<li>The ecotax classification can be either a fixed ecotax or a weight-based ecotax.</li>
<li>Ecotax classification information can be used for legal declarations.</li>
<li>For the fixed ecotax, the ecotax amount is used as a default value, which can be overridden on the product.</li>
<li>For the weight-based ecotax, define one ecotax by a coefficient applied to the weight (depending on the products materials).</li>
<li>Set the appropriate tax in the <strong>Sale Ecotax</strong> field.</li>
</ul>
</li>
<li><p class="first">Assign one or more ecotax classifications to a product.</p>
<ul class="simple">
<li>The ecotax amount can also be manually overridden on the product.</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<p>Since an update in Odoo <a class="reference external" href="https://github.com/odoo/odoo/commit/13e9833e0bc809a26843890363586f61a37d061c">https://github.com/odoo/odoo/commit/13e9833e0bc809a26843890363586f61a37d061c</a> the case with ecotax as tax included and another tax included does not work anymore.
The ecotax tax should only be used along with price excluded tax, or be configured as price excluded itself.</p>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-fiscal-rule/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-fiscal-rule/issues/new?body=module:%20account_ecotax_tax%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<ul class="simple">
<li>Mourad EL HADJ MIMOUNE &lt;<a class="reference external" href="mailto:mourad.elhadj.mimoune&#64;akretion.com">mourad.elhadj.mimoune&#64;akretion.com</a>&gt;</li>
<li>Florian da Costa &lt;<a class="reference external" href="mailto:florian.dacosta&#64;akretion.com">florian.dacosta&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/mourad-ehm"><img alt="mourad-ehm" src="https://github.com/mourad-ehm.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/florian-dacosta"><img alt="florian-dacosta" src="https://github.com/florian-dacosta.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-fiscal-rule/tree/16.0/account_ecotax_tax">OCA/account-fiscal-rule</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
from . import test_ecotax

View file

@ -0,0 +1,329 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.addons.account_ecotax.tests.test_ecotax import TestInvoiceEcotaxCommon
class TestInvoiceEcotaxTaxComon(TestInvoiceEcotaxCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
# ACCOUNTING STUFF
# Main use case for using ecotax with tax is to manage the ecotax as not
# included with tax not included (B2B case)
# Also for this version, the included use case using tax is broken because
# of a bug in Odoo core (check readme)
cls.invoice_tax.price_include = False
cls.invoice_ecotax_account = cls.env["account.account"].create(
{
"code": "707120",
"name": "Ecotax Account",
"account_type": "income",
"company_id": cls.env.user.company_id.id,
}
)
cls.invoice_fixed_ecotax = cls.env["account.tax"].create(
{
"name": "Fixed Ecotax",
"type_tax_use": "sale",
"company_id": cls.env.user.company_id.id,
"price_include": False,
"amount_type": "code",
"include_base_amount": True,
"sequence": 0,
"is_ecotax": True,
"python_compute": "result = (quantity and"
" product.fixed_ecotax * quantity or 0.0)",
"tax_exigibility": "on_invoice",
"invoice_repartition_line_ids": [
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "base",
},
),
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "tax",
"account_id": cls.invoice_ecotax_account.id,
},
),
],
"refund_repartition_line_ids": [
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "base",
},
),
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "tax",
"account_id": cls.invoice_ecotax_account.id,
},
),
],
}
)
cls.invoice_weight_based_ecotax = cls.env["account.tax"].create(
{
"name": "Weight Based Ecotax",
"type_tax_use": "sale",
"company_id": cls.env.user.company_id.id,
"amount_type": "code",
"include_base_amount": True,
"price_include": False,
"sequence": 0,
"is_ecotax": True,
"python_compute": "result = (quantity and"
" product.weight_based_ecotax * quantity or 0.0)",
"tax_exigibility": "on_invoice",
"invoice_repartition_line_ids": [
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "base",
},
),
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "tax",
"account_id": cls.invoice_ecotax_account.id,
},
),
],
"refund_repartition_line_ids": [
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "base",
},
),
(
0,
0,
{
"factor_percent": 100,
"repartition_type": "tax",
"account_id": cls.invoice_ecotax_account.id,
},
),
],
}
)
# ECOTAXES
# 1- Fixed ecotax
cls.ecotax_fixed.sale_ecotax_ids = cls.invoice_fixed_ecotax
# 2- Weight-based ecotax
cls.ecotax_weight.sale_ecotax_ids = cls.invoice_weight_based_ecotax
class TestInvoiceEcotaxTax(TestInvoiceEcotaxTaxComon):
def test_01_default_fixed_ecotax(self):
"""Test default fixed ecotax
Ecotax classification data for this test:
- fixed type
- default amount: 5.0
Product data for this test:
- list price: 100
- fixed ecotax
- no manual amount
Expected results (with 1 line and qty = 1):
- invoice ecotax amount: 5.0
- invoice total amount: 115.5
- line ecotax unit amount: 5.0
- line ecotax total amount: 5.0
"""
invoice = self._make_invoice(products=self._make_product(self.ecotax_fixed))
self._run_checks(
invoice,
{"amount_ecotax": 5.0, "amount_total": 115.5},
[{"ecotax_amount_unit": 5.0, "subtotal_ecotax": 5.0}],
)
new_qty = self._set_invoice_lines_random_quantities(invoice)[0]
self._run_checks(
invoice,
{"amount_ecotax": 5.0 * new_qty, "amount_total": 115.5 * new_qty},
[{"ecotax_amount_unit": 5.0, "subtotal_ecotax": 5.0 * new_qty}],
)
def test_02_force_fixed_ecotax_on_product(self):
"""Test manual fixed ecotax
Ecotax classification data for this test:
- fixed type
- default amount: 5.0
Product data for this test:
- list price: 100
- fixed ecotax
- Force ecotax amount: 10
Expected results (with 1 line and qty = 1):
- invoice ecotax amount: 10.0
- invoice total amount: 121.0
- line ecotax unit amount: 10.0
- line ecotax total amount: 10.0
"""
product = self._make_product(self.ecotax_fixed)
product.ecotax_line_product_ids[0].force_amount = 10
invoice = self._make_invoice(products=product)
self._run_checks(
invoice,
{"amount_ecotax": 10.0, "amount_total": 121.0},
[{"ecotax_amount_unit": 10.0, "subtotal_ecotax": 10.0}],
)
new_qty = self._set_invoice_lines_random_quantities(invoice)[0]
self._run_checks(
invoice,
{"amount_ecotax": 10.0 * new_qty, "amount_total": 121.0 * new_qty},
[{"ecotax_amount_unit": 10.0, "subtotal_ecotax": 10.0 * new_qty}],
)
def test_03_weight_based_ecotax(self):
"""Test weight based ecotax
Ecotax classification data for this test:
- weight based type
- coefficient: 0.04
Product data for this test:
- list price: 100
- weight based ecotax
- weight: 100
Expected results (with 1 line and qty = 1):
- invoice ecotax amount: 4.0
- invoice total amount: 114.4
- line ecotax unit amount: 4.0
- line ecotax total amount: 4.0
"""
invoice = self._make_invoice(products=self._make_product(self.ecotax_weight))
self._run_checks(
invoice,
{"amount_ecotax": 4.0, "amount_total": 114.4},
[{"ecotax_amount_unit": 4.0, "subtotal_ecotax": 4.0}],
)
new_qty = self._set_invoice_lines_random_quantities(invoice)[0]
self._run_checks(
invoice,
{"amount_ecotax": 4.0 * new_qty, "amount_total": 114.4 * new_qty},
[{"ecotax_amount_unit": 4.0, "subtotal_ecotax": 4.0 * new_qty}],
)
def test_04_mixed_ecotax(self):
"""Test mixed ecotax within the same invoice
Creating an invoice with 3 lines (one per type with types tested above)
Expected results (with 3 lines and qty = 1):
- invoice ecotax amount: 19.0
- invoice total amount: 350.9
- line ecotax unit amount (fixed ecotax): 5.0
- line ecotax total amount (fixed ecotax): 5.0
- line ecotax unit amount (manual ecotax): 10.0
- line ecotax total amount (manual ecotax): 10.0
- line ecotax unit amount (weight based ecotax): 4.0
- line ecotax total amount (weight based ecotax): 4.0
"""
default_fixed_product = self._make_product(self.ecotax_fixed)
manual_fixed_product = self._make_product(self.ecotax_fixed)
manual_fixed_product.ecotax_line_product_ids[0].force_amount = 10
weight_based_product = self._make_product(self.ecotax_weight)
invoice = self._make_invoice(
products=default_fixed_product | manual_fixed_product | weight_based_product
)
self._run_checks(
invoice,
{"amount_ecotax": 19.0, "amount_total": 350.9},
[
{"ecotax_amount_unit": 5.0, "subtotal_ecotax": 5.0},
{"ecotax_amount_unit": 10.0, "subtotal_ecotax": 10.0},
{"ecotax_amount_unit": 4.0, "subtotal_ecotax": 4.0},
],
)
new_qtys = self._set_invoice_lines_random_quantities(invoice)
self._run_checks(
invoice,
{
"amount_ecotax": 5.0 * new_qtys[0]
+ 10.0 * new_qtys[1]
+ 4.0 * new_qtys[2],
"amount_total": 115.5 * new_qtys[0]
+ 121.0 * new_qtys[1]
+ 114.4 * new_qtys[2],
},
[
{"ecotax_amount_unit": 5.0, "subtotal_ecotax": 5.0 * new_qtys[0]},
{"ecotax_amount_unit": 10.0, "subtotal_ecotax": 10.0 * new_qtys[1]},
{"ecotax_amount_unit": 4.0, "subtotal_ecotax": 4.0 * new_qtys[2]},
],
)
def test_05_product_variants(self):
"""
Data:
A product template with two variants
Test Case:
Add additional ecotax line to one variant
Expected result:
The additional ecotax line is not associated to second variant
the all ecotax lines of the variant contains both the ecotax
line of the product template and the additional ecotax line
"""
variants = self._make_product_variants(self.ecotax_fixed)
self.assertEqual(len(variants), 2)
variant_1 = variants[0]
variant_2 = variants[1]
self.assertEqual(
variant_1.all_ecotax_line_product_ids,
variant_2.all_ecotax_line_product_ids,
)
variant_1.additional_ecotax_line_product_ids = [
(
0,
0,
{
"classification_id": self.ecotax_weight.id,
},
)
]
all_additional_ecotax = (
variant_1.additional_ecotax_line_product_ids
| variant_1.product_tmpl_id.ecotax_line_product_ids
)
self.assertEqual(
len(variant_1.all_ecotax_line_product_ids),
2,
)
self.assertEqual(
len(variant_2.all_ecotax_line_product_ids),
1,
)
self.assertEqual(
variant_1.all_ecotax_line_product_ids,
all_additional_ecotax,
)
self.assertEqual(
variant_2.all_ecotax_line_product_ids,
variant_2.product_tmpl_id.ecotax_line_product_ids,
)

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (C) 2023 Akretion (http://www.akretion.com/)
@author: Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
-->
<odoo>
<record id="ecotax_classification_form" model="ir.ui.view">
<field name="model">account.ecotax.classification</field>
<field name="inherit_id" ref="account_ecotax.ecotax_classification_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='ecotax_settings']" position="after">
<separator string="Ecotaxes" />
<group col="4">
<field
name="sale_ecotax_ids"
quick_create="false"
widget="many2many_tags"
context="{'default_type_tax_use':'sale', 'search_default_sale': 1}"
/>
<field
name="purchase_ecotax_ids"
quick_create="false"
widget="many2many_tags"
context="{'default_type_tax_use':'purchase', 'search_default_purchase': 1}"
/>
</group>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_move_line_ecotax_form" model="ir.ui.view">
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account_ecotax.view_move_line_ecotax_form" />
<field name="arch" type="xml">
<field name="ecotax_line_ids" position="attributes">
<attribute name="readonly">1</attribute>
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (C) 2024 Akretion (http://www.akretion.com/)
@author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
-->
<odoo>
<record id="tax_form" model="ir.ui.view">
<field name="name">l10n_fr_ecotax.account.tax.form</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_form" />
<field name="priority">300</field>
<field name="arch" type="xml">
<field name="active" position="after">
<field name="is_ecotax" />
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Account_ecotax_tax Module - account_ecotax_tax
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for account_ecotax_tax. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,6 @@
# Dependencies
This addon depends on:
- [account_ecotax](../../odoo-bringout-oca-account-fiscal-rule-account_ecotax)
- [account_tax_python](../../odoo-bringout-oca-ocb-account_tax_python)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon account_ecotax_tax or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-account-fiscal-rule-account_ecotax_tax"
# or
uv pip install odoo-bringout-oca-account-fiscal-rule-account_ecotax_tax"
```

View file

@ -0,0 +1,14 @@
# Models
Detected core models and extensions in account_ecotax_tax.
```mermaid
classDiagram
class account_ecotax_classification
class account_move_line
class account_tax
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: account_ecotax_tax. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon account_ecotax_tax
- License: LGPL-3

View file

@ -0,0 +1,22 @@
# Reports
Report definitions and templates in account_ecotax_tax.
```mermaid
classDiagram
```
## Available Reports
No named reports found in XML files.
## Report Files
- **invoice.xml** (XML template/definition)
## Notes
- Named reports above are accessible through Odoo's reporting menu
- Python files define report logic and data processing
- XML files contain report templates, definitions, and formatting
- Reports are integrated with Odoo's printing and email systems

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon account_ecotax_tax
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-account-fiscal-rule-account_ecotax_tax"
version = "16.0.0"
description = "Ecotax Management (with Odoo tax) - Use Odoo tax mechanism to compute the ecotaxes "
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-account-fiscal-rule-account_ecotax>=16.0.0",
"odoo-bringout-oca-account-fiscal-rule-account_tax_python>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["account_ecotax_tax"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]