Skip to content

Commit

Permalink
BAH-3589 | Added. Markup price table added and menu access… (#57)
Browse files Browse the repository at this point in the history
* [Karthi] | BAH-3589 | Added. Markup price table added and menu access given

* [Karthi] | BAH-3589 | Added. Fields changes has been added.
  • Loading branch information
karthikeyansp91 authored Feb 23, 2024
1 parent 0e54c35 commit 7e1641c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bahmni_purchase/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'website': '',
'images': [],
'depends': ['purchase', 'bahmni_product', 'bahmni_stock'],
'data': [
'data': ['security/ir.model.access.csv',
'views/purchase_views.xml',
'views/product_view.xml',
'views/price_markup_table_view.xml'],
Expand Down
19 changes: 17 additions & 2 deletions bahmni_purchase/models/price_markup_table.py
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.')

9 changes: 8 additions & 1 deletion bahmni_purchase/views/price_markup_table_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
</record>

<record id="action_price_markup_table" model="ir.actions.act_window">
<field name="name">Price Markup Table</field>
<field name="name">Sale Price Markup Rule</field>
<field name="res_model">price.markup.table</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem
id="menu_price_markup_table"
name="Sale Price Markup Rule"
parent="bahmni_sale.menu_bahmni_masters"
action="action_price_markup_table"
sequence="14"/>


</odoo>

0 comments on commit 7e1641c

Please sign in to comment.