-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-3589 | Added. Markup price table added and menu access… (#57)
* [Karthi] | BAH-3589 | Added. Markup price table added and menu access given * [Karthi] | BAH-3589 | Added. Fields changes has been added.
- Loading branch information
1 parent
0e54c35
commit 7e1641c
Showing
3 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
from odoo import fields, models | ||
from odoo import api, fields, models, _, Command | ||
from odoo.exceptions import UserError, ValidationError, AccessError, RedirectWarning | ||
|
||
|
||
class PriceMarkupTable(models.Model): | ||
_name = 'price.markup.table' | ||
|
||
lower_price = fields.Float(string="Lower Price", default=1) | ||
higher_price = fields.Float(string="Higher Price", default=1) | ||
lower_price = fields.Float(string="Minimum Cost", default=1) | ||
higher_price = fields.Float(string="Maximum Cost", default=1) | ||
markup_percentage = fields.Float(string="Markup Percentage", default=1) | ||
|
||
@api.constrains('lower_price', 'higher_price') | ||
def _check_fields_values(self): | ||
if self.lower_price > self.higher_price: | ||
raise ValidationError('Minimum cost should not be greater than maximum cost.') | ||
# Add any other conditions you need to check | ||
for data in self.env['price.markup.table'].search([]): | ||
if data.lower_price <= self.lower_price <= data.higher_price and data.id != self.id: | ||
raise ValidationError('Your minimum cost is available within the range of minimum cost and maximum cost of previous records.') | ||
|
||
if data.higher_price <= self.higher_price <= data.higher_price and data.id != self.id: | ||
raise ValidationError('Your maximum cost is available within the range of minimum cost and maximum cost of previous records.') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters