mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[15.0][MIG] product_contract : Migration to 15.0
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
Recurring - Product Contract
|
||||
============================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:fac583e1c22b30de7ea2d69428133dfb03265f366400a65c2d335ad3b2f6895e
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
@@ -14,16 +17,16 @@ Recurring - Product Contract
|
||||
: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/14.0/product_contract
|
||||
:target: https://github.com/OCA/contract/tree/15.0/product_contract
|
||||
:alt: OCA/contract
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-product_contract
|
||||
:target: https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-product_contract
|
||||
: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/14.0
|
||||
:alt: Try me on Runbot
|
||||
.. |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
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module adds support for products to be linked to contract templates.
|
||||
|
||||
@@ -51,8 +54,8 @@ 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:%20product_contract%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
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:%20product_contract%0Aversion:%2015.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.
|
||||
|
||||
@@ -96,6 +99,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-sbejaoui|
|
||||
|
||||
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/14.0/product_contract>`_ project on GitHub.
|
||||
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/15.0/product_contract>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "Recurring - Product Contract",
|
||||
"version": "14.0.1.1.0",
|
||||
"version": "15.0.1.1.0",
|
||||
"category": "Contract Management",
|
||||
"license": "AGPL-3",
|
||||
"author": "LasLabs, " "ACSONE SA/NV, " "Odoo Community Association (OCA)",
|
||||
|
||||
@@ -18,7 +18,7 @@ class ContractLine(models.Model):
|
||||
)
|
||||
|
||||
def _prepare_invoice_line(self, move_form):
|
||||
res = super(ContractLine, self)._prepare_invoice_line(move_form)
|
||||
res = super()._prepare_invoice_line(move_form)
|
||||
if self.sale_order_line_id and res:
|
||||
res["sale_line_ids"] = [(6, 0, [self.sale_order_line_id.id])]
|
||||
return res
|
||||
|
||||
@@ -68,7 +68,7 @@ class ProductTemplate(models.Model):
|
||||
self.with_company(company).write(
|
||||
{"property_contract_template_id": False}
|
||||
)
|
||||
super().write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@api.constrains("is_contract", "type")
|
||||
def _check_contract_product_type(self):
|
||||
|
||||
@@ -94,8 +94,9 @@ class SaleOrder(models.Model):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"You must specify a contract "
|
||||
"template for '{}' product in '{}' company."
|
||||
).format(order_line.product_id.name, rec.company_id.name)
|
||||
"template for '%(order_line.product_id.name)s' "
|
||||
"product in '%(rec.company_id.name)s' company."
|
||||
)
|
||||
)
|
||||
contract_templates |= contract_template
|
||||
for contract_template in contract_templates:
|
||||
|
||||
@@ -43,8 +43,8 @@ class SaleOrderLine(models.Model):
|
||||
help="Specify if process date is 'from' or 'to' invoicing date",
|
||||
copy=False,
|
||||
)
|
||||
date_start = fields.Date(string="Date Start")
|
||||
date_end = fields.Date(string="Date End")
|
||||
date_start = fields.Date()
|
||||
date_end = fields.Date()
|
||||
|
||||
contract_line_id = fields.Many2one(
|
||||
comodel_name="contract.line",
|
||||
@@ -142,13 +142,13 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
@api.onchange("product_id")
|
||||
def product_id_change(self):
|
||||
super().product_id_change()
|
||||
for rec in self:
|
||||
if rec.product_id.is_contract:
|
||||
rec.is_contract = True
|
||||
else:
|
||||
# Don't initialize wrong values
|
||||
rec.is_contract = False
|
||||
return super().product_id_change()
|
||||
|
||||
def _get_contract_line_qty(self):
|
||||
"""Returns the quantity to be put on new contract lines."""
|
||||
|
||||
@@ -4,3 +4,6 @@
|
||||
|
||||
* Ernesto Tejeda
|
||||
* Pedro M. Baeza
|
||||
* `Binhex <https://binhex.cloud>`__:
|
||||
|
||||
* Adasat Torres
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Recurring - Product Contract</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -366,8 +366,10 @@ ul.auto-toc {
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:fac583e1c22b30de7ea2d69428133dfb03265f366400a65c2d335ad3b2f6895e
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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/14.0/product_contract"><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-14-0/contract-14-0-product_contract"><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/14.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/15.0/product_contract"><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-15-0/contract-15-0-product_contract"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds support for products to be linked to contract templates.</p>
|
||||
<p>A contract is created on <tt class="docutils literal">sale.order</tt> confirmation for each different template used in sale order line where recurrence details are set too.</p>
|
||||
<p>Contract product are ignored on invoicing process and pass to nothing to invoice directly.</p>
|
||||
@@ -398,8 +400,8 @@ product</li>
|
||||
<h1><a class="toc-backref" href="#id2">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 smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20product_contract%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
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:%20product_contract%0Aversion:%2015.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">
|
||||
@@ -432,7 +434,7 @@ 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" href="https://github.com/sbejaoui"><img alt="sbejaoui" src="https://github.com/sbejaoui.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/14.0/product_contract">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/15.0/product_contract">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>
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
|
||||
from . import test_product
|
||||
from . import test_sale_order
|
||||
from . import test_contract
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tests.common import SavepointCase
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestProductTemplate(SavepointCase):
|
||||
class TestProductTemplate(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
@@ -6,10 +6,10 @@ from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.fields import Date
|
||||
from odoo.tests.common import SavepointCase
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSaleOrder(SavepointCase):
|
||||
class TestSaleOrder(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']" position="before">
|
||||
<field name="is_contract" attrs="{'invisible': []}" />
|
||||
|
||||
<field name="is_contract" invisible="1" />
|
||||
|
||||
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='order_line']/form//field[@name='product_id']"
|
||||
@@ -59,7 +62,9 @@
|
||||
expr="//field[@name='order_line']/form//field[@name='tax_id']/parent::group"
|
||||
position="after"
|
||||
>
|
||||
<field name="is_contract" attrs="{'invisible': []}" />
|
||||
<group>
|
||||
<field name="is_contract" />
|
||||
</group>
|
||||
<separator
|
||||
colspan="4"
|
||||
string="Recurrence Invoicing"
|
||||
|
||||
Reference in New Issue
Block a user