From 6b3c0b1e6758673ce1d8be6027b7186d46ebbde2 Mon Sep 17 00:00:00 2001 From: santiky Date: Sat, 4 Sep 2021 19:58:49 +0200 Subject: [PATCH] =?UTF-8?q?Arregla=20el=20c=C3=A1lculo=20del=20IVA,=20el?= =?UTF-8?q?=20par=C3=A1metro=20del=20contexto=20era=20incorrecto.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sale_calc_discount_b2c/models/sale.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sale_calc_discount_b2c/models/sale.py b/sale_calc_discount_b2c/models/sale.py index 4c359fb..8e87997 100644 --- a/sale_calc_discount_b2c/models/sale.py +++ b/sale_calc_discount_b2c/models/sale.py @@ -2,11 +2,11 @@ # @author: Criptomart () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -#import logging +import logging from odoo import models, fields, api -#_logger = logging.getLogger(__name__) +_logger = logging.getLogger(__name__) class SaleOrderOrderLine(models.Model): _inherit = 'sale.order.line' @@ -22,9 +22,16 @@ class SaleOrderOrderLine(models.Model): taxes = line.tax_id.compute_all(price, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=line.order_id.partner_shipping_id) if line.discount: price_disc = taxes['total_excluded'] * (1 - (line.discount or 0.0) / 100.0) - ctx = dict(self.env.context, force_price_include=False) + _logger.warning("price_list : %s" %price) + _logger.warning("total_excluded : %s" %taxes['total_excluded']) + _logger.warning("price_disc : %s" %price_disc) + ctx = dict(self.env.context, handle_price_include=False) taxes = line.tax_id.with_context(ctx).compute_all(price_disc, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=line.order_id.partner_shipping_id) + _logger.warning("price_tax : %s" %sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])) ) + _logger.warning("price_total : %s" %taxes['total_included']) + _logger.warning("price_subtotal : %s" %taxes['total_excluded']) + line.update({ 'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])), 'price_total': taxes['total_included'],