Skip to content

Commit

Permalink
[MIG] l10n_fr_ecotaxe_sale: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yankinmax committed Jun 3, 2024
1 parent 1ac43e4 commit 0205ad8
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 35 deletions.
22 changes: 12 additions & 10 deletions l10n_fr_ecotaxe_sale/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ France sale Ecotaxe
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-france/tree/15.0/l10n_fr_ecotaxe_sale
:target: https://github.com/OCA/l10n-france/tree/17.0/l10n_fr_ecotaxe_sale
:alt: OCA/l10n-france
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-france-15-0/l10n-france-15-0-l10n_fr_ecotaxe_sale
:target: https://translation.odoo-community.org/projects/l10n-france-17-0/l10n-france-17-0-l10n_fr_ecotaxe_sale
: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/l10n-france&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-france&target_branch=17.0
:alt: Try me on Runboat

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

This module is an extension of the module *l10n_fr_ecotaxe* for sale orders. Please refer to the README of the module *l10n_fr_ecotaxe* for more info about ecotaxe management.
This module is an extension of the module *l10n_fr_ecotaxe* for sale
orders. Please refer to the README of the module *l10n_fr_ecotaxe* for
more info about ecotaxe management.

**Table of contents**

Expand All @@ -41,25 +43,25 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/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/l10n-france/issues/new?body=module:%20l10n_fr_ecotaxe_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-france/issues/new?body=module:%20l10n_fr_ecotaxe_sale%0Aversion:%2017.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 <[email protected]>
- Mourad EL HADJ MIMOUNE <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -71,6 +73,6 @@ 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/l10n-france <https://github.com/OCA/l10n-france/tree/15.0/l10n_fr_ecotaxe_sale>`_ project on GitHub.
This module is part of the `OCA/l10n-france <https://github.com/OCA/l10n-france/tree/17.0/l10n_fr_ecotaxe_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion l10n_fr_ecotaxe_sale/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "France sale Ecotaxe",
"summary": "Sale Ecotaxe used in French localisation contexte",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-france",
"category": "Localization/Account Taxes",
Expand Down
2 changes: 0 additions & 2 deletions l10n_fr_ecotaxe_sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class SaleOrderLine(models.Model):

_inherit = "sale.order.line"

subtotal_ecotaxe = fields.Float(store=True, compute="_compute_ecotaxe")
Expand All @@ -28,7 +27,6 @@ def _compute_ecotaxe(self):


class SaleOrder(models.Model):

_inherit = "sale.order"

amount_ecotaxe = fields.Float(
Expand Down
3 changes: 3 additions & 0 deletions l10n_fr_ecotaxe_sale/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions l10n_fr_ecotaxe_sale/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Mourad EL HADJ MIMOUNE \<<[email protected]>\>
1 change: 0 additions & 1 deletion l10n_fr_ecotaxe_sale/readme/CONTRIBUTORS.rst

This file was deleted.

3 changes: 3 additions & 0 deletions l10n_fr_ecotaxe_sale/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module is an extension of the module *l10n_fr_ecotaxe* for sale
orders. Please refer to the README of the module *l10n_fr_ecotaxe* for
more info about ecotaxe management.
1 change: 0 additions & 1 deletion l10n_fr_ecotaxe_sale/readme/DESCRIPTION.rst

This file was deleted.

22 changes: 13 additions & 9 deletions l10n_fr_ecotaxe_sale/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!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>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
: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.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
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 }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,8 +369,10 @@ <h1 class="title">France sale Ecotaxe</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:542c487695c1256aa8a4eb4233fe22bd505a03ab0743b7381a858db149b7706e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-france/tree/15.0/l10n_fr_ecotaxe_sale"><img alt="OCA/l10n-france" src="https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-france-15-0/l10n-france-15-0-l10n_fr_ecotaxe_sale"><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/l10n-france&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is an extension of the module <em>l10n_fr_ecotaxe</em> for sale orders. Please refer to the README of the module <em>l10n_fr_ecotaxe</em> for more info about ecotaxe management.</p>
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-france/tree/17.0/l10n_fr_ecotaxe_sale"><img alt="OCA/l10n-france" src="https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-france-17-0/l10n-france-17-0-l10n_fr_ecotaxe_sale"><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/l10n-france&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is an extension of the module <em>l10n_fr_ecotaxe</em> for sale
orders. Please refer to the README of the module <em>l10n_fr_ecotaxe</em> for
more info about ecotaxe management.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -388,7 +390,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-france/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/l10n-france/issues/new?body=module:%20l10n_fr_ecotaxe_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-france/issues/new?body=module:%20l10n_fr_ecotaxe_sale%0Aversion:%2017.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">
Expand All @@ -408,11 +410,13 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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>
<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>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-france/tree/15.0/l10n_fr_ecotaxe_sale">OCA/l10n-france</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-france/tree/17.0/l10n_fr_ecotaxe_sale">OCA/l10n-france</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>
Expand Down
36 changes: 25 additions & 11 deletions l10n_fr_ecotaxe_sale/tests/test_sale_ecotaxe.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,44 @@
@tagged("-at_install", "post_install")
class TestsaleEcotaxe(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=""):
super(TestsaleEcotaxe, cls).setUpClass(chart_template_ref)
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))

cls.ecotaxe_classification = cls.env["account.ecotaxe.classification"]
cls.ecotaxe_classification1 = cls.ecotaxe_classification.create(
{
"name": "Fixed Ecotaxe",
"ecotaxe_type": "fixed",
"default_fixed_ecotaxe": 2.4,
"ecotaxe_product_status": "M",
"ecotaxe_supplier_status": "FAB",
"product_status": "M",
"supplier_status": "FAB",
}
)
cls.ecotaxe_classification2 = cls.ecotaxe_classification.create(
{
"name": "Weight based",
"ecotaxe_type": "weight_based",
"ecotaxe_coef": 0.04,
"ecotaxe_product_status": "P",
"ecotaxe_supplier_status": "FAB",
"product_status": "P",
"supplier_status": "FAB",
}
)
cls.ecotaxe_line_product = cls.env["ecotaxe.line.product"]
cls.ecotaxe_line_product1 = cls.ecotaxe_line_product.create(
{
"classification_id": cls.ecotaxe_classification1.id,
"product_id": cls.product_a.id,
}
)
cls.ecotaxe_line_product2 = cls.ecotaxe_line_product.create(
{
"classification_id": cls.ecotaxe_classification2.id,
"product_id": cls.product_b.id,
}
)
cls.product_a.weight = 100
cls.product_a.ecotaxe_classification_id = cls.ecotaxe_classification1.id
cls.product_b.weight = 400
cls.product_b.ecotaxe_classification_id = cls.ecotaxe_classification2.id

def create_sale_partner(self, partner_id, product_id, sale_amount=0.00):
order = self.env["sale.order"].create(
Expand All @@ -57,17 +69,19 @@ def create_sale_partner(self, partner_id, product_id, sale_amount=0.00):

return order

def test_01_manual_fixed_ecotaxe(self):
def test_01_fixed_ecotaxes(self):
"""Tests multiple lines with fixed ecotaxes"""
# in order to test the correct assignment of fixed ecotaxe
# I create a customer sale.
partner12 = self.env.ref("base.res_partner_12")
self.sale = self.create_sale_partner(
sale_amount=100.00, partner_id=partner12, product_id=self.product_a
)
# I assign a product with fixed ecotaxte to sale line
# ecotaxe amount should be equal to ``default_fixed_ecotaxe``
self.assertEqual(self.product_a.ecotaxe_amount, 2.4)
# we force an amount for ``all_ecotaxe_line_product_ids``
self.product_a.all_ecotaxe_line_product_ids.force_amount = 1.5
self.sale_line1 = self.sale.order_line[0]
self.product_a.manual_fixed_ecotaxe = 1.5
# make sure to have 1 tax and fix tax rate
self.sale_line1.tax_id = self.sale_line1.tax_id[0]
self.sale_line1.tax_id.amount = 20
Expand Down

0 comments on commit 0205ad8

Please sign in to comment.