From ae8947af62b1831fac93185a46f68aa585b8ffcd Mon Sep 17 00:00:00 2001 From: Carolina Fernandez Date: Fri, 5 Jan 2024 10:59:50 -0300 Subject: [PATCH] [MIG] contract_variable_quantity: Migration to 16.0 --- contract_variable_quantity/README.rst | 15 +++++----- contract_variable_quantity/__manifest__.py | 3 +- .../models/contract_line.py | 5 ++-- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 11 ++++---- .../tests/test_contract_variable_quantity.py | 28 ++++++++++--------- 6 files changed, 35 insertions(+), 28 deletions(-) diff --git a/contract_variable_quantity/README.rst b/contract_variable_quantity/README.rst index af8fcec122..d95df2aeee 100644 --- a/contract_variable_quantity/README.rst +++ b/contract_variable_quantity/README.rst @@ -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 @@ -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| @@ -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 @@ -73,7 +73,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -93,6 +93,7 @@ Contributors * Pedro M. Baeza * Carlos Roca * Víctor Martínez + * Carolina Fernandez * Dave Lasley * Souheil Bejaoui @@ -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 `_ project on GitHub. +This module is part of the `OCA/contract `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_variable_quantity/__manifest__.py b/contract_variable_quantity/__manifest__.py index 9d315efd94..32f358f549 100644 --- a/contract_variable_quantity/__manifest__.py +++ b/contract_variable_quantity/__manifest__.py @@ -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)", diff --git a/contract_variable_quantity/models/contract_line.py b/contract_variable_quantity/models/contract_line.py index 9e9b7a23c2..6a1bb94d51 100644 --- a/contract_variable_quantity/models/contract_line.py +++ b/contract_variable_quantity/models/contract_line.py @@ -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 @@ -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 diff --git a/contract_variable_quantity/readme/CONTRIBUTORS.rst b/contract_variable_quantity/readme/CONTRIBUTORS.rst index 77080776a3..a98f7f09b9 100644 --- a/contract_variable_quantity/readme/CONTRIBUTORS.rst +++ b/contract_variable_quantity/readme/CONTRIBUTORS.rst @@ -3,6 +3,7 @@ * Pedro M. Baeza * Carlos Roca * Víctor Martínez + * Carolina Fernandez * Dave Lasley * Souheil Bejaoui diff --git a/contract_variable_quantity/static/description/index.html b/contract_variable_quantity/static/description/index.html index e8a5cfdc08..8d664e508c 100644 --- a/contract_variable_quantity/static/description/index.html +++ b/contract_variable_quantity/static/description/index.html @@ -367,9 +367,9 @@

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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

With this module, you will be able to define in recurring contracts some lines with variable quantity according to a provided formula.

Table of contents

@@ -405,7 +405,7 @@

Configuration

-Formula form +Formula form
@@ -424,7 +424,7 @@

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -444,6 +444,7 @@

Contributors

  • Pedro M. Baeza
  • Carlos Roca
  • Víctor Martínez
  • +
  • Carolina Fernandez
  • @@ -460,7 +461,7 @@

    Maintainers

    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 project on GitHub.

    +

    This module is part of the OCA/contract project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/contract_variable_quantity/tests/test_contract_variable_quantity.py b/contract_variable_quantity/tests/test_contract_variable_quantity.py index 89f141df00..4540291f04 100644 --- a/contract_variable_quantity/tests/test_contract_variable_quantity.py +++ b/contract_variable_quantity/tests/test_contract_variable_quantity.py @@ -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 @@ -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 @@ -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",