From e103a1fa54515ab981d26932c4f2f9335475dc0d Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Tue, 27 Oct 2020 15:37:05 +0100 Subject: [PATCH] [MIG] contract_variable_quantity: Migration to v13 --- contract_variable_quantity/README.rst | 18 ++++--- contract_variable_quantity/__manifest__.py | 2 +- .../migrations/12.0.2.0.0/pre-migration.py | 50 ------------------- .../models/contract_line.py | 12 ++--- .../models/contract_line_formula.py | 2 +- .../readme/CONTRIBUTORS.rst | 6 ++- .../static/description/index.html | 23 ++++++--- .../views/contract_line_formula.xml | 1 - .../odoo/addons/contract_variable_quantity | 1 + setup/contract_variable_quantity/setup.py | 6 +++ 10 files changed, 45 insertions(+), 76 deletions(-) delete mode 100644 contract_variable_quantity/migrations/12.0.2.0.0/pre-migration.py create mode 120000 setup/contract_variable_quantity/odoo/addons/contract_variable_quantity create mode 100644 setup/contract_variable_quantity/setup.py diff --git a/contract_variable_quantity/README.rst b/contract_variable_quantity/README.rst index b9115a01a..171644d32 100644 --- a/contract_variable_quantity/README.rst +++ b/contract_variable_quantity/README.rst @@ -14,13 +14,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/12.0/contract_variable_quantity + :target: https://github.com/OCA/contract/tree/13.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-12-0/contract-12-0-contract_variable_quantity + :target: https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_variable_quantity :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/110/12.0 + :target: https://runbot.odoo-community.org/runbot/110/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,7 +49,7 @@ Configuration * *contract*: Contract whose line belongs to. * *invoice*: Invoice (header) being created. -.. figure:: https://raw.githubusercontent.com/OCA/contract/12.0/contract_variable_quantity/images/formula_form.png +.. figure:: https://raw.githubusercontent.com/OCA/contract/13.0/contract_variable_quantity/images/formula_form.png :alt: Formula form :width: 600 px @@ -70,7 +70,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -85,7 +85,11 @@ Authors Contributors ~~~~~~~~~~~~ -* Pedro M. Baeza +* `Tecnativa `_: + + * Pedro M. Baeza + * Carlos Roca + * Dave Lasley * Souheil Bejaoui @@ -102,6 +106,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 e5c8ea88a..ad0e28c9c 100644 --- a/contract_variable_quantity/__manifest__.py +++ b/contract_variable_quantity/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Variable quantity in contract recurrent invoicing", - "version": "12.0.3.0.0", + "version": "13.0.1.0.0", "category": "Contract Management", "license": "AGPL-3", "author": "Tecnativa," "Odoo Community Association (OCA)", diff --git a/contract_variable_quantity/migrations/12.0.2.0.0/pre-migration.py b/contract_variable_quantity/migrations/12.0.2.0.0/pre-migration.py deleted file mode 100644 index 78533de77..000000000 --- a/contract_variable_quantity/migrations/12.0.2.0.0/pre-migration.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging - -from openupgradelib import openupgrade - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - xmlids_to_rename = [ - ( - "contract_sale.account_analytic_account_own_salesman", - "contract_sale.contract_contract_own_salesman", - ), - ( - "contract_sale.account_analytic_account_see_all", - "contract_sale.contract_contract_see_all", - ), - ( - "contract_sale.account_analytic_contract_salesman", - "contract_sale.contract_template_salesman", - ), - ( - "contract_sale.account_analytic_contract_sale_manager", - "contract_sale.contract_template_sale_manager", - ), - ( - "contract_sale.account_analytic_invoice_line_saleman", - "contract_sale.contract_line_saleman", - ), - ( - "contract_sale.account_analytic_invoice_line_manager", - "contract_sale.contract_line_manager", - ), - ( - "contract_sale.account_analytic_contract_line_salesman", - "contract_sale.contract_template_line_salesman", - ), - ( - "contract_sale.account_analytic_contract_line_manager", - "contract_sale.contract_template_line_manager", - ), - ( - "contract_sale.account_analytic_account_contract_salesman", - "contract_sale.contract_contract_salesman", - ), - ] - openupgrade.rename_xmlids(cr, xmlids_to_rename) diff --git a/contract_variable_quantity/models/contract_line.py b/contract_variable_quantity/models/contract_line.py index 683b849d6..9e9b7a23c 100644 --- a/contract_variable_quantity/models/contract_line.py +++ b/contract_variable_quantity/models/contract_line.py @@ -3,7 +3,7 @@ # Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, models +from odoo import models from odoo.tools import float_is_zero from odoo.tools.safe_eval import safe_eval @@ -11,11 +11,10 @@ from odoo.tools.safe_eval import safe_eval class AccountAnalyticInvoiceLine(models.Model): _inherit = "contract.line" - @api.multi def _get_quantity_to_invoice( self, period_first_date, period_last_date, invoice_date ): - quantity = super(AccountAnalyticInvoiceLine, self)._get_quantity_to_invoice( + quantity = super()._get_quantity_to_invoice( period_first_date, period_last_date, invoice_date ) if not period_first_date or not period_last_date or not invoice_date: @@ -41,11 +40,8 @@ class AccountAnalyticInvoiceLine(models.Model): quantity = eval_context.get("result", 0) return quantity - @api.multi - def _prepare_invoice_line(self, invoice_id=False, invoice_values=False): - vals = super(AccountAnalyticInvoiceLine, self)._prepare_invoice_line( - invoice_id=invoice_id, invoice_values=invoice_values, - ) + def _prepare_invoice_line(self, move_form): + vals = super()._prepare_invoice_line(move_form) if ( "quantity" in vals and self.contract_id.skip_zero_qty diff --git a/contract_variable_quantity/models/contract_line_formula.py b/contract_variable_quantity/models/contract_line_formula.py index 2760af000..9120323d6 100644 --- a/contract_variable_quantity/models/contract_line_formula.py +++ b/contract_variable_quantity/models/contract_line_formula.py @@ -22,7 +22,7 @@ class ContractLineFormula(models.Model): "user": self.env.user, "line": self.env["contract.line"], "contract": self.env["contract.contract"], - "invoice": self.env["account.invoice"], + "invoice": self.env["account.move"], "quantity": 0, "period_first_date": False, "period_last_date": False, diff --git a/contract_variable_quantity/readme/CONTRIBUTORS.rst b/contract_variable_quantity/readme/CONTRIBUTORS.rst index 7894b462d..eab5b2393 100644 --- a/contract_variable_quantity/readme/CONTRIBUTORS.rst +++ b/contract_variable_quantity/readme/CONTRIBUTORS.rst @@ -1,3 +1,7 @@ -* Pedro M. Baeza +* `Tecnativa `_: + + * Pedro M. Baeza + * Carlos Roca + * Dave Lasley * Souheil Bejaoui diff --git a/contract_variable_quantity/static/description/index.html b/contract_variable_quantity/static/description/index.html index 1e7048424..e2c2617b4 100644 --- a/contract_variable_quantity/static/description/index.html +++ b/contract_variable_quantity/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

@@ -403,7 +403,7 @@ float/integer value of the quantity to invoice in the variable ‘result’.

-Formula form +Formula form
@@ -422,7 +422,7 @@ float/integer value of the quantity to invoice in the variable ‘result’.

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -435,10 +435,19 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Contributors

+
@@ -448,7 +457,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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/views/contract_line_formula.xml b/contract_variable_quantity/views/contract_line_formula.xml index b1dec49ef..8408323bf 100644 --- a/contract_variable_quantity/views/contract_line_formula.xml +++ b/contract_variable_quantity/views/contract_line_formula.xml @@ -70,7 +70,6 @@ Formulas (quantity) contract.line.qty.formula - form tree,form

diff --git a/setup/contract_variable_quantity/odoo/addons/contract_variable_quantity b/setup/contract_variable_quantity/odoo/addons/contract_variable_quantity new file mode 120000 index 000000000..f1fcfd223 --- /dev/null +++ b/setup/contract_variable_quantity/odoo/addons/contract_variable_quantity @@ -0,0 +1 @@ +../../../../contract_variable_quantity \ No newline at end of file diff --git a/setup/contract_variable_quantity/setup.py b/setup/contract_variable_quantity/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/contract_variable_quantity/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)