Skip to content

Commit

Permalink
Merge branch 'oca-port-from-14.0-to-12.0-pr-1651' of git+ssh://github…
Browse files Browse the repository at this point in the history
….com/efatto/sale-workflow into 12.0
  • Loading branch information
Pretecno committed Feb 24, 2025
2 parents 445d090 + 23bfc72 commit 07718bc
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions sale_discount_display_amount/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from odoo.api import Environment
from odoo import SUPERUSER_ID
from odoo.tools.sql import column_exists, create_column

_logger = logging.getLogger(__name__)

Expand All @@ -17,20 +18,10 @@


def pre_init_hook(cr):
_logger.info("Create discount columns in database")
cr.execute("""
ALTER TABLE sale_order ADD COLUMN price_total_no_discount numeric;
""")
cr.execute("""
ALTER TABLE sale_order ADD COLUMN discount_total numeric;
""")
cr.execute("""
ALTER TABLE sale_order_line ADD COLUMN price_total_no_discount
numeric;
""")
cr.execute("""
ALTER TABLE sale_order_line ADD COLUMN discount_total numeric;
""")
for table, column in COLUMNS:
if not column_exists(cr, table, column):
_logger.info("Create discount column %s in database", column)
create_column(cr, table, column, "numeric")


def post_init_hook(cr, registry):
Expand Down

0 comments on commit 07718bc

Please sign in to comment.