From 10ae5bcbf6369bc51d930d45ce3c647fe14374d7 Mon Sep 17 00:00:00 2001 From: snt Date: Mon, 16 Feb 2026 15:26:22 +0100 Subject: [PATCH] [FIX] product_sale_price_from_pricelist: Correct _compute_price method signature - Changed parameter from 'qty' to 'quantity' to match Odoo 18.0 base class - Fixes TypeError: ProductPricelistItem._compute_price() got an unexpected keyword argument 'quantity' - This was causing price calculation failures when saving sale orders [FIX] website_sale_aplicoop: Fix logging format string - Changed logging format from %d to %s for existing_draft_id which is a string from JSON - Fixes 'TypeError: %d format: a real number is required, not str' in logging --- .../models/product_pricelist_item.py | 7 ++++--- website_sale_aplicoop/controllers/website_sale.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/product_sale_price_from_pricelist/models/product_pricelist_item.py b/product_sale_price_from_pricelist/models/product_pricelist_item.py index ba2e9ad..22f1eee 100644 --- a/product_sale_price_from_pricelist/models/product_pricelist_item.py +++ b/product_sale_price_from_pricelist/models/product_pricelist_item.py @@ -2,7 +2,8 @@ # @author Santi NoreƱa () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import fields, models +from odoo import fields +from odoo import models class ProductPricelistItem(models.Model): @@ -13,8 +14,8 @@ class ProductPricelistItem(models.Model): ondelete={"last_purchase_price": "set default"}, ) - def _compute_price(self, product, qty, uom, date, currency=None): - result = super()._compute_price(product, qty, uom, date, currency) + def _compute_price(self, product, quantity, uom, date, currency=None): + result = super()._compute_price(product, quantity, uom, date, currency) if self.compute_price == "formula" and self.base == "last_purchase_price": result = product.sudo().last_purchase_price_received return result diff --git a/website_sale_aplicoop/controllers/website_sale.py b/website_sale_aplicoop/controllers/website_sale.py index 19a0ce3..097ac7d 100644 --- a/website_sale_aplicoop/controllers/website_sale.py +++ b/website_sale_aplicoop/controllers/website_sale.py @@ -1624,7 +1624,7 @@ class AplicoopWebsiteSale(WebsiteSale): elif merge_action == "replace" and existing_draft_id and existing_drafts: # Replace: Delete old draft and create new one existing_drafts.unlink() - _logger.info("Deleted existing draft %d", existing_draft_id) + _logger.info("Deleted existing draft %s", existing_draft_id) # Create new draft with current items sale_order = request.env["sale.order"].create(