Skip to content

Commit

Permalink
BAH-3662 | Refactor. Markup price is not used when sale qu… (#95)
Browse files Browse the repository at this point in the history
* [Karthi] | BAH-3662 | Refactor. Markup price is not used when sale quotation is created from REST API.

* [Karthi] | BAH-3662 | Refactor. Markup price is not used when sale quotation is created from REST API.
  • Loading branch information
karthikeyansp91 authored Mar 12, 2024
1 parent eb4d78b commit aa32d89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions bahmni_api_feed/models/order_save_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,11 @@ def _create_sale_order_line_function(self, sale_order, order):
'lot_id': prod_lot.id if prod_lot else False,
'expiry_date': prod_lot.expiration_date if prod_lot else False,
}


if prod_lot != None:
if bool(self.env['ir.config_parameter'].sudo().get_param('bahmni_sale.sale_price_markup')) == True:
sale_order_line['price_unit'] = prod_lot.sale_price if prod_lot.sale_price > 0.0 else sale_order_line['price_unit']

sale_obj = self.env['sale.order'].browse(sale_order)
sale_line = sale_order_line_obj.create(sale_order_line)

Expand All @@ -394,7 +398,7 @@ def _create_sale_order_line_function(self, sale_order, order):
uom = prod_obj.uom_id.id
)
price = self.env['account.tax']._fix_tax_included_price_company(sale_line._get_display_price(), prod_obj.taxes_id, sale_line.tax_id, sale_line.company_id)
sale_line.price_unit = price


if product_uom_qty != order['quantity']:
order['quantity'] = order['quantity'] - product_uom_qty
Expand Down
6 changes: 2 additions & 4 deletions bahmni_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ class SaleOrderLine(models.Model):

@api.onchange('product_uom_qty')
def onchange_product_uom_qty(self):
if self.product_uom_qty:
res_config = self.env['res.config.settings'].search([],order='id desc',limit=1)

if res_config.sale_price_markup == True:
if self.product_uom_qty:
if bool(self.env['ir.config_parameter'].sudo().get_param('bahmni_sale.sale_price_markup')) == True:
self.price_unit = self.lot_id.sale_price if self.lot_id.sale_price > 0.0 else self.product_id.lst_price
else:
self.price_unit = self.product_id.lst_price
Expand Down

0 comments on commit aa32d89

Please sign in to comment.