Skip to content

Commit

Permalink
[MIG] contract_price_revision: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa authored and houzefa-abba committed Feb 28, 2024
1 parent 780cd70 commit 4c4ab3d
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 17 deletions.
13 changes: 7 additions & 6 deletions contract_price_revision/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Contract Price Revision
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c8a59ff02fbb6be23950f10dec81d9fac5d8dceb53a5213a9cce91789ca63230
!! source digest: sha256:de222a92e86474bc20e85dbdae73adfb5e21bd3f96b065006dcb12b04f58b2ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand All @@ -17,13 +17,13 @@ Contract Price Revision
: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/13.0/contract_price_revision
:target: https://github.com/OCA/contract/tree/15.0/contract_price_revision
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_price_revision
:target: https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_price_revision
: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=13.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -63,7 +63,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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_price_revision%0Aversion:%2013.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_price_revision%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 All @@ -83,6 +83,7 @@ Contributors

* Vicent Cubells
* Carlos Dauden
* Carolina Fernandez

Maintainers
~~~~~~~~~~~
Expand All @@ -105,6 +106,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carlosdauden|

This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/13.0/contract_price_revision>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/15.0/contract_price_revision>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
9 changes: 7 additions & 2 deletions contract_price_revision/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Copyright 2019 Tecnativa - Vicent Cubells
# Copyright 2019 Tecnativa - Carlos Dauden
# Copyright 2023 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Contract Price Revision",
"summary": "Easy revision of contract prices",
"version": "13.0.1.0.1",
"version": "15.0.1.0.0",
"category": "Contract",
"author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/contract",
"depends": ["contract"],
"data": ["views/contract_line.xml", "wizards/contract_price_revision_views.xml"],
"data": [
"security/ir.model.access.csv",
"views/contract_line.xml",
"wizards/contract_price_revision_views.xml",
],
"installable": True,
"development_status": "Production/Stable",
"maintainers": ["carlosdauden"],
Expand Down
2 changes: 1 addition & 1 deletion contract_price_revision/i18n/contract_price_revision.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
2 changes: 1 addition & 1 deletion contract_price_revision/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ContractLine(models.Model):

@api.depends_context("date_start")
def _compute_price_can_be_revised(self):
date_start = self.env.context.get("date_start", fields.Datetime.now())
date_start = self.env.context.get("date_start", fields.Date.today())
lines_can_be_revised = self.filtered(
lambda line: not line.never_revise_price
and not line.automatic_price
Expand Down
1 change: 1 addition & 0 deletions contract_price_revision/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

* Vicent Cubells
* Carlos Dauden
* Carolina Fernandez
3 changes: 3 additions & 0 deletions contract_price_revision/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_contract_price_revision_wizard_account_invoice,access_contract_price_revision_wizard_account_invoice,model_contract_price_revision_wizard,account.group_account_invoice,1,1,1,1
access_contract_price_revision_wizard_account_manager,access_contract_price_revision_wizard_account_manager,model_contract_price_revision_wizard,account.group_account_manager,1,1,1,1
9 changes: 5 additions & 4 deletions contract_price_revision/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Contract Price Revision</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c8a59ff02fbb6be23950f10dec81d9fac5d8dceb53a5213a9cce91789ca63230
!! source digest: sha256:de222a92e86474bc20e85dbdae73adfb5e21bd3f96b065006dcb12b04f58b2ff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/contract/tree/13.0/contract_price_revision"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_price_revision"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&amp;target_branch=13.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/contract/tree/15.0/contract_price_revision"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_price_revision"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" 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 allows to create revisions of contract line prices.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -410,7 +410,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract_price_revision%0Aversion:%2013.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_price_revision%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 All @@ -428,6 +428,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Vicent Cubells</li>
<li>Carlos Dauden</li>
<li>Carolina Fernandez</li>
</ul>
</li>
</ul>
Expand All @@ -441,7 +442,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">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 image-reference" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/13.0/contract_price_revision">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/contract_price_revision">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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2019 Tecnativa - Vicent Cubells
# Copyright 2019 Tecnativa - Carlos Dauden
# Copyright 2020 ACSONE SA/NV
# Copyright 2023 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo.addons.contract.tests.test_contract import TestContractBase
Expand All @@ -20,7 +21,7 @@ def _create_wizard(self, v_type="percentage", value=0.0):
)

def execute_wizard(self):
self.wizard.with_context({"active_ids": [self.contract.id]}).action_apply()
self.wizard.with_context(active_ids=self.contract.id).action_apply()

def test_contract_price_revision_wizard(self):
# This is for checking if this line is not versioned
Expand Down
4 changes: 2 additions & 2 deletions contract_price_revision/wizards/contract_price_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def action_apply(self):
line.stop(date_end)
new_line = line.copy(self._get_new_line_value(line))
line.update({"successor_contract_line_id": new_line.id})
action = self.env["ir.actions.act_window"].for_xml_id(
"contract", "action_customer_contract"
action = self.env["ir.actions.act_window"]._for_xml_id(
"contract.action_customer_contract"
)
action["domain"] = [("id", "in", active_ids)]
return action
Expand Down

0 comments on commit 4c4ab3d

Please sign in to comment.