mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] contract_price_revision: Migration to 17.0
This commit is contained in:
@@ -83,6 +83,7 @@ Contributors
|
|||||||
- Vicent Cubells
|
- Vicent Cubells
|
||||||
- Carlos Dauden
|
- Carlos Dauden
|
||||||
- Carolina Fernandez
|
- Carolina Fernandez
|
||||||
|
- Juan José Seguí
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Contract Price Revision",
|
"name": "Contract Price Revision",
|
||||||
"summary": "Easy revision of contract prices",
|
"summary": "Easy revision of contract prices",
|
||||||
"version": "15.0.1.0.0",
|
"version": "17.0.1.0.0",
|
||||||
"category": "Contract",
|
"category": "Contract",
|
||||||
"author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
|
"author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ContractLine(models.Model):
|
|||||||
|
|
||||||
@api.depends_context("date_start")
|
@api.depends_context("date_start")
|
||||||
def _compute_price_can_be_revised(self):
|
def _compute_price_can_be_revised(self):
|
||||||
date_start = self.env.context.get("date_start", fields.Date.today())
|
date_start = self.env.context.get("date_start", fields.Date.context_today(self))
|
||||||
lines_can_be_revised = self.filtered(
|
lines_can_be_revised = self.filtered(
|
||||||
lambda line: not line.never_revise_price
|
lambda line: not line.never_revise_price
|
||||||
and not line.automatic_price
|
and not line.automatic_price
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
- Vicent Cubells
|
- Vicent Cubells
|
||||||
- Carlos Dauden
|
- Carlos Dauden
|
||||||
- Carolina Fernandez
|
- Carolina Fernandez
|
||||||
|
- Juan José Seguí
|
||||||
|
|||||||
@@ -429,6 +429,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|||||||
<li>Vicent Cubells</li>
|
<li>Vicent Cubells</li>
|
||||||
<li>Carlos Dauden</li>
|
<li>Carlos Dauden</li>
|
||||||
<li>Carolina Fernandez</li>
|
<li>Carolina Fernandez</li>
|
||||||
|
<li>Juan José Seguí</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -82,3 +82,9 @@ class TestContractPriceRevision(TestContractBase):
|
|||||||
self.assertEqual(len(lines), 2)
|
self.assertEqual(len(lines), 2)
|
||||||
lines = lines.filtered(lambda x: x.price_unit == 200.0)
|
lines = lines.filtered(lambda x: x.price_unit == 200.0)
|
||||||
self.assertEqual(len(lines), 1)
|
self.assertEqual(len(lines), 1)
|
||||||
|
|
||||||
|
def test_compute_variation_percent(self):
|
||||||
|
self.acct_line.write({"price_unit": 200.0, "previous_price": 100.0})
|
||||||
|
self.assertEqual(self.acct_line.variation_percent, 100.0)
|
||||||
|
self.acct_line.write({"price_unit": 200.0, "previous_price": 0.0})
|
||||||
|
self.assertEqual(self.acct_line.variation_percent, 0.0)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<field
|
<field
|
||||||
name="variation_percent"
|
name="variation_percent"
|
||||||
groups="base.group_no_one"
|
groups="base.group_no_one"
|
||||||
attrs="{'invisible': [('predecessor_contract_line_id', '=', False)]}"
|
invisible="not predecessor_contract_line_id"
|
||||||
/>
|
/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -18,16 +18,10 @@
|
|||||||
<field name="date_end" />
|
<field name="date_end" />
|
||||||
<field name="variation_type" />
|
<field name="variation_type" />
|
||||||
</group>
|
</group>
|
||||||
<group
|
<group name="percentage" invisible="variation_type != 'percentage'">
|
||||||
name="percentage"
|
|
||||||
attrs="{'invisible': [('variation_type', '!=', 'percentage')]}"
|
|
||||||
>
|
|
||||||
<field name="variation_percent" />
|
<field name="variation_percent" />
|
||||||
</group>
|
</group>
|
||||||
<group
|
<group name="fixed" invisible="variation_type != 'fixed'">
|
||||||
name="fixed"
|
|
||||||
attrs="{'invisible': [('variation_type', '!=', 'fixed')]}"
|
|
||||||
>
|
|
||||||
<field name="fixed_price" />
|
<field name="fixed_price" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user