[MIG] contract_variable_quantity: Migration to v13

This commit is contained in:
Carlos Roca
2020-10-27 15:37:05 +01:00
parent 03f82ac325
commit e103a1fa54
10 changed files with 45 additions and 76 deletions

View File

@@ -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 <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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_quantity%0Aversion:%2012.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:%2013.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.
@@ -85,7 +85,11 @@ Authors
Contributors
~~~~~~~~~~~~
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* Carlos Roca
* Dave Lasley <dave@laslabs.com>
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
@@ -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 <https://github.com/OCA/contract/tree/12.0/contract_variable_quantity>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/13.0/contract_variable_quantity>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -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)",

View File

@@ -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)

View File

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

View File

@@ -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,

View File

@@ -1,3 +1,7 @@
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* Carlos Roca
* Dave Lasley <dave@laslabs.com>
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/contract/tree/12.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" href="https://translation.odoo-community.org/projects/contract-12-0/contract-12-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" href="https://runbot.odoo-community.org/runbot/110/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/contract/tree/13.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" href="https://translation.odoo-community.org/projects/contract-13-0/contract-13-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" href="https://runbot.odoo-community.org/runbot/110/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-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>
@@ -403,7 +403,7 @@ float/integer value of the quantity to invoice in the variable result.</p>
</li>
</ol>
<div class="figure">
<img alt="Formula form" src="https://raw.githubusercontent.com/OCA/contract/12.0/contract_variable_quantity/images/formula_form.png" style="width: 600px;" />
<img alt="Formula form" src="https://raw.githubusercontent.com/OCA/contract/13.0/contract_variable_quantity/images/formula_form.png" style="width: 600px;" />
</div>
</div>
<div class="section" id="usage">
@@ -422,7 +422,7 @@ float/integer value of the quantity to invoice in the variable result.</p>
<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 smashing 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:%2012.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:%2013.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">
@@ -435,10 +435,19 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
<ul class="simple">
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;tecnativa.com">pedro.baeza&#64;tecnativa.com</a>&gt;</li>
<li>Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</li>
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
<li>Pedro M. Baeza</li>
<li>Carlos Roca</li>
</ul>
</blockquote>
</li>
<li><p class="first">Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</p>
</li>
<li><p class="first">Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</p>
</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -448,7 +457,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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/12.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/13.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>

View File

@@ -70,7 +70,6 @@
<record id="action_contract_quantity_formula" model="ir.actions.act_window">
<field name="name">Formulas (quantity)</field>
<field name="res_model">contract.line.qty.formula</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">

View File

@@ -0,0 +1 @@
../../../../contract_variable_quantity

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)