Skip to content

Commit

Permalink
[MIG] contract_variable_quantity: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa committed Jan 5, 2024
1 parent 276c86f commit ae8947a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
15 changes: 8 additions & 7 deletions contract_variable_quantity/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Variable quantity in contract recurrent invoicing
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:648dc147c00023bfda1595708efb6802c3ae0216215f6f4922a667f890e3180f
!! source digest: sha256:f186109da38da1bb524348308da9f6f58d233204f646f60e843ce133deeacf09
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Variable quantity in contract recurrent invoicing
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/15.0/contract_variable_quantity
:target: https://github.com/OCA/contract/tree/16.0/contract_variable_quantity
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_variable_quantity
:target: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_quantity
: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/contract&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -52,7 +52,7 @@ Configuration
* *contract*: Contract whose line belongs to.
* *invoice*: Invoice (header) being created.

.. figure:: https://raw.githubusercontent.com/OCA/contract/15.0/contract_variable_quantity/images/formula_form.png
.. figure:: https://raw.githubusercontent.com/OCA/contract/16.0/contract_variable_quantity/images/formula_form.png
:alt: Formula form
:width: 600 px

Expand All @@ -73,7 +73,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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/contract/issues/new?body=module:%20contract_variable_quantity%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_quantity%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.

Expand All @@ -93,6 +93,7 @@ Contributors
* Pedro M. Baeza
* Carlos Roca
* Víctor Martínez
* Carolina Fernandez

* Dave Lasley <[email protected]>
* Souheil Bejaoui <[email protected]>
Expand All @@ -110,6 +111,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/contract <https://github.com/OCA/contract/tree/15.0/contract_variable_quantity>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/16.0/contract_variable_quantity>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 2 additions & 1 deletion contract_variable_quantity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright 2016-2019 Tecnativa - Pedro M. Baeza
# Copyright 2018 Tecnativa - Carlos Dauden
# Copyright 2019 ACSONE SA/NV
# Copyright 2024 Tecnativa - Carolina fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Variable quantity in contract recurrent invoicing",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Contract Management",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
5 changes: 3 additions & 2 deletions contract_variable_quantity/models/contract_line.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2016 Tecnativa - Pedro M. Baeza
# Copyright 2018 Tecnativa - Carlos Dauden
# Copyright 2018 ACSONE SA/NV
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models
Expand Down Expand Up @@ -40,8 +41,8 @@ def _get_quantity_to_invoice(
quantity = eval_context.get("result", 0)
return quantity

def _prepare_invoice_line(self, move_form):
vals = super()._prepare_invoice_line(move_form)
def _prepare_invoice_line(self):
vals = super()._prepare_invoice_line()
if (
"quantity" in vals
and self.contract_id.skip_zero_qty
Expand Down
1 change: 1 addition & 0 deletions contract_variable_quantity/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Pedro M. Baeza
* Carlos Roca
* Víctor Martínez
* Carolina Fernandez

* Dave Lasley <[email protected]>
* Souheil Bejaoui <[email protected]>
11 changes: 6 additions & 5 deletions contract_variable_quantity/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Variable quantity in contract recurrent invoicing</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:648dc147c00023bfda1595708efb6802c3ae0216215f6f4922a667f890e3180f
!! source digest: sha256:f186109da38da1bb524348308da9f6f58d233204f646f60e843ce133deeacf09
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/contract/tree/15.0/contract_variable_quantity"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_variable_quantity"><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/contract&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><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/contract/tree/16.0/contract_variable_quantity"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_quantity"><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/contract&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>With this module, you will be able to define in recurring contracts some
lines with variable quantity according to a provided formula.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -405,7 +405,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
</li>
</ol>
<div class="figure">
<img alt="Formula form" src="https://raw.githubusercontent.com/OCA/contract/15.0/contract_variable_quantity/images/formula_form.png" style="width: 600px;" />
<img alt="Formula form" src="https://raw.githubusercontent.com/OCA/contract/16.0/contract_variable_quantity/images/formula_form.png" style="width: 600px;" />
</div>
</div>
<div class="section" id="usage">
Expand All @@ -424,7 +424,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/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/contract/issues/new?body=module:%20contract_variable_quantity%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/contract/issues/new?body=module:%20contract_variable_quantity%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">
Expand All @@ -444,6 +444,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Pedro M. Baeza</li>
<li>Carlos Roca</li>
<li>Víctor Martínez</li>
<li>Carolina Fernandez</li>
</ul>
</blockquote>
</li>
Expand All @@ -460,7 +461,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<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/contract/tree/15.0/contract_variable_quantity">OCA/contract</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/16.0/contract_variable_quantity">OCA/contract</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
28 changes: 15 additions & 13 deletions contract_variable_quantity/tests/test_contract_variable_quantity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2016 Tecnativa - Pedro M. Baeza
# Copyright 2018 Tecnativa - Carlos Dauden
# Copyright 2018 ACSONE SA/NV
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import exceptions
Expand All @@ -10,18 +11,19 @@

@tagged("post_install", "-at_install")
class TestContractVariableQuantity(TransactionCase):
def setUp(self):
super().setUp()
self.partner = self.env["res.partner"].create({"name": "Test partner"})
self.product = self.env["product.product"].create({"name": "Test product"})
self.contract = self.env["contract.contract"].create(
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
cls.product = cls.env["product.product"].create({"name": "Test product"})
cls.contract = cls.env["contract.contract"].create(
{
"name": "Test Contract",
"partner_id": self.partner.id,
"pricelist_id": self.partner.property_product_pricelist.id,
"partner_id": cls.partner.id,
"pricelist_id": cls.partner.property_product_pricelist.id,
}
)
self.formula = self.env["contract.line.qty.formula"].create(
cls.formula = cls.env["contract.line.qty.formula"].create(
{
"name": "Test formula",
# For testing each of the possible variables
Expand All @@ -37,15 +39,15 @@ def setUp(self):
"result = 12",
}
)
self.contract_line = self.env["contract.line"].create(
cls.contract_line = cls.env["contract.line"].create(
{
"contract_id": self.contract.id,
"product_id": self.product.id,
"contract_id": cls.contract.id,
"product_id": cls.product.id,
"name": "Test",
"qty_type": "variable",
"qty_formula_id": self.formula.id,
"qty_formula_id": cls.formula.id,
"quantity": 1,
"uom_id": self.product.uom_id.id,
"uom_id": cls.product.uom_id.id,
"price_unit": 100,
"discount": 50,
"recurring_rule_type": "monthly",
Expand Down

0 comments on commit ae8947a

Please sign in to comment.