Skip to content

Commit

Permalink
[17.0][MIG] account_ecotax: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yankinmax committed Jun 18, 2024
1 parent 21a5c2f commit 0e2a34c
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 221 deletions.
44 changes: 22 additions & 22 deletions account_ecotax/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@ This module applies to companies based in France mainland. It doesn't
apply to companies based in the DOM-TOMs (Guadeloupe, Martinique,
Guyane, Réunion, Mayotte).

It add Ecotaxe amount on invoice line. furthermore, a total ecotaxe are
It add Ecotax amount on invoice line. furthermore, a total ecotax are
added at the footer of each document.

To make easy ecotaxe management and to factor the data, ecotaxe are set
on products via ECOTAXE classifications. ECOTAXE classification can
either a fixed or weight based ecotaxe.
To make easy ecotax management and to factor the data, ecotax are set on
products via ECOTAXE classifications. ECOTAXE classification can either
a fixed or weight based ecotax.

A product can have one or serveral ecotaxe classifications. For exemple
wooden window blinds equipped with electric motor can have ecotaxe for
wood and ecotaxe for electric motor.
A product can have one or serveral ecotax classifications. For exemple
wooden window blinds equipped with electric motor can have ecotax for
wood and ecotax for electric motor.

This module version add the possibility to manage several ecotaxe
This module version add the possibility to manage several ecotax
classification by product. A migration script is necessary to update
from previous versions.

There is the main change to manage in migration script:

renamed field model old field new field account.move.line
unit_ecotaxe_amount ecotaxe_amount_unit product.template
manual_fixed_ecotaxe force_ecotaxe_amount
unit_ecotax_amount ecotax_amount_unit product.template
manual_fixed_ecotax force_ecotax_amount

changed fields model old field new field product.template
ecotaxe_classification_id ecotaxe_classification_ids
ecotax_classification_id ecotax_classification_ids

added fields model new field account.move.line ecotaxe_line_ids
product.template ecotaxe_line_product_ids
added fields model new field account.move.line ecotax_line_ids
product.template ecotax_line_product_ids

**Table of contents**

Expand All @@ -67,18 +67,18 @@ product.template ecotaxe_line_product_ids
Usage
=====

Add ecotaxe classification via the menu *Accounting > configuration >
Taxes > Ecotaxe Classification*. Ecotaxe classification is either a
fixed ecotaxe or weight based ecotaxe. ecotaxe classification Infos can
be used for legal declarations. For fixed ecotaxe, ecotaxe amount is
used as default value. We can for ecotaxe amount on product.
Add ecotax classification via the menu *Accounting > configuration >
Taxes > Ecotax Classification*. Ecotax classification is either a fixed
ecotax or weight based ecotax. ecotax classification Infos can be used
for legal declarations. For fixed ecotax, ecotax amount is used as
default value. We can for ecotax amount on product.

For weight based ecotaxe, we should define one ecotaxe by coef applied
for the weight (depending on product materials).
For weight based ecotax, we should define one ecotax by coef applied for
the weight (depending on product materials).

Assign one or more ecotaxe classification to a product.
Assign one or more ecotax classification to a product.

we can also force amount ecotaxe on account move line by classification.
we can also force amount ecotax on account move line by classification.

Bug Tracker
===========
Expand Down
7 changes: 4 additions & 3 deletions account_ecotax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Ecotax Management",
"summary": "Ecotax Management: in French context is a 'cost' "
"added to the sale price of electrical or electronic appliances or furnishing items",
"version": "16.0.1.0.0",
"summary": "Ecotax Management: in French context is a 'cost' "
"added to the sale price of electrical "
"or electronic appliances or furnishing items",
"version": "17.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-fiscal-rule",
"category": "Localization/Account Taxes",
Expand Down
2 changes: 1 addition & 1 deletion account_ecotax/data/decimal_precision.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="ecotaxe_decimal" model="decimal.precision">
<record id="ecotax_decimal" model="decimal.precision">
<field name="name">Ecotax</field>
<field name="digits">4</field>
</record>
Expand Down
1 change: 1 addition & 0 deletions account_ecotax/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def _compute_ecotax(self):
for move in self:
move.amount_ecotax = sum(move.line_ids.mapped("subtotal_ecotax"))

