Skip to content

Commit

Permalink
[MIG] product_pricelist_fixed_currency_rate: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kobros-tech committed Oct 13, 2024
1 parent 06287dc commit 68a99f0
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 69 deletions.
39 changes: 22 additions & 17 deletions product_pricelist_fixed_currency_rate/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ Product Pricelist Fixed Currency Rate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/16.0/product_pricelist_fixed_currency_rate
:target: https://github.com/OCA/product-attribute/tree/17.0/product_pricelist_fixed_currency_rate
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_fixed_currency_rate
:target: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_fixed_currency_rate
: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/product-attribute&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=17.0
:alt: Try me on Runboat

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

This module extends the product pricelists feature to allow to set a fixed
currency rate to convert from a pricelist with a different currency.
This module extends the product pricelists feature to allow to set a
fixed currency rate to convert from a pricelist with a different
currency.

**Table of contents**

Expand All @@ -41,10 +42,10 @@ Usage

When using advanced price rules:

#. Go to a pricelist and create a pricelist with a given currency.
#. Create a new pricelist rule with computation formula.
#. Make it based on other pricelist that uses a different currency.
#. *Fixed Currency Rate* will show up, set a value.
1. Go to a pricelist and create a pricelist with a given currency.
2. Create a new pricelist rule with computation formula.
3. Make it based on other pricelist that uses a different currency.
4. *Fixed Currency Rate* will show up, set a value.

This will force the currency conversion to always use the specified
*Fixed Currency Rate* rate when using this pricelist.
Expand All @@ -55,25 +56,26 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_pricelist_fixed_currency_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_pricelist_fixed_currency_rate%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
~~~~~~~
-------

* ForgeFlow

Contributors
~~~~~~~~~~~~
------------

* Lois Rilo <lois.rilo@forgeflow.com>
- Lois Rilo <lois.rilo@forgeflow.com>
- Mohamed Alkobrosli <mohamed@kobros-tech.com>

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

This module is maintained by the OCA.

