[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
This commit is contained in:
parent
d90f043617
commit
10ae5bcbf6
2 changed files with 5 additions and 4 deletions
|
|
@ -2,7 +2,8 @@
|
||||||
# @author Santi Noreña (<santi@criptomart.net>)
|
# @author Santi Noreña (<santi@criptomart.net>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# 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):
|
class ProductPricelistItem(models.Model):
|
||||||
|
|
@ -13,8 +14,8 @@ class ProductPricelistItem(models.Model):
|
||||||
ondelete={"last_purchase_price": "set default"},
|
ondelete={"last_purchase_price": "set default"},
|
||||||
)
|
)
|
||||||
|
|
||||||
def _compute_price(self, product, qty, uom, date, currency=None):
|
def _compute_price(self, product, quantity, uom, date, currency=None):
|
||||||
result = super()._compute_price(product, qty, uom, date, currency)
|
result = super()._compute_price(product, quantity, uom, date, currency)
|
||||||
if self.compute_price == "formula" and self.base == "last_purchase_price":
|
if self.compute_price == "formula" and self.base == "last_purchase_price":
|
||||||
result = product.sudo().last_purchase_price_received
|
result = product.sudo().last_purchase_price_received
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -1624,7 +1624,7 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
elif merge_action == "replace" and existing_draft_id and existing_drafts:
|
elif merge_action == "replace" and existing_draft_id and existing_drafts:
|
||||||
# Replace: Delete old draft and create new one
|
# Replace: Delete old draft and create new one
|
||||||
existing_drafts.unlink()
|
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
|
# Create new draft with current items
|
||||||
sale_order = request.env["sale.order"].create(
|
sale_order = request.env["sale.order"].create(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue