diff --git a/product_ingredient/__init__.py b/product_ingredient/__init__.py index 0650744f6bc6..6d58305f5ddc 100644 --- a/product_ingredient/__init__.py +++ b/product_ingredient/__init__.py @@ -1 +1,2 @@ from . import models +from .hooks import pre_init_hook diff --git a/product_ingredient/__manifest__.py b/product_ingredient/__manifest__.py index e163b299dee0..5f29e9ae14b8 100644 --- a/product_ingredient/__manifest__.py +++ b/product_ingredient/__manifest__.py @@ -19,6 +19,7 @@ "views/product_views.xml", "views/stock_production_lot_view.xml", ], + "pre_init_hook": "pre_init_hook", "application": False, "installable": True, } diff --git a/product_ingredient/data/product_allergen_data.xml b/product_ingredient/data/product_allergen_data.xml index c132ce4a9223..b092685c9d8b 100644 --- a/product_ingredient/data/product_allergen_data.xml +++ b/product_ingredient/data/product_allergen_data.xml @@ -1,10 +1,9 @@ + - Allergens no_variant select - diff --git a/product_ingredient/hooks.py b/product_ingredient/hooks.py new file mode 100644 index 000000000000..5697fddbe41d --- /dev/null +++ b/product_ingredient/hooks.py @@ -0,0 +1,11 @@ +# Copyright 2023 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +def pre_init_hook(cr): + """ + Create product_allergen_attribute to can be used in get_allergen_id() used in compute + methods + """ + openupgrade.load_data(cr, "product_ingredient", "data/product_allergen_data.xml")