From 1208990be3b2ebf5e197a149e80ae9a515695f87 Mon Sep 17 00:00:00 2001 From: snt Date: Sat, 14 Feb 2026 17:22:15 +0100 Subject: [PATCH] [FIX] product_sale_price_from_pricelist: Fix JavaScript error in product form view Fixed TypeError: value.toFixed is not a function when rendering monetary fields in product form views. Added default=0.0 to list_price_theoritical and last_purchase_price_received fields to prevent JavaScript from trying to format False values as numbers. Version bump: 18.0.2.1.0 -> 18.0.2.2.0 --- product_sale_price_from_pricelist/CHANGELOG.md | 10 ++++++++++ product_sale_price_from_pricelist/__manifest__.py | 2 +- .../models/product_product.py | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/product_sale_price_from_pricelist/CHANGELOG.md b/product_sale_price_from_pricelist/CHANGELOG.md index f6554fb..1389bc3 100644 --- a/product_sale_price_from_pricelist/CHANGELOG.md +++ b/product_sale_price_from_pricelist/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [18.0.2.2.0] - 2026-02-14 + +### Fixed + +- **Fixed JavaScript error in product form view** + - Error: `TypeError: value.toFixed is not a function` + - Added `default=0.0` to `list_price_theoritical` field + - Added `default=0.0` to `last_purchase_price_received` field + - This prevents JavaScript from trying to format `False` values as monetary fields + ## [18.0.2.0.0] - 2026-02-12 ### Changed diff --git a/product_sale_price_from_pricelist/__manifest__.py b/product_sale_price_from_pricelist/__manifest__.py index 760feee..9433433 100644 --- a/product_sale_price_from_pricelist/__manifest__.py +++ b/product_sale_price_from_pricelist/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { # noqa: B018 "name": "Product Sale Price from Pricelist", - "version": "18.0.2.1.0", + "version": "18.0.2.2.0", "category": "product", "summary": "Set sale price from pricelist based on last purchase price", "author": "Odoo Community Association (OCA), Criptomart", diff --git a/product_sale_price_from_pricelist/models/product_product.py b/product_sale_price_from_pricelist/models/product_product.py index a797d42..1f05fee 100644 --- a/product_sale_price_from_pricelist/models/product_product.py +++ b/product_sale_price_from_pricelist/models/product_product.py @@ -19,12 +19,14 @@ class ProductProduct(models.Model): list_price_theoritical = fields.Float( "Theoritical price", company_dependent=True, + default=0.0, ) last_purchase_price_received = fields.Float( string="Last purchase price", help="The last price at which the product was purchased. It is used as the base price field for calculating the product sale price.", digits="Product Price", company_dependent=True, + default=0.0, ) last_purchase_price_compute_type = fields.Selection( [