Skip to content

Commit

Permalink
[FIX] account_invoice_prices_update: Fix in _get_product_price_rule m…
Browse files Browse the repository at this point in the history
…ethod

closes #153

Ticket: 61757
Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar>
  • Loading branch information
mem-adhoc committed Jun 7, 2023
1 parent 8006a15 commit 1195869
Showing 1 changed file with 7 additions and 10 deletions.
Expand Up @@ -32,12 +32,11 @@ def _get_display_price_and_discount(self, product, line):
self.env.context, partner_id=partner.id,
date=line.move_id.invoice_date, uom=line.product_uom_id.id)
final_price, rule_id = self.pricelist_id.with_context(
product_context).get_product_price_rule(
line.product_id, line.quantity or 1.0, partner)
product_context)._get_product_price_rule(
line.product_id, line.quantity or 1.0, uom=line.product_uom_id)
base_price, currency_id = self.with_context(
product_context)._get_real_price_currency(
product, rule_id, line.quantity, line.product_uom_id,
self.pricelist_id.id, partner)
product, rule_id, line.quantity, line.product_uom_id)
if currency_id != self.pricelist_id.currency_id.id:
base_price = self.env['res.currency'].browse(
currency_id)._convert(base_price, self.pricelist_id.currency_id,
Expand Down Expand Up @@ -73,15 +72,15 @@ def update_prices(self):
return True

def _get_real_price_currency(
self, product, rule_id, qty, uom, partner):
self, product, rule_id, qty, uom):
"""Retrieve the price before applying the pricelist
:param obj product: object of current product record
:parem float qty: total quantity of product
:param tuple price_and_rule: tuple(price, suitable_rule)
coming from pricelist computation
:param obj uom: unit of measure of current invoice line
:param integer pricelist_id: pricelist id of invoice
:param obj partner: partner id of invoice"""
"""
PricelistItem = self.env['product.pricelist.item']
product_disc = product['lst_price']
currency_id = None
Expand All @@ -96,10 +95,8 @@ def _get_real_price_currency(
pricelist_item.base_pricelist_id and \
pricelist_item.base_pricelist_id.\
discount_policy == 'without_discount':
price, rule_id = pricelist_item.base_pricelist_id.\
with_context(
uom=uom.id).get_product_price_rule(
product, qty, partner)
price, rule_id = pricelist_item.base_pricelist_id._get_product_price_rule(
product, qty, uom=uom.id)
pricelist_item = PricelistItem.browse(rule_id)

if pricelist_item.base == 'standard_price':
Expand Down

0 comments on commit 1195869

Please sign in to comment.