diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index c325688508db..0402de39ddfb 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -100,7 +100,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | contacts |Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| |del| coupon | | | +| |del| coupon |Nothing to do |Merged into loyalty | +-------------------------------------------------+----------------------+-------------------------------------------------+ | crm |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -150,7 +150,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | gamification_sale_crm |Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| |del| gift_card | | | +| |del| gift_card |Nothing to do |Merged into loyalty | +-------------------------------------------------+----------------------+-------------------------------------------------+ | google_account |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -454,7 +454,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | link_tracker |Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| |new| loyalty | | | +| |new| loyalty |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | |new| loyalty_delivery | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/loyalty/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/loyalty/16.0.1.0/post-migration.py new file mode 100644 index 000000000000..5efd5e72c1e0 --- /dev/null +++ b/openupgrade_scripts/scripts/loyalty/16.0.1.0/post-migration.py @@ -0,0 +1,73 @@ +from openupgradelib import openupgrade + + +def _move_gift_cart_to_loyalty_card(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_card + ADD COLUMN IF NOT EXISTS old_gift_card_id INTEGER + """, + ) + openupgrade.logged_query( + env.cr, + """ + WITH inserted_loyalty_program AS ( + INSERT INTO loyalty_program ( + company_id, + currency_id, + name, + active, + program_type, + applies_on, + trigger, + portal_visible + ) + SELECT + DISTINCT(card.company_id), + company.currency_id, + jsonb_object_agg('en_US', 'Gift Cards'), + true, + 'gift_card', + 'future', + 'auto', + true + FROM gift_card card + JOIN res_company company ON company.id = card.company_id + GROUP BY card.company_id, company.currency_id + RETURNING id, company_id + ) + INSERT INTO loyalty_card ( + old_gift_card_id, + program_id, + company_id, + partner_id, + code, + expiration_date, + points, + create_uid, + create_date, + write_uid, + write_date + ) + SELECT + card.id, + program.id, + card.company_id, + card.partner_id, + card.code, + card.expired_date, + card.initial_amount, + card.create_uid, + card.create_date, + card.write_uid, + card.write_date + FROM gift_card card + JOIN inserted_loyalty_program program ON program.company_id = card.company_id + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + _move_gift_cart_to_loyalty_card(env) diff --git a/openupgrade_scripts/scripts/loyalty/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/loyalty/16.0.1.0/pre-migration.py new file mode 100644 index 000000000000..cf6f9f14e341 --- /dev/null +++ b/openupgrade_scripts/scripts/loyalty/16.0.1.0/pre-migration.py @@ -0,0 +1,466 @@ +from openupgradelib import openupgrade + +_model_renames = [ + ("coupon.coupon", "loyalty.card"), + ("coupon.program", "loyalty.program"), + ("coupon.reward", "loyalty.reward"), + ("coupon.rule", "loyalty.rule"), +] + +_table_renameds = [ + ("coupon_coupon", "loyalty_card"), + ("coupon_program", "loyalty_program"), + ("coupon_reward", "loyalty_reward"), + ("coupon_rule", "loyalty_rule"), +] + +_field_renames = [ + ( + "loyalty.program", + "loyalty_program", + "promo_applicability", + "applies_on", + ), + ( + "loyalty.program", + "loyalty_program", + "max_usage", + "maximum_use_number", + ), + ( + "loyalty.reward", + "loyalty_reward", + "reward_description", + "description", + ), + ( + "loyalty.reward", + "loyalty_reward", + "discount_percentage", + "discount", + ), + ( + "loyalty.reward", + "loyalty_reward", + "discount_apply_on", + "discount_applicability", + ), + ( + "loyalty.reward", + "loyalty_reward", + "discount_type", + "discount_mode", + ), + ( + "loyalty.reward", + "loyalty_reward", + "discount_specific_product_ids", + "discount_product_ids", + ), + ( + "loyalty.reward", + "loyalty_reward", + "reward_product_quantity", + "reward_product_qty", + ), + ( + "loyalty.rule", + "loyalty_rule", + "rule_minimum_amount", + "minimum_amount", + ), + ( + "loyalty.rule", + "loyalty_rule", + "rule_minimum_amount_tax_inclusion", + "minimum_amount_tax_mode", + ), + ( + "loyalty.rule", + "loyalty_rule", + "rule_min_quantity", + "minimum_qty", + ), + ( + "loyalty.rule", + "loyalty_rule", + "rule_products_domain", + "product_domain", + ), +] + +_xmlid_renames = [ + ("sale_gift_card.mail_template_gift_card", "loyalty.mail_template_gift_card"), + ("gift_card.gift_card_product_50", "loyalty.gift_card_product_50"), +] + + +def _rename_models(env): + openupgrade.rename_models(env.cr, _model_renames) + + +def _rename_tables(env): + openupgrade.rename_tables(env.cr, _table_renameds) + + +def _rename_fields(env): + openupgrade.rename_fields(env, _field_renames) + + +# =========================== Card ============================== + + +def _fill_loyalty_card_company_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_card + ADD COLUMN IF NOT EXISTS company_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_card card + SET company_id = program.company_id + FROM loyalty_program program + WHERE program.id = card.program_id""", + ) + + +def _fill_loyalty_card_expiration_date(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_card + ADD COLUMN IF NOT EXISTS expiration_date DATE""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_card card + SET expiration_date = + (card.create_date::date + INTERVAL '1 day' * program.validity_duration)::date + FROM loyalty_program program + WHERE program.validity_duration > 0 AND program.id = card.program_id + """, + ) + + +# ========================= Program ============================== +def _map_loyalty_program_program_type(env): + # 1. if reward_product_id is not null then program_type = 'buy_x_get_y' + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program program + SET program_type = 'buy_x_get_y' + FROM loyalty_reward reward + WHERE reward.reward_product_id IS NOT NULL AND program.reward_id = reward.id + """, + ) + # 2. if promo_applicability = 'on_next_order' then program_type = 'next_order_coupons' + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program + SET program_type = 'next_order_coupons' + WHERE promo_applicability = 'on_next_order' + """, + ) + # 3. if promo_code_usage = 'code_needed' then program_type = 'promo_code' + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program + SET program_type = 'promo_code' + WHERE promo_code_usage = 'code_needed' + """, + ) + + +def _fill_loyalty_program_applies_on(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program + SET applies_on = CASE + WHEN program_type IN ('coupons', 'promotion', 'promo_code', 'buy_x_get_y') + THEN 'current' + WHEN program_type IN ('gift_card', 'ewallet', 'next_order_coupons') + THEN 'future' + WHEN program_type = 'loyalty' THEN 'both' + END + WHERE applies_on IN ( + 'coupons', 'promotion', 'gift_card', 'loyalty', 'ewallet', 'promo_code', + 'buy_x_get_y', 'next_order_coupons' + ) + """, + ) + + +def _fill_loyalty_program_trigger(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_program + ADD COLUMN IF NOT EXISTS trigger CHARACTER VARYING""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program + SET trigger = CASE + WHEN program_type IN ('coupons', 'promo_code') THEN 'with_code' + ELSE 'auto' + END + WHERE program_type in ( + 'coupons', 'promotion', 'gift_card', 'loyalty', 'ewallet', 'promo_code', + 'buy_x_get_y', 'next_order_coupons' + ) + """, + ) + + +def _fill_loyalty_program_currency_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_program + ADD COLUMN IF NOT EXISTS currency_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program program + SET currency_id = company.currency_id + FROM res_company company + WHERE program.company_id = company.id""", + ) + + +def _fill_loyalty_program_date_to(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_program + ADD COLUMN IF NOT EXISTS date_to DATE""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_program program + SET date_to = rule.rule_date_to::date + FROM loyalty_rule rule + WHERE rule.rule_date_to IS NOT NULL AND program.rule_id = rule.id + """, + ) + + +# ========================= Reward ============================== +def _fill_loyalty_reward_company_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_reward + ADD COLUMN IF NOT EXISTS company_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_reward reward + SET company_id = program.company_id + FROM loyalty_program program + WHERE reward.program_id = program.id""", + ) + + +def _fill_loyalty_reward_program_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_reward + ADD COLUMN IF NOT EXISTS program_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_reward reward + SET program_id = prog.reward_id + FROM loyalty_program prog + WHERE reward.id = prog.reward_id + """, + ) + + +def _fill_loyalty_discount_applicability(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_reward + SET discount_applicability = CASE + WHEN discount_applicability = 'specific_products' THEN 'specific' + WHEN discount_applicability = 'cheapest_product' THEN 'cheapest' + ELSE 'order' + END + WHERE discount_applicability IN ( + 'on_order', 'specific_products', 'cheapest_product' + ) + """, + ) + + +def _map_loyalty_reward_discount_mode(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_reward + SET discount_mode = CASE + WHEN discount_mode = 'fixed_amount' THEN 'per_point' + ELSE 'percent' + END + WHERE discount_mode IN ('fixed_amount', 'percentage') + """, + ) + + +# =========================== Rule ============================== + + +def _fill_loyalty_rule_code(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_rule + ADD COLUMN IF NOT EXISTS code CHARACTER VARYING""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_rule rule + SET code = program.promo_code + FROM loyalty_program program + WHERE program.promo_code IS NOT NULL AND program.id = rule.program_id + """, + ) + + +def _fill_loyalty_rule_program_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_rule + ADD COLUMN IF NOT EXISTS program_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_rule rule + SET program_id = prog.rule_id + FROM loyalty_program prog + WHERE rule.id = prog.rule_id + """, + ) + + +def _fill_loyalty_rule_company_id(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_rule + ADD COLUMN IF NOT EXISTS company_id INTEGER""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_rule rule + SET company_id = program.company_id + FROM loyalty_program program + WHERE rule.program_id = program.id""", + ) + + +def _fill_loyalty_rule_minimum_amount_tax_mode(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_rule + SET minimum_amount_tax_mode = CASE + WHEN minimum_amount_tax_mode = 'tax_excluded' THEN 'excl' + ELSE 'incl' + END + WHERE minimum_amount_tax_mode IN ('tax_included', 'tax_excluded') + """, + ) + + +def _fill_loyalty_rule_mode(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_rule + ADD COLUMN IF NOT EXISTS mode CHARACTER VARYING""", + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE loyalty_rule rule + SET code = CASE + WHEN program.promo_code IS NOT NULL THEN 'with_code' + ELSE 'auto' + END + FROM loyalty_program program + WHERE program.id = rule.program_id + """, + ) + + +def _fill_loyalty_rule_reward_point_mode(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE loyalty_rule + ADD COLUMN IF NOT EXISTS reward_point_mode CHARACTER VARYING + DEFAULT 'order'""", + ) + + +# =============================== Migrate =============================== + + +@openupgrade.migrate() +def migrate(env, version): + _rename_models(env) + _rename_tables(env) + + _map_loyalty_program_program_type(env) + _rename_fields(env) + + _fill_loyalty_rule_program_id(env) + _fill_loyalty_reward_program_id(env) + + _fill_loyalty_program_applies_on(env) + _fill_loyalty_program_trigger(env) + _fill_loyalty_program_currency_id(env) + _fill_loyalty_program_date_to(env) + + _fill_loyalty_card_company_id(env) + _fill_loyalty_card_expiration_date(env) + + _fill_loyalty_reward_company_id(env) + _fill_loyalty_discount_applicability(env) + _map_loyalty_reward_discount_mode(env) + _fill_loyalty_rule_code(env) + _fill_loyalty_rule_minimum_amount_tax_mode(env) + _fill_loyalty_rule_company_id(env) + _fill_loyalty_rule_mode(env) + _fill_loyalty_rule_reward_point_mode(env) + + openupgrade.rename_xmlids(env.cr, _xmlid_renames) + openupgrade.set_xml_ids_noupdate_value( + env, + "loyalty", + [ + "gift_card_product_50", + ], + False, + ) diff --git a/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..ac07a45cc541 --- /dev/null +++ b/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,288 @@ +---Models in module 'loyalty'--- +new model loyalty.card ( renamed from coupon.coupon ) +new model loyalty.generate.wizard [transient] ( renamed from coupon.generate.wizard ) +# DONE: pre-migration: renamed models +# DONE: pre-migration: move gift_cart data to loyalty_card + +new model loyalty.mail ( new model ) +# NOTHING TO DO + +new model loyalty.program ( renamed from coupon.program ) +new model loyalty.reward ( renamed from coupon.reward ) +new model loyalty.rule ( renamed from coupon.rule ) +# DONE: pre-migration: renamed models + + +=============================================Loyalty.Card================================================================ + +---Fields in module 'loyalty'--- +loyalty / loyalty.card / code (char) : NEW required, hasdefault: default +# NOTHING TODO: renamed model but structure of field not change + +loyalty / loyalty.card / company_id (many2one) : NEW relation: res.company, isrelated: related, stored +# DONE - pre-migration: create new column and fill value for it + +loyalty / loyalty.card / expiration_date (date) : NEW +# DONE - pre-magration: create new column and fill value for it. now, expiration_date is stored + +loyalty / loyalty.card / message_follower_ids (one2many): NEW relation: mail.followers +loyalty / loyalty.card / message_ids (one2many) : NEW relation: mail.message +# NOTHING TO DO + +loyalty / loyalty.card / message_main_attachment_id (many2one): NEW relation: ir.attachment +# NOTHING TO DO + +loyalty / loyalty.card / partner_id (many2one) : NEW relation: res.partner +# NOTHING TO DO: renamed model but structure of field not change + +loyalty / loyalty.card / points (float) : NEW +# NOTHING TO DO + +loyalty / loyalty.card / program_id (many2one) : NEW relation: loyalty.program, hasdefault: default +# NOTHING TO DO: renamed model but structure of field not change + + +=============================================Loyalty.mail================================================================ + +loyalty / loyalty.mail / active (boolean) : NEW hasdefault: default +loyalty / loyalty.mail / mail_template_id (many2one) : NEW relation: mail.template, required +loyalty / loyalty.mail / points (float) : NEW +loyalty / loyalty.mail / program_id (many2one) : NEW relation: loyalty.program, required +loyalty / loyalty.mail / trigger (selection) : NEW required, selection_keys: ['create', 'points_reach'] +# NOTHING TO DO + + +=============================================Loyalty.program================================================================ + +loyalty / loyalty.program / active (boolean) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.program / applies_on (selection) : NEW required, selection_keys: ['both', 'current', 'future'], hasdefault: default +# DONE: pre-migration: +1. if program_type IN ('coupons', 'promotion', 'promo_code', 'buy_x_get_y') THEN 'current' +2. if program_type IN ('gift_card', 'ewallet', 'next_order_coupons') THEN 'future' + +loyalty / loyalty.program / available_on (boolean) : NEW +# NOTHING TO DO: store = False + +loyalty / loyalty.program / communication_plan_ids (one2many): NEW relation: loyalty.mail, hasdefault: compute +# NOTHING TO DO + +loyalty / loyalty.program / company_id (many2one) : NEW relation: res.company, hasdefault: default +# NOTHING TO DO. renamed model but this field no change + +loyalty / loyalty.program / coupon_ids (one2many) : NEW relation: loyalty.card +# NOTHING TO DO + +loyalty / loyalty.program / currency_id (many2one) : NEW relation: res.currency, required, hasdefault: compute +# DONE pre-migration: create column and fill data + +loyalty / loyalty.program / date_to (date) : NEW +# DONE pre-migration: create column & fill data (rule_id.rule_date_to) + +loyalty / loyalty.program / limit_usage (boolean) : NEW +# NOTHING TO DO + +loyalty / loyalty.program / max_usage (integer) : NEW +# DONE pre-migration: renamed column ( maximum_use_number ) + +loyalty / loyalty.program / name (char) : NEW required +# NOTHING TO DO + +loyalty / loyalty.program / portal_point_name (char) : NEW hasdefault: default +# TODO + +loyalty / loyalty.program / portal_visible (boolean) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.program / program_type (selection) : NEW required, selection_keys: ['buy_x_get_y', 'coupons', 'ewallet', 'gift_card', 'loyalty', 'next_order_coupons', 'promo_code', 'promotion'], hasdefault: default +# DONE: pre-migration: +# 1. if reward_product_id is not null then program_type = 'buy_x_get_y' +# 2. if promo_applicability = 'on_next_order' then program_type = 'next_order_coupons' +# 3. if promo_code_usage = 'code_needed' then program_type = 'promo_code' + +loyalty / loyalty.program / reward_ids (one2many) : NEW relation: loyalty.reward, hasdefault: compute +loyalty / loyalty.program / rule_ids (one2many) : NEW relation: loyalty.rule, hasdefault: compute +# DONE: pre-migration: convert many2one to one2many + +loyalty / loyalty.program / sequence (integer) : NEW +# NOTHING TO DO + +loyalty / loyalty.program / trigger (selection) : NEW selection_keys: ['auto', 'with_code'], hasdefault: compute +# DONE: pre-migration: +# 1. if program_type IN ('coupons', 'promo_code') THEN 'with_code' ELSE 'auto' + + +=============================================Loyalty.reward================================================================ + +loyalty / loyalty.reward / active (boolean) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.reward / clear_wallet (boolean) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.reward / company_id (many2one) : NEW relation: res.company, isrelated: related, stored +# DONE pre-migration: create column & fill data + +loyalty / loyalty.reward / description (char) : NEW hasdefault: compute +# DONE pre-migration: renamed column from reward_description + +loyalty / loyalty.reward / discount (float) : NEW hasdefault: default +# DONE pre-migration: renamed column from discount_percentage - after fill data if value = 0 + +loyalty / loyalty.reward / discount_applicability (selection): NEW selection_keys: ['cheapest', 'order', 'specific'], hasdefault: default +# DONE pre-migration: renamed column from discount_apply_on +# if value = on_order set value = order| if value = cheapest_product set value = cheapest | if value = specific_products set value = specific + +loyalty / loyalty.reward / discount_line_product_id (many2one): NEW relation: product.product +# NOTHING TO DO + +loyalty / loyalty.reward / discount_max_amount (float) : NEW +# NOTHING TO DO + +loyalty / loyalty.reward / discount_mode (selection) : NEW required, selection_keys: function, hasdefault: default +# DONE pre-migration: renamed column (discount_type) +# Set value to percent if value = percentage | set value to per_point if value = fixed_amount + +loyalty / loyalty.reward / discount_product_category_id (many2one): NEW relation: product.category +# NOTHING TO DO + +loyalty / loyalty.reward / discount_product_domain (char): NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.reward / discount_product_ids (many2many): NEW relation: product.product +# DONE: pre-migration: renamed from discount_specific_product_ids + +loyalty / loyalty.reward / discount_product_tag_id (many2one): NEW relation: product.tag +# NOTHING TO DO + +loyalty / loyalty.reward / program_id (many2one) : NEW relation: loyalty.program, required + +# DONE pre-migration: fill value from loyalty.program + +loyalty / loyalty.reward / required_points (float) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.reward / reward_product_id (many2one) : NEW relation: product.product +# NOTHING TO DO + +loyalty / loyalty.reward / reward_product_qty (integer) : NEW hasdefault: default +# DONE pre-migration: renamed from reward_product_quantity - SET value before renamed field + +loyalty / loyalty.reward / reward_product_tag_id (many2one): NEW relation: product.tag +# NOTHING TO DO + +loyalty / loyalty.reward / reward_type (selection) : NEW required, selection_keys: ['discount', 'product'], hasdefault: default +# NOTHING TO DO: renamed model but structure of field not change + + +=============================================Loyalty.rule================================================================ + +loyalty / loyalty.rule / active (boolean) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.rule / code (char) : NEW hasdefault: compute +# DONE per-migration: set code = loyalty_program.promo_code + +loyalty / loyalty.rule / company_id (many2one) : NEW relation: res.company, isrelated: related, stored +# DONE pre-migration: create column & fill data => program_id.company_id + +loyalty / loyalty.rule / minimum_amount (float) : NEW +# DONE pre-migration: renamed from rule_minimum_amount + +loyalty / loyalty.rule / minimum_amount_tax_mode (selection): NEW required, selection_keys: ['excl', 'incl'], hasdefault: default +# DONE pre-migration: renamed from rule_minimum_amount_tax_inclusion +# SET value to incl if tax_included | to excl if tax_excluded + +loyalty / loyalty.rule / minimum_qty (integer) : NEW hasdefault: default +# DONE pre-migration: renamed from rule_min_quantity + +loyalty / loyalty.rule / mode (selection) : NEW selection_keys: ['auto', 'with_code'], hasdefault: compute +# DONE pre-migration: if loyalty_program.promo_code IS NOT NULL THEN 'with_code' ELSE 'auto' + +loyalty / loyalty.rule / product_category_id (many2one): NEW relation: product.category +# NOTHING TO DO + +loyalty / loyalty.rule / product_domain (char) : NEW hasdefault: default +# DONE pre-migration. renamed from rule_products_domain + +loyalty / loyalty.rule / product_ids (many2many) : NEW relation: product.product +# NOTHING TO DO + +loyalty / loyalty.rule / product_tag_id (many2one) : NEW relation: product.tag +# NOTHING TO DO + +loyalty / loyalty.rule / program_id (many2one) : NEW relation: loyalty.program, required +# DONE pre-migration: fill value from loyalty.program + +loyalty / loyalty.rule / reward_point_amount (float) : NEW hasdefault: default +# NOTHING TO DO + +loyalty / loyalty.rule / reward_point_mode (selection) : NEW required, selection_keys: function, hasdefault: default +# DONE: pre-migration. add column & set value default to 'order' + +loyalty / loyalty.rule / reward_point_split (boolean) : NEW hasdefault: default +# NOTHING TO DO + + +---XML records in module 'loyalty'--- +NEW ir.actions.act_window: loyalty.loyalty_card_action +NEW ir.actions.act_window: loyalty.loyalty_generate_wizard_action +NEW ir.actions.act_window: loyalty.loyalty_program_discount_loyalty_action +NEW ir.actions.act_window: loyalty.loyalty_program_gift_ewallet_action +NEW ir.actions.act_window.view: loyalty.action_loyalty_program_form_discount_loyalty +NEW ir.actions.act_window.view: loyalty.action_loyalty_program_form_gift_card_ewallet +NEW ir.actions.act_window.view: loyalty.action_loyalty_program_tree_discount_loyalty +NEW ir.actions.act_window.view: loyalty.action_loyalty_program_tree_gift_card_ewallet +NEW ir.actions.report: loyalty.report_gift_card +NEW ir.actions.report: loyalty.report_loyalty_card +NEW ir.model.access: loyalty.access_loyalty_card +NEW ir.model.access: loyalty.access_loyalty_generate_wizard +NEW ir.model.access: loyalty.access_loyalty_mail +NEW ir.model.access: loyalty.access_loyalty_program +NEW ir.model.access: loyalty.access_loyalty_reward +NEW ir.model.access: loyalty.access_loyalty_rule +NEW ir.model.constraint: loyalty.constraint_loyalty_card_card_code_unique +NEW ir.model.constraint: loyalty.constraint_loyalty_program_check_max_usage +NEW ir.model.constraint: loyalty.constraint_loyalty_reward_discount_positive +NEW ir.model.constraint: loyalty.constraint_loyalty_reward_product_qty_positive +NEW ir.model.constraint: loyalty.constraint_loyalty_reward_required_points_positive +NEW ir.model.constraint: loyalty.constraint_loyalty_rule_reward_point_amount_positive +# NOTHING TO DO + +NEW ir.rule: loyalty.sale_loyalty_card_company_rule (noupdate) +NEW ir.rule: loyalty.sale_loyalty_program_company_rule (noupdate) +NEW ir.rule: loyalty.sale_loyalty_reward_company_rule (noupdate) +NEW ir.rule: loyalty.sale_loyalty_rule_company_rule (noupdate) +# NOTHING TO DO + +NEW ir.ui.view: loyalty.gift_card_report +NEW ir.ui.view: loyalty.gift_card_report_i18n +NEW ir.ui.view: loyalty.loyalty_card_view_form +NEW ir.ui.view: loyalty.loyalty_card_view_search +NEW ir.ui.view: loyalty.loyalty_card_view_tree +NEW ir.ui.view: loyalty.loyalty_generate_wizard_view_form +NEW ir.ui.view: loyalty.loyalty_mail_view_tree +NEW ir.ui.view: loyalty.loyalty_program_gift_ewallet_view_form +NEW ir.ui.view: loyalty.loyalty_program_view_form +NEW ir.ui.view: loyalty.loyalty_program_view_search +NEW ir.ui.view: loyalty.loyalty_program_view_tree +# NOTHING TO DO + +NEW ir.ui.view: loyalty.loyalty_report +NEW ir.ui.view: loyalty.loyalty_report_i18n +NEW ir.ui.view: loyalty.loyalty_reward_view_form +NEW ir.ui.view: loyalty.loyalty_reward_view_kanban +NEW ir.ui.view: loyalty.loyalty_rule_view_form +NEW ir.ui.view: loyalty.loyalty_rule_view_kanban +# NOTHING TO DO + +NEW mail.template: loyalty.mail_template_gift_card [renamed from sale_gift_card module] +# DONE pre-migration: rename_xmlids + +NEW mail.template: loyalty.mail_template_loyalty_card +NEW product.product: loyalty.ewallet_product_50 +# NOTHING TO DO + +NEW product.product: loyalty.gift_card_product_50 [renamed from gift_card module] (noupdate switched) +# DONE pre-migration: rename_xmlids and noupdate switched