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
|
||||
- Carlos Dauden
|
||||
- Carolina Fernandez
|
||||
- Juan José Seguí
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"name": "Contract Price Revision",
|
||||
"summary": "Easy revision of contract prices",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"category": "Contract",
|
||||
"author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
|
||||
@@ -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.Date.today())
|
||||
date_start = self.env.context.get("date_start", fields.Date.context_today(self))
|
||||
lines_can_be_revised = self.filtered(
|
||||
lambda line: not line.never_revise_price
|
||||
and not line.automatic_price
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
- Vicent Cubells
|
||||
- Carlos Dauden
|
||||
- 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>Carlos Dauden</li>
|
||||
<li>Carolina Fernandez</li>
|
||||
<li>Juan José Seguí</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -82,3 +82,9 @@ class TestContractPriceRevision(TestContractBase):
|
||||
self.assertEqual(len(lines), 2)
|
||||
lines = lines.filtered(lambda x: x.price_unit == 200.0)
|
||||
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
|
||||
name="variation_percent"
|
||||
groups="base.group_no_one"
|
||||
attrs="{'invisible': [('predecessor_contract_line_id', '=', False)]}"
|
||||
invisible="not predecessor_contract_line_id"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
@@ -18,16 +18,10 @@
|
||||
<field name="date_end" />
|
||||
<field name="variation_type" />
|
||||
</group>
|
||||
<group
|
||||
name="percentage"
|
||||
attrs="{'invisible': [('variation_type', '!=', 'percentage')]}"
|
||||
>
|
||||
<group name="percentage" invisible="variation_type != 'percentage'">
|
||||
<field name="variation_percent" />
|
||||
</group>
|
||||
<group
|
||||
name="fixed"
|
||||
attrs="{'invisible': [('variation_type', '!=', 'fixed')]}"
|
||||
>
|
||||
<group name="fixed" invisible="variation_type != 'fixed'">
|
||||
<field name="fixed_price" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user