stock_average_daily_sale: Pre-migration script

This commit is contained in:
twalter-c2c
2024-09-13 10:08:16 +02:00
parent feb91ffbbc
commit ed6ea72d8d
2 changed files with 21 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
"name": "Stock Average Daily Sale",
"summary": """
Allows to gather delivered products average on daily basis""",
"version": "16.0.1.0.0",
"version": "16.0.1.1.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-reporting",

View File

@@ -0,0 +1,20 @@
# Copyright 2024 Camptocamp SA (http://www.camptocamp.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from odoo.tools.sql import column_exists, create_column
_logger = logging.getLogger(__name__)
def migrate(cr, version):
if not version:
return
if not column_exists(cr, "stock_average_daily_sale_config", "exclude_weekends"):
_logger.info("Create stock_average_daily_sale_config column exclude_weekends")
create_column(
cr, "stock_average_daily_sale_config", "exclude_weekends", "boolean"
)
cr.execute("UPDATE stock_average_daily_sale_config SET exclude_weekends = True")