odoo-addon-openupgrade-scripts 16.0.1.0.3.280__py3-none-any.whl → 16.0.1.0.3.281__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -624,7 +624,6 @@ def merge_gift_card_to_loyalty_card(env):
624
624
  WHERE lp.create_uid = gc.create_uid
625
625
  AND lp.create_date = gc.create_date
626
626
  AND lp.company_id = gc.company_id
627
- AND lp.currency_id = gc.currency_id
628
627
  AND lp.program_type = 'gift_card'
629
628
  )
630
629
  """,
@@ -653,7 +652,7 @@ def merge_gift_card_to_loyalty_card(env):
653
652
  create_uid,
654
653
  write_uid,
655
654
  code,
656
- expiration_date AS expired_date,
655
+ expired_date AS expiration_date,
657
656
  create_date,
658
657
  write_date,
659
658
  initial_amount AS points
@@ -661,6 +660,20 @@ def merge_gift_card_to_loyalty_card(env):
661
660
  """,
662
661
  )
663
662
  # Create records in loyalty_reward based on gift_card data
663
+ openupgrade.add_fields(
664
+ env,
665
+ [
666
+ (
667
+ "discount_product_domain",
668
+ "loyalty.reward",
669
+ "loyalty_reward",
670
+ "char",
671
+ False,
672
+ "loyalty",
673
+ "[]",
674
+ )
675
+ ],
676
+ )
664
677
  openupgrade.logged_query(
665
678
  env.cr,
666
679
  """
@@ -710,15 +723,15 @@ def merge_gift_card_to_loyalty_card(env):
710
723
  openupgrade.logged_query(
711
724
  env.cr,
712
725
  """
713
- INSERT INTO loyalty_rrule (
726
+ INSERT INTO loyalty_rule (
714
727
  program_id,
715
728
  company_id,
716
- minimun_qty,
729
+ minimum_qty,
717
730
  create_uid,
718
731
  write_uid,
719
732
  product_domain,
720
733
  reward_point_mode,
721
- minimun_amount_tax_mode,
734
+ minimum_amount_tax_mode,
722
735
  mode,
723
736
  active,
724
737
  reward_point_split,
@@ -762,7 +775,7 @@ def merge_gift_card_to_loyalty_card(env):
762
775
  JOIN gift_card gc ON gc.id = sol.gift_card_id
763
776
  WHERE gc.program_id = lc.program_id
764
777
  ) IS NOT NULL
765
- THEN lc.initial_amount - (
778
+ THEN gc.initial_amount - (
766
779
  SELECT SUM(ABS(sol.price_unit))
767
780
  FROM sale_order_line sol
768
781
  JOIN gift_card gc ON gc.id = sol.gift_card_id
@@ -793,4 +806,30 @@ def migrate(env, version):
793
806
  check_and_install_module_if_applicable(env)
794
807
  delete_sql_constraints(env)
795
808
  update_template_keys(env)
809
+
810
+ # Set default values
811
+ if not openupgrade.column_exists(env.cr, "loyalty_card", "expiration_date"):
812
+ openupgrade.add_fields(
813
+ env,
814
+ [
815
+ (
816
+ "expiration_date",
817
+ "loyalty.card",
818
+ "loyalty_card",
819
+ "date",
820
+ "date",
821
+ "loyalty",
822
+ False,
823
+ )
824
+ ],
825
+ )
826
+ openupgrade.logged_query(
827
+ env.cr,
828
+ """
829
+ UPDATE loyalty_card lc
830
+ SET expiration_date = lc.create_date + interval '1' day * lp.validity_duration
831
+ from loyalty_program lp
832
+ where lp.id = lc.program_id and lp.validity_duration > 0
833
+ """,
834
+ )
796
835
  merge_gift_card_to_loyalty_card(env)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade_scripts
3
- Version: 16.0.1.0.3.280
3
+ Version: 16.0.1.0.3.281
4
4
  Summary: Module that contains all the migrations analysis and scripts for migrate Odoo SA modules.
5
5
  Home-page: https://github.com/OCA/OpenUpgrade
6
6
  Author: Odoo Community Association (OCA)
@@ -352,7 +352,7 @@ odoo/addons/openupgrade_scripts/scripts/l10n_vn/16.0.2.0.1/upgrade_analysis.txt,
352
352
  odoo/addons/openupgrade_scripts/scripts/l10n_za/16.0.1.0/upgrade_analysis.txt,sha256=-rQO3Wi0H1nDy8cjmJOl_yo6IgOxMhm6f4FHP31Qs4g,1739
353
353
  odoo/addons/openupgrade_scripts/scripts/link_tracker/16.0.1.1/upgrade_analysis.txt,sha256=Ph-CuEBHU1WnRHswlXmC4YvE1LOo-0EpydbqIJ4VBSU,159
354
354
  odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/post-migration.py,sha256=XP28cFyPCipISepMu7e2nrSp--vPvoJARj5fr8M86ig,1963
355
- odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/pre-migration.py,sha256=lgNThpg84E_fWkQdaC9qW2DuEUsDMvSyOXCZT6PaeFE,23021
355
+ odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/pre-migration.py,sha256=P3qrMNAVByN0ezDDXsmhwk9M4J6wySWfZYmYGcKEZpQ,24055
356
356
  odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis.txt,sha256=N2waWK_WAcEsvrjG2mgGAVb4WLl76tVH7oU880Ei2mk,14561
357
357
  odoo/addons/openupgrade_scripts/scripts/loyalty/16.0.1.0/upgrade_analysis_work.txt,sha256=CW3VLkf5gsTyuA_YHUeqxDKSyuXn5x5MBuMz8FYOuKY,11368
358
358
  odoo/addons/openupgrade_scripts/scripts/loyalty_delivery/16.0.1.0/upgrade_analysis.txt,sha256=8TnNXqdMPDyxBHuN4C6DaxijUWSLag4XVe15HbTg4BI,419
@@ -714,7 +714,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
714
714
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
715
715
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
716
716
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
717
- odoo_addon_openupgrade_scripts-16.0.1.0.3.280.dist-info/METADATA,sha256=k1b7o8KT70Kb6RP472AbUdU6anJIBEjUy22NpZQficY,3790
718
- odoo_addon_openupgrade_scripts-16.0.1.0.3.280.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
719
- odoo_addon_openupgrade_scripts-16.0.1.0.3.280.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
720
- odoo_addon_openupgrade_scripts-16.0.1.0.3.280.dist-info/RECORD,,
717
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.281.dist-info/METADATA,sha256=z9mj0Gn2tIDZNaqDJ4plAGoZSCOtFrsPmancGy3EHL4,3790
718
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.281.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
719
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.281.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
720
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.281.dist-info/RECORD,,