diff --git a/loyalty_multi_gift/__manifest__.py b/loyalty_multi_gift/__manifest__.py index c7d26774..2d486931 100644 --- a/loyalty_multi_gift/__manifest__.py +++ b/loyalty_multi_gift/__manifest__.py @@ -1,15 +1,15 @@ # Copyright 2021 Tecnativa - David Vidal # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - "name": "Coupons multi gift", + "name": "Loyalty multi gift", "summary": "Allows to configure multiple gift rewards per promotion", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "development_status": "Beta", "category": "Sale", "website": "https://github.com/OCA/sale-promotion", "author": "Tecnativa, Odoo Community Association (OCA)", "maintainers": ["chienandalu"], "license": "AGPL-3", - "depends": ["coupon"], - "data": ["views/coupon_program_views.xml", "security/ir.model.access.csv"], + "depends": ["loyalty"], + "data": ["views/loyalty_program_views.xml", "security/ir.model.access.csv"], } diff --git a/loyalty_multi_gift/i18n/coupon_multi_gift.pot b/loyalty_multi_gift/i18n/coupon_multi_gift.pot deleted file mode 100644 index 57f78031..00000000 --- a/loyalty_multi_gift/i18n/coupon_multi_gift.pot +++ /dev/null @@ -1,131 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * coupon_multi_gift -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" -"Report-Msgid-Bugs-To: \n" -"Last-Translator: \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: coupon_multi_gift -#: model:ir.model,name:coupon_multi_gift.model_coupon_reward_product_line -msgid "Coupon Multi Gift" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model,name:coupon_multi_gift.model_coupon_reward -msgid "Coupon Reward" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__create_uid -msgid "Created by" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__create_date -msgid "Created on" -msgstr "" - -#. module: coupon_multi_gift -#: model_terms:ir.ui.view,arch_db:coupon_multi_gift.coupon_program_view_form_common -msgid "Default gift" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_program__reward_type -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward__reward_type -msgid "" -"Discount - Reward will be provided as discount.\n" -"Free Product - Free product will be provide as reward \n" -"Free Shipping - Free shipping will be provided as reward (Need delivery module)" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__display_name -msgid "Display Name" -msgstr "" - -#. module: coupon_multi_gift -#: code:addons/coupon_multi_gift/models/coupon_reward.py:0 -#, python-format -msgid "Free Products - %(name)s" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_product_ids -msgid "Gift Options" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_program__coupon_multi_gift_ids -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward__coupon_multi_gift_ids -msgid "Gift list" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__id -msgid "ID" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line____last_update -msgid "Last Modified on" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__write_uid -msgid "Last Updated by" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__write_date -msgid "Last Updated on" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields.selection,name:coupon_multi_gift.selection__coupon_reward__reward_type__multi_gift -msgid "Multi Gift" -msgstr "" - -#. module: coupon_multi_gift -#: model_terms:ir.ui.view,arch_db:coupon_multi_gift.coupon_program_view_form_common -msgid "Qty" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_product_quantity -msgid "Quantity" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_id -msgid "Reward" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_default_product_id -msgid "Reward Default Product" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward_product_line__reward_product_ids -msgid "Reward Product" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_program__reward_type -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward__reward_type -msgid "Reward Type" -msgstr "" - -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward_product_line__reward_product_quantity -msgid "Reward product quantity" -msgstr "" diff --git a/loyalty_multi_gift/i18n/es.po b/loyalty_multi_gift/i18n/es.po index 9fbf91af..4d32be9d 100644 --- a/loyalty_multi_gift/i18n/es.po +++ b/loyalty_multi_gift/i18n/es.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * coupon_multi_gift +# * loyalty_multi_gift # msgid "" msgstr "" @@ -17,34 +17,34 @@ msgstr "" "Plural-Forms: \n" "X-Generator: Poedit 3.1.1\n" -#. module: coupon_multi_gift -#: model:ir.model,name:coupon_multi_gift.model_coupon_reward_product_line +#. module: loyalty_multi_gift +#: model:ir.model,name:loyalty_multi_gift.model_coupon_reward_product_line msgid "Coupon Multi Gift" msgstr "Promociones multi regalo" -#. module: coupon_multi_gift -#: model:ir.model,name:coupon_multi_gift.model_coupon_reward +#. module: loyalty_multi_gift +#: model:ir.model,name:loyalty_multi_gift.model_coupon_reward msgid "Coupon Reward" msgstr "Cupón de recompensa" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__create_uid +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__create_uid msgid "Created by" msgstr "Creado por" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__create_date +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__create_date msgid "Created on" msgstr "Creado en" -#. module: coupon_multi_gift -#: model_terms:ir.ui.view,arch_db:coupon_multi_gift.coupon_program_view_form_common +#. module: loyalty_multi_gift +#: model_terms:ir.ui.view,arch_db:loyalty_multi_gift.coupon_program_view_form_common msgid "Default gift" msgstr "Regalo por defecto" -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_program__reward_type -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward__reward_type +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_program__reward_type +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward__reward_type msgid "" "Discount - Reward will be provided as discount.\n" "Free Product - Free product will be provide as reward \n" @@ -56,85 +56,85 @@ msgstr "" "Envío gratis: Se ofrecerá envío gratuito a modo de recompensa (módulo de " "entrega requerido)" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__display_name +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__display_name msgid "Display Name" msgstr "Nombre mostrado" -#. module: coupon_multi_gift -#: code:addons/coupon_multi_gift/models/coupon_reward.py:0 +#. module: loyalty_multi_gift +#: code:addons/loyalty_multi_gift/models/coupon_reward.py:0 #, python-format msgid "Free Products - %(name)s" msgstr "Productos gratuítos - %(name)s" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_product_ids +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_ids msgid "Gift Options" msgstr "Opciones de regalo" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_program__coupon_multi_gift_ids -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward__coupon_multi_gift_ids +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_program__loyalty_multi_gift_ids +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward__loyalty_multi_gift_ids msgid "Gift list" msgstr "Lista de regalos" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__id +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__id msgid "ID" msgstr "ID (identificación)" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line____last_update +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line____last_update msgid "Last Modified on" msgstr "Última modificación en" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__write_uid +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__write_uid msgid "Last Updated by" msgstr "Última actualización de" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__write_date +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__write_date msgid "Last Updated on" msgstr "Última actualización en" -#. module: coupon_multi_gift -#: model:ir.model.fields.selection,name:coupon_multi_gift.selection__coupon_reward__reward_type__multi_gift +#. module: loyalty_multi_gift +#: model:ir.model.fields.selection,name:loyalty_multi_gift.selection__coupon_reward__reward_type__multi_gift msgid "Multi Gift" msgstr "Múltiples regalos" -#. module: coupon_multi_gift -#: model_terms:ir.ui.view,arch_db:coupon_multi_gift.coupon_program_view_form_common +#. module: loyalty_multi_gift +#: model_terms:ir.ui.view,arch_db:loyalty_multi_gift.coupon_program_view_form_common msgid "Qty" msgstr "Cant." -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_product_quantity +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_quantity msgid "Quantity" msgstr "Cantidad" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_id +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_id msgid "Reward" msgstr "Recompensa" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward_product_line__reward_default_product_id +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_default_product_id msgid "Reward Default Product" msgstr "Producto de recompensa por defecto" -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward_product_line__reward_product_ids +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_ids msgid "Reward Product" msgstr "Producto de recompensa" -#. module: coupon_multi_gift -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_program__reward_type -#: model:ir.model.fields,field_description:coupon_multi_gift.field_coupon_reward__reward_type +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_program__reward_type +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward__reward_type msgid "Reward Type" msgstr "Tipo de recompensa" -#. module: coupon_multi_gift -#: model:ir.model.fields,help:coupon_multi_gift.field_coupon_reward_product_line__reward_product_quantity +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_quantity msgid "Reward product quantity" msgstr "Cantidad de productos de recompensa" diff --git a/loyalty_multi_gift/i18n/loyalty_multi_gift.pot b/loyalty_multi_gift/i18n/loyalty_multi_gift.pot new file mode 100644 index 00000000..87e20c28 --- /dev/null +++ b/loyalty_multi_gift/i18n/loyalty_multi_gift.pot @@ -0,0 +1,131 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * loyalty_multi_gift +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: loyalty_multi_gift +#: model:ir.model,name:loyalty_multi_gift.model_coupon_reward_product_line +msgid "Coupon Multi Gift" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model,name:loyalty_multi_gift.model_coupon_reward +msgid "Coupon Reward" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__create_uid +msgid "Created by" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__create_date +msgid "Created on" +msgstr "" + +#. module: loyalty_multi_gift +#: model_terms:ir.ui.view,arch_db:loyalty_multi_gift.coupon_program_view_form_common +msgid "Default gift" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_program__reward_type +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward__reward_type +msgid "" +"Discount - Reward will be provided as discount.\n" +"Free Product - Free product will be provide as reward \n" +"Free Shipping - Free shipping will be provided as reward (Need delivery module)" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__display_name +msgid "Display Name" +msgstr "" + +#. module: loyalty_multi_gift +#: code:addons/loyalty_multi_gift/models/coupon_reward.py:0 +#, python-format +msgid "Free Products - %(name)s" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_ids +msgid "Gift Options" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_program__loyalty_multi_gift_ids +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward__loyalty_multi_gift_ids +msgid "Gift list" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__id +msgid "ID" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__write_date +msgid "Last Updated on" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields.selection,name:loyalty_multi_gift.selection__coupon_reward__reward_type__multi_gift +msgid "Multi Gift" +msgstr "" + +#. module: loyalty_multi_gift +#: model_terms:ir.ui.view,arch_db:loyalty_multi_gift.coupon_program_view_form_common +msgid "Qty" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_quantity +msgid "Quantity" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_id +msgid "Reward" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward_product_line__reward_default_product_id +msgid "Reward Default Product" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_ids +msgid "Reward Product" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_program__reward_type +#: model:ir.model.fields,field_description:loyalty_multi_gift.field_coupon_reward__reward_type +msgid "Reward Type" +msgstr "" + +#. module: loyalty_multi_gift +#: model:ir.model.fields,help:loyalty_multi_gift.field_coupon_reward_product_line__reward_product_quantity +msgid "Reward product quantity" +msgstr "" diff --git a/loyalty_multi_gift/models/__init__.py b/loyalty_multi_gift/models/__init__.py index ee59e9de..d47c146f 100644 --- a/loyalty_multi_gift/models/__init__.py +++ b/loyalty_multi_gift/models/__init__.py @@ -1 +1 @@ -from . import coupon_reward +from . import loyalty_reward diff --git a/loyalty_multi_gift/models/coupon_reward.py b/loyalty_multi_gift/models/loyalty_reward.py similarity index 70% rename from loyalty_multi_gift/models/coupon_reward.py rename to loyalty_multi_gift/models/loyalty_reward.py index 0e6c6b7e..c91e81c4 100644 --- a/loyalty_multi_gift/models/coupon_reward.py +++ b/loyalty_multi_gift/models/loyalty_reward.py @@ -3,36 +3,39 @@ from odoo import _, api, fields, models -class CouponReward(models.Model): - _inherit = "coupon.reward" +class LoyaltyProgram(models.Model): + _inherit = "loyalty.program" - coupon_multi_gift_ids = fields.One2many( - comodel_name="coupon.reward.product_line", - inverse_name="reward_id", + loyalty_multi_gift_ids = fields.One2many( + comodel_name="loyalty.reward.product_line", + inverse_name="program_id", string="Gift list", ) - reward_type = fields.Selection(selection_add=[("multi_gift", "Multi Gift")]) + program_type = fields.Selection( + selection_add=[("multi_gift", "Multi Gift")], + ondelete={"multi_gift": "set default"}, + ) def name_get(self): """Add complete description for the multi gift reward type.""" res = super().name_get() - for reward in self.filtered(lambda x: x.reward_type == "multi_gift"): + for reward in self.filtered(lambda x: x.program_type == "multi_gift"): reward_string = _("Free Products - %(name)s") % { "name": ", ".join( f"{reward.reward_product_quantity}x " f"{fields.first(reward.reward_product_ids).name}" - for reward in reward.coupon_multi_gift_ids + for reward in reward.loyalty_multi_gift_ids ) } res.append((reward.id, reward_string)) return res -class CouponGift(models.Model): - _name = "coupon.reward.product_line" - _description = "Coupon Multi Gift" +class LoyaltyGift(models.Model): + _name = "loyalty.reward.product_line" + _description = "Loyalty Multi Gift" - reward_id = fields.Many2one(comodel_name="coupon.reward") + program_id = fields.Many2one(comodel_name="loyalty.program") reward_product_quantity = fields.Integer( string="Quantity", help="Reward product quantity", @@ -52,7 +55,7 @@ class CouponGift(models.Model): @api.depends("reward_product_ids") def _compute_reward_default_product_id(self): """This field acts as a cover for a simple many2one behavior of the module. - Another module like `sale_coupon_selection_wizard` can dismiss it in order + Another module like `sale_loyalty_selection_wizard` can dismiss it in order to allow optional""" for line in self: line.reward_default_product_id = fields.first(line.reward_product_ids) diff --git a/loyalty_multi_gift/readme/CONFIGURE.rst b/loyalty_multi_gift/readme/CONFIGURE.rst index 613d2312..50468289 100644 --- a/loyalty_multi_gift/readme/CONFIGURE.rst +++ b/loyalty_multi_gift/readme/CONFIGURE.rst @@ -1,9 +1,9 @@ To configure multiple product rewards: -#. Go to *Sales > Catalog > Coupon Programs* and select or create a new one. +#. Go to *Sales > Products > Discount & Loyalty* and select or create a new one. #. Choose the criteria of appliance you want to use and the minimum quantities, that will be used to calculate the times the rewards can be applied. -#. On the *Reward Type* field choose *Multi Gift*. +#. On the *Program Type* field choose *Multi Gift*. #. You'll see a now the *Gift list* on which you can add the products you want to give away and the quantities for each of them. diff --git a/loyalty_multi_gift/security/ir.model.access.csv b/loyalty_multi_gift/security/ir.model.access.csv index 479e886a..d10c3144 100644 --- a/loyalty_multi_gift/security/ir.model.access.csv +++ b/loyalty_multi_gift/security/ir.model.access.csv @@ -1,2 +1,2 @@ id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink -access_multi_gift_manager,multi_gift manager,model_coupon_reward_product_line,base.group_system,1,1,1,1 +access_multi_gift_manager,multi_gift manager,model_loyalty_reward_product_line,base.group_system,1,1,1,1 diff --git a/loyalty_multi_gift/tests/__init__.py b/loyalty_multi_gift/tests/__init__.py index 3cd5859a..b18b957d 100644 --- a/loyalty_multi_gift/tests/__init__.py +++ b/loyalty_multi_gift/tests/__init__.py @@ -1 +1 @@ -from . import coupon_multi_gift_case +from . import loyalty_multi_gift_case diff --git a/loyalty_multi_gift/tests/coupon_multi_gift_case.py b/loyalty_multi_gift/tests/loyalty_multi_gift_case.py similarity index 74% rename from loyalty_multi_gift/tests/coupon_multi_gift_case.py rename to loyalty_multi_gift/tests/loyalty_multi_gift_case.py index 6f9b8b59..50bcd1fc 100644 --- a/loyalty_multi_gift/tests/coupon_multi_gift_case.py +++ b/loyalty_multi_gift/tests/loyalty_multi_gift_case.py @@ -3,7 +3,7 @@ from odoo.tests import Form, TransactionCase -class CouponMultiGiftCase(TransactionCase): +class LoyaltyMultiGiftCase(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -39,26 +39,26 @@ def setUpClass(cls): cls.product_4 = cls.env["product.product"].create( {"name": "Test 4", "sale_ok": False, "list_price": 80} ) - coupon_program_form = Form( - cls.env["coupon.program"], + loyalty_program_form = Form( + cls.env["loyalty.program"], view="coupon.coupon_program_view_promo_program_form", ) - coupon_program_form.name = "Test Multiplier Program" - coupon_program_form.promo_code_usage = "no_code_needed" - coupon_program_form.reward_type = "multi_gift" + loyalty_program_form.name = "Test Multiplier Program" + loyalty_program_form.promo_code_usage = "no_code_needed" + loyalty_program_form.reward_type = "multi_gift" # For every two products that fulfill the domain condition, we'd get 2 units # of product 1 and 3 units of product 3 for free - coupon_program_form.rule_minimum_amount = 75 + loyalty_program_form.rule_minimum_amount = 75 # Every two we'll fulfill the condition - coupon_program_form.rule_min_quantity = 2 - coupon_program_form.rule_products_domain = "[('id', '=', %s)]" % ( + loyalty_program_form.rule_min_quantity = 2 + loyalty_program_form.rule_products_domain = "[('id', '=', %s)]" % ( cls.product_1.id ) - with coupon_program_form.coupon_multi_gift_ids.new() as reward_line: + with loyalty_program_form.loyalty_multi_gift_ids.new() as reward_line: reward_line.reward_product_ids.add(cls.product_2) reward_line.reward_product_quantity = 2 - with coupon_program_form.coupon_multi_gift_ids.new() as reward_line: + with loyalty_program_form.loyalty_multi_gift_ids.new() as reward_line: reward_line.reward_product_ids.add(cls.product_3) reward_line.reward_product_ids.add(cls.product_4) reward_line.reward_product_quantity = 3 - cls.coupon_program = coupon_program_form.save() + cls.loyalty_program = loyalty_program_form.save() diff --git a/loyalty_multi_gift/views/coupon_program_views.xml b/loyalty_multi_gift/views/loyalty_program_views.xml similarity index 60% rename from loyalty_multi_gift/views/coupon_program_views.xml rename to loyalty_multi_gift/views/loyalty_program_views.xml index a5c16b04..ab8adc21 100644 --- a/loyalty_multi_gift/views/coupon_program_views.xml +++ b/loyalty_multi_gift/views/loyalty_program_views.xml @@ -1,17 +1,17 @@ - - - coupon.program + + + loyalty.program - + {'invisible': [('reward_type', '=', 'multi_gift')]} + >{'invisible': [('program_type', '=', 'multi_gift')]} - - - + + +