From a00f0c687296e4f658c6fb57e5739ec0c69e55f8 Mon Sep 17 00:00:00 2001 From: hugues de keyzer Date: Tue, 28 Nov 2023 10:39:34 +0100 Subject: [PATCH] [FIX] fix product.template related fields make product.template.product_variant_id a stored computed field to avoid the following error when setting the print_category_id or to_print related fields: "non-stored field product.template.product_variant_id cannot be searched." --- product_print_category/models/product_template.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/product_print_category/models/product_template.py b/product_print_category/models/product_template.py index 5f082d7d..f0078baa 100644 --- a/product_print_category/models/product_template.py +++ b/product_print_category/models/product_template.py @@ -9,6 +9,9 @@ class ProductTemplate(models.Model): _name = "product.template" _inherit = ["product.template", "product.print.category.mixin"] + # store this field (required for the related fields below) + product_variant_id = fields.Many2one(store=True) + print_category_id = fields.Many2one( related="product_variant_id.print_category_id", readonly=False )