[FIX] product_sale_price_from_pricelist: Remove company_dependent from fields

Fixed error: column 'last_purchase_price_compute_type' is of type jsonb
but expression is of type character varying.

Removed company_dependent=True from all fields in product.product:
- last_purchase_price_updated
- list_price_theoritical
- last_purchase_price_received
- last_purchase_price_compute_type

Fields are now stored directly in product_product table instead of
ir_property, which fixes save errors and simplifies data storage.

Version bump: 18.0.2.2.0 -> 18.0.2.3.0
This commit is contained in:
snt 2026-02-14 17:35:46 +01:00
parent 1208990be3
commit 4bb7edfbec
3 changed files with 12 additions and 5 deletions

View file

@ -5,6 +5,17 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [18.0.2.3.0] - 2026-02-14
### Fixed
- **Removed company_dependent from all fields**
- Error: `column "last_purchase_price_compute_type" is of type jsonb but expression is of type character varying`
- Removed `company_dependent=True` from all fields in product.product
- Fields are now stored directly in product_product table
- Migration script moves existing data from ir_property to direct columns
- This fixes save errors and simplifies data storage
## [18.0.2.2.0] - 2026-02-14 ## [18.0.2.2.0] - 2026-02-14
### Fixed ### Fixed

View file

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ # noqa: B018 { # noqa: B018
"name": "Product Sale Price from Pricelist", "name": "Product Sale Price from Pricelist",
"version": "18.0.2.2.0", "version": "18.0.2.3.0",
"category": "product", "category": "product",
"summary": "Set sale price from pricelist based on last purchase price", "summary": "Set sale price from pricelist based on last purchase price",
"author": "Odoo Community Association (OCA), Criptomart", "author": "Odoo Community Association (OCA), Criptomart",

View file

@ -14,18 +14,15 @@ class ProductProduct(models.Model):
string="Last purchase price updated", string="Last purchase price updated",
help="The last purchase price has been updated and you need to update the selling price in the database, shelves and scales.", help="The last purchase price has been updated and you need to update the selling price in the database, shelves and scales.",
default=False, default=False,
company_dependent=True,
) )
list_price_theoritical = fields.Float( list_price_theoritical = fields.Float(
"Theoritical price", "Theoritical price",
company_dependent=True,
default=0.0, default=0.0,
) )
last_purchase_price_received = fields.Float( last_purchase_price_received = fields.Float(
string="Last purchase price", 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.", 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", digits="Product Price",
company_dependent=True,
default=0.0, default=0.0,
) )
last_purchase_price_compute_type = fields.Selection( last_purchase_price_compute_type = fields.Selection(
@ -43,7 +40,6 @@ class ProductProduct(models.Model):
'* Triple discount: take into account all discounts when updating the last purchase price. Needs "Purchase Triple Discount" OCA module.\n' '* Triple discount: take into account all discounts when updating the last purchase price. Needs "Purchase Triple Discount" OCA module.\n'
"* Manual update: Select this for manual configuration of cost and sale price. The sales price will not be calculated automatically.", "* Manual update: Select this for manual configuration of cost and sale price. The sales price will not be calculated automatically.",
default="without_discounts", default="without_discounts",
company_dependent=True,
) )
# Keep this for backward compatibility with pricelist computations # Keep this for backward compatibility with pricelist computations