Skip to content

Commit

Permalink
[15.0][MIG] product_contract : Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Adasat committed Dec 5, 2023
1 parent 0a0218c commit bda7253
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 25 deletions.
23 changes: 13 additions & 10 deletions product_contract/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.
2 changes: 1 addition & 1 deletion product_contract/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion product_contract/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion product_contract/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def write(self, vals):
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):
Expand Down
5 changes: 3 additions & 2 deletions product_contract/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def action_create_contract(self):
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:
Expand Down
6 changes: 3 additions & 3 deletions product_contract/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -142,13 +142,13 @@ def onchange_date_start(self):

@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."""
Expand Down
12 changes: 7 additions & 5 deletions product_contract/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand Down Expand Up @@ -366,8 +366,10 @@ <h1 class="title">Recurring - Product Contract</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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&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>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>
Expand Down Expand Up @@ -398,8 +400,8 @@ <h1><a class="toc-backref" href="#id1">Usage</a></h1>
<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">
Expand Down Expand Up @@ -432,7 +434,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
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>
Expand Down
9 changes: 7 additions & 2 deletions product_contract/views/sale_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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']"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit bda7253

Please sign in to comment.