mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract_price_revision: Allows to restrict price revision on some lines
As if recurrence management is per line, some lines should be excluded from price revision.
This commit is contained in:
@@ -14,13 +14,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/12.0/contract_price_revision
|
||||
:target: https://github.com/OCA/contract/tree/13.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-12-0/contract-12-0-contract_price_revision
|
||||
:target: https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_price_revision
|
||||
: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|
|
||||
@@ -50,13 +50,17 @@ To use this module:
|
||||
#. When create invoices related to contracts selected, prices will be update
|
||||
with the prices that are not out of date.
|
||||
|
||||
#. When managing contract with recurrence on line level, you maybe want not
|
||||
to revise price for some lines.
|
||||
Check 'Never Revise Price' on line level to avoid price revisions.
|
||||
|
||||
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_price_revision%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_price_revision%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.
|
||||
|
||||
@@ -66,6 +70,7 @@ Credits
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* ACSONE SA/NV
|
||||
* Tecnativa
|
||||
|
||||
Contributors
|
||||
@@ -97,6 +102,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/12.0/contract_price_revision>`_ project on GitHub.
|
||||
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/13.0/contract_price_revision>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -20,6 +20,9 @@ class ContractLine(models.Model):
|
||||
string="Variation %",
|
||||
)
|
||||
|
||||
never_revise_price = fields.Boolean(
|
||||
help="Check this if you don't want to allow price revision."
|
||||
)
|
||||
price_can_be_revised = fields.Boolean(
|
||||
compute="_compute_price_can_be_revised",
|
||||
help="Technical field in order to know if the line price can be revised.",
|
||||
@@ -29,7 +32,8 @@ class ContractLine(models.Model):
|
||||
def _compute_price_can_be_revised(self):
|
||||
date_start = self.env.context.get("date_start", fields.Datetime.now())
|
||||
lines_can_be_revised = self.filtered(
|
||||
lambda line: not line.automatic_price
|
||||
lambda line: not line.never_revise_price
|
||||
and not line.automatic_price
|
||||
and not line.successor_contract_line_id
|
||||
and line.recurring_next_date
|
||||
and not line.display_type
|
||||
|
||||
@@ -12,3 +12,7 @@ To use this module:
|
||||
will have as ending date the day before the entered date.
|
||||
#. When create invoices related to contracts selected, prices will be update
|
||||
with the prices that are not out of date.
|
||||
|
||||
#. When managing contract with recurrence on line level, you maybe want not
|
||||
to revise price for some lines.
|
||||
Check 'Never Revise Price' on line level to avoid price revisions.
|
||||
|
||||
@@ -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>Contract Price Revision</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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_price_revision"><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_price_revision"><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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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_price_revision"><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_price_revision"><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>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">
|
||||
@@ -398,6 +398,9 @@ a price increased accordingly to the percent entered. Old contract lines
|
||||
will have as ending date the day before the entered date.</li>
|
||||
<li>When create invoices related to contracts selected, prices will be update
|
||||
with the prices that are not out of date.</li>
|
||||
<li>When managing contract with recurrence on line level, you maybe want not
|
||||
to revise price for some lines.
|
||||
Check ‘Never Revise Price’ on line level to avoid price revisions.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
@@ -405,7 +408,7 @@ with the prices that are not out of date.</li>
|
||||
<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_price_revision%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_price_revision%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">
|
||||
@@ -413,6 +416,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>ACSONE SA/NV</li>
|
||||
<li>Tecnativa</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -435,7 +439,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/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/12.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/13.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>
|
||||
|
||||
@@ -46,6 +46,17 @@ class TestContractPriceRevision(TestContractBase):
|
||||
)
|
||||
self.assertEqual(len(lines), 1)
|
||||
|
||||
def test_contract_price_fixed_revision_wizard_never(self):
|
||||
self.acct_line.copy({"never_revise_price": True})
|
||||
self.assertEqual(len(self.contract.contract_line_ids.ids), 2)
|
||||
self._create_wizard(v_type="fixed", value=120.0)
|
||||
self.execute_wizard()
|
||||
self.assertEqual(len(self.contract.contract_line_ids.ids), 3)
|
||||
lines = self.contract.contract_line_ids.filtered(
|
||||
lambda x: x.price_unit == 120.0
|
||||
)
|
||||
self.assertEqual(len(lines), 1)
|
||||
|
||||
def test_contract_price_revision_invoicing(self):
|
||||
self.acct_line.copy({"automatic_price": True})
|
||||
self._create_wizard(value=100.0)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<field name="inherit_id" ref="contract.contract_line_tree_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="last_date_invoiced" position="after">
|
||||
<field name="never_revise_price" />
|
||||
<field name="variation_percent" groups="base.group_no_one" />
|
||||
</field>
|
||||
</field>
|
||||
@@ -14,6 +15,7 @@
|
||||
<field name="inherit_id" ref="contract.contract_line_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="discount" position="after">
|
||||
<field name="never_revise_price" />
|
||||
<field
|
||||
name="variation_percent"
|
||||
groups="base.group_no_one"
|
||||
|
||||
Reference in New Issue
Block a user