mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract_price_revision: pre-commit stuff
This commit is contained in:
@@ -56,8 +56,8 @@ class ContractLine(models.Model):
|
||||
self, date_start, date_end, is_auto_renew, price, recurring_next_date=False
|
||||
):
|
||||
"""
|
||||
Override contract function to prepare values for new contract line
|
||||
adding the new price as parameter
|
||||
Override contract function to prepare values for new contract line
|
||||
adding the new price as parameter
|
||||
"""
|
||||
res = super()._prepare_value_for_plan_successor(
|
||||
date_start, date_end, is_auto_renew, recurring_next_date=recurring_next_date
|
||||
|
||||
@@ -9,19 +9,24 @@ from odoo import api, fields, models
|
||||
|
||||
|
||||
class ContractPriceRevisionWizard(models.TransientModel):
|
||||
""" Update contract price based on percentage variation """
|
||||
"""Update contract price based on percentage variation"""
|
||||
|
||||
_name = "contract.price.revision.wizard"
|
||||
_description = "Wizard to update price based on percentage variation"
|
||||
|
||||
date_start = fields.Date(required=True,)
|
||||
date_start = fields.Date(
|
||||
required=True,
|
||||
)
|
||||
date_end = fields.Date()
|
||||
variation_type = fields.Selection(
|
||||
selection=lambda self: self._get_variation_type(),
|
||||
required=True,
|
||||
default=lambda self: self._get_default_variation_type(),
|
||||
)
|
||||
variation_percent = fields.Float(digits="Product Price", string="Variation %",)
|
||||
variation_percent = fields.Float(
|
||||
digits="Product Price",
|
||||
string="Variation %",
|
||||
)
|
||||
fixed_price = fields.Float(digits="Product Price")
|
||||
|
||||
@api.model
|
||||
@@ -36,8 +41,7 @@ class ContractPriceRevisionWizard(models.TransientModel):
|
||||
return "percentage"
|
||||
|
||||
def _get_new_price(self, line):
|
||||
"""Get the price depending the change type chosen
|
||||
"""
|
||||
"""Get the price depending the change type chosen"""
|
||||
if self.variation_type == "percentage":
|
||||
return line.price_unit * (1.0 + self.variation_percent / 100.0)
|
||||
elif self.variation_type == "fixed":
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../contract_price_revision
|
||||
6
setup/contract_price_revision/setup.py
Normal file
6
setup/contract_price_revision/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user