# TODO: This method is not used anymore, rewrite it to use the new
@api.model
def _get_tax_totals(
self, partner, tax_lines_data, amount_total, amount_untaxed, currency
Expand Down
8 changes: 4 additions & 4 deletions account_ecotax/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ def _get_computed_taxes(self):
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(
sale_ecotaxes = self.product_id.all_ecotax_line_product_ids.mapped(
"classification_id"
).mapped("sale_ecotax_ids")
ecotax_ids = sale_ecotaxs.filtered(
ecotax_ids = sale_ecotaxes.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(
purchase_ecotaxes = self.product_id.all_ecotax_line_product_ids.mapped(
"classification_id"
).mapped("purchase_ecotax_ids")
ecotax_ids = purchase_ecotaxs.filtered(
ecotax_ids = purchase_ecotaxes.filtered(
lambda tax: tax.company_id == self.move_id.company_id
)

Expand Down
9 changes: 3 additions & 6 deletions account_ecotax/models/account_move_line_ecotax.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ class AccountMoveLineEcotax(models.Model):
comodel_name="account.move.line",
string="Account move line",
required=True,
readonly=True,
index=True,
auto_join=True,
ondelete="cascade",
)
product_id = fields.Many2one(
"product.product", related="account_move_line_id.product_id", readonly=True
)
quantity = fields.Float(related="account_move_line_id.quantity", readonly=True)
currency_id = fields.Many2one(
related="account_move_line_id.currency_id", readonly=True
"product.product", related="account_move_line_id.product_id"
)
quantity = fields.Float(related="account_move_line_id.quantity")
currency_id = fields.Many2one(related="account_move_line_id.currency_id")
8 changes: 4 additions & 4 deletions account_ecotax/models/ecotax_line_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EcotaxLineMixin(models.AbstractModel):
_name = "ecotax.line.mixin"
_description = "Ecotax Line Mixin"

product_id = fields.Many2one("product.product", string="Product", readonly=True)
product_id = fields.Many2one("product.product", string="Product")
currency_id = fields.Many2one("res.currency", string="Currency")
classification_id = fields.Many2one(
"account.ecotax.classification",
Expand All @@ -22,7 +22,7 @@ class EcotaxLineMixin(models.AbstractModel):
amount_unit = fields.Float(
digits="Ecotax",
compute="_compute_ecotax",
help="Ecotax Amount computed form Classification or Manuel ecotax",
help="Ecotax Amount computed from Classification or Manual ecotax",
store=True,
)
force_amount_unit = fields.Float(
Expand All @@ -32,10 +32,10 @@ class EcotaxLineMixin(models.AbstractModel):
amount_total = fields.Float(
digits="Ecotax",
compute="_compute_ecotax",
help="Ecotax Amount total computed form Classification or forced ecotax amount",
help="Ecotax Amount total computed from Classification or forced ecotax amount",
store=True,
)
quantity = fields.Float(digits="Product Unit of Measure", readonly=True)
quantity = fields.Float(digits="Product Unit of Measure")

@api.depends(
"classification_id",
Expand Down
18 changes: 7 additions & 11 deletions account_ecotax/models/ecotax_line_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@


class EcotaxLineProduct(models.Model):
"""class for objects which can be used to save mutili ecotax calssification by product."""
"""Class for objects which can be used to save
mutili ecotax calssification by product."""

_name = "ecotax.line.product"
_description = "Ecotax Line product"

product_tmpl_id = fields.Many2one(
"product.template", string="Product Template", readonly=True
)
product_id = fields.Many2one("product.product", string="Product", readonly=True)
currency_id = fields.Many2one(related="product_tmpl_id.currency_id", readonly=True)
product_tmpl_id = fields.Many2one("product.template", string="Product Template")
product_id = fields.Many2one("product.product", string="Product")
currency_id = fields.Many2one(related="product_tmpl_id.currency_id")
classification_id = fields.Many2one(
"account.ecotax.classification",
string="Classification",
Expand All @@ -28,18 +27,15 @@ class EcotaxLineProduct(models.Model):
amount = fields.Float(
digits="Ecotax",
compute="_compute_ecotax",
help="Ecotax Amount computed form Classification or forced ecotax amount",
help="Ecotax Amount computed from Classification or forced ecotax amount",
store=True,
)
display_name = fields.Char(compute="_compute_display_name")

@api.depends("classification_id", "amount")
def _compute_display_name(self):
for rec in self:
rec.display_name = "%s (%s)" % (
rec.classification_id.name,
rec.amount,
)
rec.display_name = f"{rec.classification_id.name} ({rec.amount})"

@api.depends(
"classification_id",
Expand Down
6 changes: 3 additions & 3 deletions account_ecotax/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class ProductProduct(models.Model):
compute="_compute_all_ecotax_line_product_ids",
search="_search_all_ecotax_line_product_ids",
string="All ecotax lines",
help="Contain all ecotaxs classification defined in product template"
help="Contain all ecotaxes classification defined in product template"
"and the additionnal.\n"
"ecotaxs defined in product variant. For more details"
"ecotaxes defined in product variant. For more details"
"see the product variant accounting tab",
)
ecotax_amount = fields.Float(
digits="Ecotax",
compute="_compute_product_ecotax",
store=True,
help="Ecotax Amount computed form all ecotax line classification",
help="Ecotax Amount computed from all ecotax line classification",
)
fixed_ecotax = fields.Float(
compute="_compute_product_ecotax",
Expand Down
2 changes: 1 addition & 1 deletion account_ecotax/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ProductTemplate(models.Model):
ecotax_amount = fields.Float(
digits="Ecotax",
compute="_compute_ecotax",
help="Ecotax Amount computed form Classification",
help="Ecotax Amount computed from Classification",
store=True,
)
fixed_ecotax = fields.Float(
Expand Down
24 changes: 12 additions & 12 deletions account_ecotax/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ This module applies to companies based in France mainland. It doesn't
apply to companies based in the DOM-TOMs (Guadeloupe, Martinique,
Guyane, Réunion, Mayotte).

It add Ecotaxe amount on invoice line. furthermore, a total ecotaxe are
It add Ecotax amount on invoice line. furthermore, a total ecotax are
added at the footer of each document.

To make easy ecotaxe management and to factor the data, ecotaxe are set
To make easy ecotax management and to factor the data, ecotax are set
on products via ECOTAXE classifications. ECOTAXE classification can
either a fixed or weight based ecotaxe.
either a fixed or weight based ecotax.

A product can have one or serveral ecotaxe classifications. For exemple
wooden window blinds equipped with electric motor can have ecotaxe for
wood and ecotaxe for electric motor.
A product can have one or serveral ecotax classifications. For exemple
wooden window blinds equipped with electric motor can have ecotax for
wood and ecotax for electric motor.

This module version add the possibility to manage several ecotaxe
This module version add the possibility to manage several ecotax
classification by product. A migration script is necessary to update
from previous versions.

There is the main change to manage in migration script:

renamed field model old field new field account.move.line
unit_ecotaxe_amount ecotaxe_amount_unit product.template
manual_fixed_ecotaxe force_ecotaxe_amount
unit_ecotax_amount ecotax_amount_unit product.template
manual_fixed_ecotax force_ecotax_amount

changed fields model old field new field product.template
ecotaxe_classification_id ecotaxe_classification_ids
ecotax_classification_id ecotax_classification_ids

added fields model new field account.move.line ecotaxe_line_ids
product.template ecotaxe_line_product_ids
added fields model new field account.move.line ecotax_line_ids
product.template ecotax_line_product_ids
16 changes: 8 additions & 8 deletions account_ecotax/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Add ecotaxe classification via the menu *Accounting \> configuration \>
Taxes \> Ecotaxe Classification*. Ecotaxe classification is either a
fixed ecotaxe or weight based ecotaxe. ecotaxe classification Infos can
be used for legal declarations. For fixed ecotaxe, ecotaxe amount is
used as default value. We can for ecotaxe amount on product.
Add ecotax classification via the menu *Accounting \> configuration \>
Taxes \> Ecotax Classification*. Ecotax classification is either a
fixed ecotax or weight based ecotax. ecotax classification Infos can
be used for legal declarations. For fixed ecotax, ecotax amount is
used as default value. We can for ecotax amount on product.

For weight based ecotaxe, we should define one ecotaxe by coef applied
For weight based ecotax, we should define one ecotax by coef applied
for the weight (depending on product materials).

Assign one or more ecotaxe classification to a product.
Assign one or more ecotax classification to a product.

we can also force amount ecotaxe on account move line by classification.
we can also force amount ecotax on account move line by classification.
44 changes: 22 additions & 22 deletions account_ecotax/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,25 +373,25 @@ <h1 class="title">Ecotax Management</h1>
<p>This module applies to companies based in France mainland. It doesn’t
apply to companies based in the DOM-TOMs (Guadeloupe, Martinique,
Guyane, Réunion, Mayotte).</p>
<p>It add Ecotaxe amount on invoice line. furthermore, a total ecotaxe are
<p>It add Ecotax amount on invoice line. furthermore, a total ecotax are
added at the footer of each document.</p>
<p>To make easy ecotaxe management and to factor the data, ecotaxe are set
on products via ECOTAXE classifications. ECOTAXE classification can
either a fixed or weight based ecotaxe.</p>
<p>A product can have one or serveral ecotaxe classifications. For exemple
wooden window blinds equipped with electric motor can have ecotaxe for
wood and ecotaxe for electric motor.</p>
<p>This module version add the possibility to manage several ecotaxe
<p>To make easy ecotax management and to factor the data, ecotax are set on
products via ECOTAXE classifications. ECOTAXE classification can either
a fixed or weight based ecotax.</p>
<p>A product can have one or serveral ecotax classifications. For exemple
wooden window blinds equipped with electric motor can have ecotax for
wood and ecotax for electric motor.</p>
<p>This module version add the possibility to manage several ecotax
classification by product. A migration script is necessary to update
from previous versions.</p>
<p>There is the main change to manage in migration script:</p>
<p>renamed field model old field new field account.move.line
unit_ecotaxe_amount ecotaxe_amount_unit product.template
manual_fixed_ecotaxe force_ecotaxe_amount</p>
unit_ecotax_amount ecotax_amount_unit product.template
manual_fixed_ecotax force_ecotax_amount</p>
<p>changed fields model old field new field product.template
ecotaxe_classification_id ecotaxe_classification_ids</p>
<p>added fields model new field account.move.line ecotaxe_line_ids
product.template ecotaxe_line_product_ids</p>
ecotax_classification_id ecotax_classification_ids</p>
<p>added fields model new field account.move.line ecotax_line_ids
product.template ecotax_line_product_ids</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -407,15 +407,15 @@ <h1 class="title">Ecotax Management</h1>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Add ecotaxe classification via the menu <em>Accounting &gt; configuration &gt;
Taxes &gt; Ecotaxe Classification</em>. Ecotaxe classification is either a
fixed ecotaxe or weight based ecotaxe. ecotaxe classification Infos can
be used for legal declarations. For fixed ecotaxe, ecotaxe amount is
used as default value. We can for ecotaxe amount on product.</p>
<p>For weight based ecotaxe, we should define one ecotaxe by coef applied
for the weight (depending on product materials).</p>
<p>Assign one or more ecotaxe classification to a product.</p>
<p>we can also force amount ecotaxe on account move line by classification.</p>
<p>Add ecotax classification via the menu <em>Accounting &gt; configuration &gt;
Taxes &gt; Ecotax Classification</em>. Ecotax classification is either a fixed
ecotax or weight based ecotax. ecotax classification Infos can be used
for legal declarations. For fixed ecotax, ecotax amount is used as
default value. We can for ecotax amount on product.</p>
<p>For weight based ecotax, we should define one ecotax by coef applied for
the weight (depending on product materials).</p>
<p>Assign one or more ecotax classification to a product.</p>
<p>we can also force amount ecotax on account move line by classification.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
Expand Down
Loading

0 comments on commit 0e2a34c

Please sign in to comment.