[IMP] contract_price_revision: pre-commit stuff

This commit is contained in:
Carolina Fernandez
2023-09-28 07:27:42 -03:00
parent 3c70ca799a
commit d82cfb31cd
4 changed files with 18 additions and 7 deletions

View File

@@ -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

View File

@@ -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":

View File

@@ -0,0 +1 @@
../../../../contract_price_revision

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)