Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions website_sale_extra_fields/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from .hooks import pre_init_hook
3 changes: 2 additions & 1 deletion website_sale_extra_fields/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Website Sale Extra Fields",
"version": "14.0.0.1.0",
"version": "14.0.0.1.1",
"author": "NuoBiT Solutions, S.L.",
"license": "AGPL-3",
"category": "Website",
Expand All @@ -16,4 +16,5 @@
"views/product_template.xml",
"views/product_product.xml",
],
"pre_init_hook": "pre_init_hook",
}
20 changes: 20 additions & 0 deletions website_sale_extra_fields/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright NuoBiT Solutions - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

import logging

_logger = logging.getLogger(__name__)


def pre_init_hook(cr):
_logger.info(
"Pre-creating slug_name column on product_public_category"
" to avoid NOT NULL constraint failure"
)
cr.execute(
"ALTER TABLE product_public_category"
" ADD COLUMN IF NOT EXISTS slug_name varchar"
)
cr.execute(
"UPDATE product_public_category SET slug_name = '/' WHERE slug_name IS NULL"
)
Loading