Expand All @@ -88,11 +90,14 @@ promote its widespread use.
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow
.. |maintainer-kobros-tech| image:: https://github.com/kobros-tech.png?size=40px
:target: https://github.com/kobros-tech
:alt: kobros-tech

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-LoisRForgeFlow|
|maintainer-LoisRForgeFlow| |maintainer-kobros-tech|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_pricelist_fixed_currency_rate>`_ project on GitHub.
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/17.0/product_pricelist_fixed_currency_rate>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions product_pricelist_fixed_currency_rate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
{
"name": "Product Pricelist Fixed Currency Rate",
"summary": "Set a fixed currency rate between pricelists",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Product",
"website": "https://github.com/OCA/product-attribute",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow"],
"maintainers": ["LoisRForgeFlow", "kobros-tech"],
"license": "AGPL-3",
"application": False,
"installable": True,
Expand Down
3 changes: 3 additions & 0 deletions product_pricelist_fixed_currency_rate/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions product_pricelist_fixed_currency_rate/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Lois Rilo \<<lois.rilo@forgeflow.com>\>
- Mohamed Alkobrosli \<<mohamed@kobros-tech.com>\>

This file was deleted.

3 changes: 3 additions & 0 deletions product_pricelist_fixed_currency_rate/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module extends the product pricelists feature to allow to set a
fixed currency rate to convert from a pricelist with a different
currency.
2 changes: 0 additions & 2 deletions product_pricelist_fixed_currency_rate/readme/DESCRIPTION.rst

This file was deleted.

9 changes: 9 additions & 0 deletions product_pricelist_fixed_currency_rate/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
When using advanced price rules:

1. Go to a pricelist and create a pricelist with a given currency.
2. Create a new pricelist rule with computation formula.
3. Make it based on other pricelist that uses a different currency.
4. *Fixed Currency Rate* will show up, set a value.

This will force the currency conversion to always use the specified
*Fixed Currency Rate* rate when using this pricelist.
9 changes: 0 additions & 9 deletions product_pricelist_fixed_currency_rate/readme/USAGE.rst

This file was deleted.

56 changes: 30 additions & 26 deletions product_pricelist_fixed_currency_rate/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Product Pricelist Fixed Currency Rate</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z 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 http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
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,24 +369,25 @@ <h1 class="title">Product Pricelist Fixed Currency Rate</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:705f94a56352ec7c69ab3d351588f96a01ef2266e347c800f32094d29d3de741
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/product-attribute/tree/16.0/product_pricelist_fixed_currency_rate"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_fixed_currency_rate"><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/product-attribute&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 extends the product pricelists feature to allow to set a fixed
currency rate to convert from a pricelist with a different currency.</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/product-attribute/tree/17.0/product_pricelist_fixed_currency_rate"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_pricelist_fixed_currency_rate"><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/product-attribute&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 extends the product pricelists feature to allow to set a
fixed currency rate to convert from a pricelist with a different
currency.</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="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>When using advanced price rules:</p>
<ol class="arabic simple">
<li>Go to a pricelist and create a pricelist with a given currency.</li>
Expand All @@ -398,37 +399,40 @@ <h1><a class="toc-backref" href="#id1">Usage</a></h1>
<em>Fixed Currency Rate</em> rate when using this pricelist.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_pricelist_fixed_currency_rate%0Aversion:%2016.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/product-attribute/issues/new?body=module:%20product_pricelist_fixed_currency_rate%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">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>ForgeFlow</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Mohamed Alkobrosli &lt;<a class="reference external" href="mailto:mohamed&#64;kobros-tech.com">mohamed&#64;kobros-tech.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/LoisRForgeFlow"><img alt="LoisRForgeFlow" src="https://github.com/LoisRForgeFlow.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/16.0/product_pricelist_fixed_currency_rate">OCA/product-attribute</a> project on GitHub.</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/LoisRForgeFlow"><img alt="LoisRForgeFlow" src="https://github.com/LoisRForgeFlow.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/kobros-tech"><img alt="kobros-tech" src="https://github.com/kobros-tech.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/17.0/product_pricelist_fixed_currency_rate">OCA/product-attribute</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
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,54 @@ def test_02_auxiliary_fields(self):
item = self.pricelist_usd_fixed_rate.item_ids
self.assertTrue(item.is_fixed_currency_rate_applicable)
self.assertEqual(item.actual_currency_rate, 1.5)

def test_03_currency_rate_tooltip(self):
item = self.pricelist_usd_fixed_rate.item_ids

# Case 1
item.do_inverse_currency_rate = True
curr_from = item.pricelist_id.currency_id
curr_to = item.base_pricelist_id.currency_id
currency_rate_tooltip = f"({curr_from.name} to {curr_to.name} rates)"
self.assertEqual(item.currency_rate_tooltip, currency_rate_tooltip)

# Case 2
item.do_inverse_currency_rate = False
curr_from = item.base_pricelist_id.currency_id
curr_to = item.pricelist_id.currency_id
currency_rate_tooltip = f"({curr_from.name} to {curr_to.name} rates)"
self.assertEqual(item.currency_rate_tooltip, currency_rate_tooltip)

def test_04_inverse_fixed_currency_rate(self):
item = self.pricelist_usd_fixed_rate.item_ids
inverse_fixed_currency_rate = (
1 / item.fixed_currency_rate if item.fixed_currency_rate else 0.0
)
self.assertEqual(item.inverse_fixed_currency_rate, inverse_fixed_currency_rate)

def test_05_fixed_currency_rate(self):
item = self.pricelist_usd_fixed_rate.item_ids

# Case 1
item.fixed_currency_rate = 0.5
fixed_currency_rate = (
1 / item.inverse_fixed_currency_rate
if item.inverse_fixed_currency_rate
else 0.0
)
self.assertEqual(item.fixed_currency_rate, fixed_currency_rate)

# Case 2
item.fixed_currency_rate = 1
fixed_currency_rate = (
1 / item.inverse_fixed_currency_rate
if item.inverse_fixed_currency_rate
else 0.0
)
self.assertEqual(item.fixed_currency_rate, fixed_currency_rate)

def test_06_do_inverse_currency_rate(self):
item = self.pricelist_usd_fixed_rate.item_ids
do_inverse_currency_rate = not item.do_inverse_currency_rate
item.toggle_do_inverse_currency_rate()
self.assertEqual(item.do_inverse_currency_rate, do_inverse_currency_rate)
Loading

0 comments on commit 68a99f0

Please sign in to comment.