diff --git a/addons/coupon/__init__.py b/addons/coupon/__init__.py deleted file mode 100644 index de3c67453a7..00000000000 --- a/addons/coupon/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import models -from . import report -from . import wizard diff --git a/addons/coupon/__manifest__.py b/addons/coupon/__manifest__.py deleted file mode 100644 index b4a6897f794..00000000000 --- a/addons/coupon/__manifest__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -{ - 'name': "Coupon", - 'summary': "Use discount coupons in different sales channels.", - 'description': """Integrate coupon mechanism in orders.""", - 'category': 'Sales', - 'version': '1.0', - 'depends': ['account'], - 'data': [ - 'wizard/coupon_generate_views.xml', - 'security/ir.model.access.csv', - 'security/coupon_security.xml', - 'views/coupon_views.xml', - 'views/coupon_program_views.xml', - 'report/coupon_report.xml', - 'report/coupon_report_templates.xml', - 'data/expire_coupon_cron.xml', - ], - 'demo': [ - 'demo/coupon_demo.xml', - ], - 'installable': True, - 'license': 'LGPL-3', -} diff --git a/addons/coupon/data/expire_coupon_cron.xml b/addons/coupon/data/expire_coupon_cron.xml deleted file mode 100644 index f72f93eb1ad..00000000000 --- a/addons/coupon/data/expire_coupon_cron.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Coupon: expire coupon based on date - - code - model.cron_expire_coupon() - - - 1 - days - -1 - - - diff --git a/addons/coupon/demo/coupon_demo.xml b/addons/coupon/demo/coupon_demo.xml deleted file mode 100644 index a31fc68c7be..00000000000 --- a/addons/coupon/demo/coupon_demo.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - 10.0% discount on total amount - service - - - - - 10PERCENTDISC - - - - - Code for 10% on orders - code_needed - 10pc - on_order - percentage - 10.0 - promotion_program - - 0 - - - - Free Product - Large Cabinet - service - - - - - FREELARGECABINET - - - - - Buy 3 large cabinets, get one for free - no_code_needed - on_order - product - promotion_program - - 3 - [["name","ilike","large cabinet"]] - - 0 - - - - 10% Discount - code_needed - on_order - percentage - 10.0 - coupon_program - - - diff --git a/addons/coupon/i18n/coupon.pot b/addons/coupon/i18n/coupon.pot deleted file mode 100644 index ff41ccc0d71..00000000000 --- a/addons/coupon/i18n/coupon.pot +++ /dev/null @@ -1,1096 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * coupon -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server saas~14.5\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-14 10:28+0000\n" -"PO-Revision-Date: 2021-09-14 10:28+0000\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 -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "%(amount)s %(currency)s discount on total amount" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "%(percentage)s%% discount on %(product_name)s" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "%s%% discount on cheapest product" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "%s%% discount on products" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "%s%% discount on total amount" -msgstr "" - -#. module: coupon -#: code:addons/coupon/wizard/coupon_generate.py:0 -#, python-format -msgid "%s, a coupon has been generated for you" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "*Valid for following products:" -msgstr "" - -#. module: coupon -#: model:coupon.program,name:coupon.10_percent_coupon -msgid "10% Discount" -msgstr "" - -#. module: coupon -#: model:product.product,name:coupon.product_product_10_percent_discount -#: model:product.template,name:coupon.product_product_10_percent_discount_product_template -msgid "10.0% discount on total amount" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "" -"%" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_coupon_program_form -msgid "" -" Days if 0, infinite use" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid " if 0, no limit" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "" -" Days\n" -" if 0, coupon doesn't expire" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "" -" Orders\n" -" if 0, infinite use" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Minimum purchase of" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Valid for purchase above" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "products" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "" -"get free shipping" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.view_coupon_program_kanban -msgid "Active" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.view_coupon_program_kanban -msgid "Coupons" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__active -msgid "A program is available for the customers when active" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__promo_code -msgid "" -"A promotion code is a code that is associated with a marketing discount. For" -" example, a retailer might tell frequent customers to enter the promotion " -"code 'THX001' to receive a 10%% discount on their whole order." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__program_type -msgid "" -"A promotional program can be either a limited promotional offer without code (applied automatically)\n" -" or with a code (displayed on a magazine for example) that may generate a discount on the current\n" -" order or create a coupon for a next order.\n" -"\n" -" A coupon program generates coupons with a code that can be used to generate a discount on the current\n" -" order or create a coupon for a next order." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__active -msgid "Active" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__promo_applicability -msgid "Applicability" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Apply Discount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__promo_applicability__on_current_order -msgid "Apply On Current Order" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "Apply on First" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_search -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_search -msgid "Archived" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__promo_code_usage__no_code_needed -msgid "Automatically Applied" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__promo_code_usage -msgid "" -"Automatically Applied - No code is required, if the program rules are met, the reward is applied (Except the global discount or the free shipping rewards which are not cumulative)\n" -"Use a code - If the program rules are met, a valid code is mandatory for the reward to be applied\n" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_partners_domain -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_partners_domain -msgid "Based on Customers" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_products_domain -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_products_domain -msgid "Based on Products" -msgstr "" - -#. module: coupon -#: model_terms:ir.actions.act_window,help:coupon.coupon_program_action_promo_program -msgid "" -"Build up promotion programs to attract more customers with discounts, free products, free delivery, etc.\n" -" You can share promotion codes or grant the promotions automatically if some conditions are met." -msgstr "" - -#. module: coupon -#: model:coupon.program,name:coupon.3_cabinets_plus_1_free -msgid "Buy 3 large cabinets, get one for free" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_generate_view_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_tree -msgid "Cancel" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__cancel -msgid "Cancelled" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__code -msgid "Code" -msgstr "" - -#. module: coupon -#: model:coupon.program,name:coupon.10_percent_auto_applied -msgid "Code for 10% on orders" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__company_id -msgid "Company" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "Compose Email" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Conditions" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Congratulations" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_coupon_coupon -msgid "Coupon" -msgstr "" - -#. module: coupon -#: model:ir.actions.report,name:coupon.report_coupon_code -msgid "Coupon Code" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__coupon_count -msgid "Coupon Count" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_coupon_program -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__program_type__coupon_program -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Coupon Program" -msgstr "" - -#. module: coupon -#: model:ir.actions.act_window,name:coupon.coupon_program_action_coupon_program -msgid "Coupon Programs" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_coupon_reward -msgid "Coupon Reward" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_coupon_rule -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_id -msgid "Coupon Rule" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "Coupon Validity" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_date_to -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_date_to -msgid "Coupon program end date" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_date_from -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_date_from -msgid "Coupon program start date" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__sequence -msgid "" -"Coupon program will be applied based on given sequence if multiple programs " -"are defined on same condition(For minimum amount)" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_partners_domain -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_partners_domain -msgid "Coupon program will work for selected customers only" -msgstr "" - -#. module: coupon -#: model:ir.actions.server,name:coupon.expire_coupon_cron_ir_actions_server -#: model:ir.cron,cron_name:coupon.expire_coupon_cron -#: model:ir.cron,name:coupon.expire_coupon_cron -msgid "Coupon: expire coupon based on date" -msgstr "" - -#. module: coupon -#: model:ir.actions.act_window,name:coupon.coupon_action -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_coupon_program_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_tree -msgid "Coupons" -msgstr "" - -#. module: coupon -#: model_terms:ir.actions.act_window,help:coupon.coupon_program_action_coupon_program -msgid "Create a new coupon program" -msgstr "" - -#. module: coupon -#: model_terms:ir.actions.act_window,help:coupon.coupon_program_action_promo_program -msgid "Create a new promotion program" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__create_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__create_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_program__create_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__create_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__create_uid -msgid "Created by" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__create_date -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__create_date -#: model:ir.model.fields,field_description:coupon.field_coupon_program__create_date -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__create_date -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__create_date -msgid "Created on" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__currency_id -msgid "Currency" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__partners_domain -msgid "Customer" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__reward_product_uom_id -#: model:ir.model.fields,help:coupon.field_coupon_reward__reward_product_uom_id -msgid "Default unit of measure used for all stock operations." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_percentage -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_percentage -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__reward_type__discount -msgid "Discount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__reward_type -#: model:ir.model.fields,help:coupon.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 -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_apply_on -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_apply_on -msgid "Discount Apply On" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_max_amount -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_max_amount -msgid "Discount Max Amount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_type -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_type -msgid "Discount Type" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "Discount percentage should be between 1-100" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__display_name -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__display_name -#: model:ir.model.fields,field_description:coupon.field_coupon_program__display_name -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__display_name -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__display_name -msgid "Display Name" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_mail_compose_message -msgid "Email composition wizard" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_date_to -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_date_to -msgid "End Date" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__expiration_date -msgid "Expiration Date" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__expired -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_search -msgid "Expired" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_search -msgid "Expired Programs" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_fixed_amount -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_fixed_amount -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__discount_type__fixed_amount -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Fixed Amount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__partner_id -msgid "For Customer" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_product_id -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__reward_product_id -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__reward_type__product -msgid "Free Product" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_reward.py:0 -#, python-format -msgid "Free Product - %s" -msgstr "" - -#. module: coupon -#: model:product.product,name:coupon.product_product_free_large_cabinet -#: model:product.template,name:coupon.product_product_free_large_cabinet_product_template -msgid "Free Product - Large Cabinet" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_generate_view_form -msgid "Generate" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_coupon_generate_wizard -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_coupon_program_form -msgid "Generate Coupon" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_generate_view_form -msgid "Generate Coupons" -msgstr "" - -#. module: coupon -#: model_terms:ir.actions.act_window,help:coupon.coupon_program_action_coupon_program -msgid "" -"Generate and share coupon codes with your customers to get discounts or free" -" products." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__coupon_ids -msgid "Generated Coupons" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__generation_type -msgid "Generation Type" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__has_partner_email -msgid "Has Partner Email" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Here is your reward from" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__id -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__id -#: model:ir.model.fields,field_description:coupon.field_coupon_program__id -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__id -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__id -msgid "ID" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "Invalid partner." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon____last_update -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard____last_update -#: model:ir.model.fields,field_description:coupon.field_coupon_program____last_update -#: model:ir.model.fields,field_description:coupon.field_coupon_reward____last_update -#: model:ir.model.fields,field_description:coupon.field_coupon_rule____last_update -msgid "Last Modified on" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__write_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__write_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_program__write_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__write_uid -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__write_uid -msgid "Last Updated by" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__write_date -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__write_date -#: model:ir.model.fields,field_description:coupon.field_coupon_program__write_date -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__write_date -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__write_date -msgid "Last Updated on" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Logo" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Max Discount Amount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__maximum_use_number -msgid "Maximum Use Number" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_max_amount -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_max_amount -msgid "Maximum amount of discount that can be provided" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__maximum_use_number -msgid "Maximum number of sales orders in which reward can be provided" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Minimum Purchase Of" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_min_quantity -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_min_quantity -msgid "Minimum Quantity" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_rules.py:0 -#, python-format -msgid "Minimum purchased amount should be greater than 0" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_rules.py:0 -#, python-format -msgid "Minimum quantity should be greater than 0" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_minimum_amount -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_minimum_amount -msgid "Minimum required amount to get the reward" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_min_quantity -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_min_quantity -msgid "Minimum required product quantity to get the reward" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__name -msgid "Name" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__nbr_coupons -#: model:ir.model.fields.selection,name:coupon.selection__coupon_generate_wizard__generation_type__nbr_coupon -msgid "Number of Coupons" -msgstr "" - -#. module: coupon -#: model:ir.actions.act_window,name:coupon.coupon_generate_action -msgid "Number of Coupons To Generate" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_generate_wizard__generation_type__nbr_customer -msgid "Number of Selected Customers" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_generate_wizard__nbr_coupons -msgid "Number of coupons" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__discount_apply_on__cheapest_product -msgid "On Cheapest Product" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__discount_apply_on__on_order -msgid "On Order" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_apply_on -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_apply_on -msgid "" -"On Order - Discount on whole order\n" -"Cheapest product - Discount on cheapest product of the order\n" -"Specific products - Discount on selected specific products" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__rule_products_domain -#: model:ir.model.fields,help:coupon.field_coupon_rule__rule_products_domain -msgid "On Purchase of selected product, reward will be given" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__discount_apply_on__specific_products -msgid "On Specific Products" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__reserved -msgid "Pending" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_reward__discount_type__percentage -msgid "Percentage" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_type -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_type -msgid "" -"Percentage - Entered percentage discount will be provided\n" -"Amount - Entered fixed amount discount will be provided" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_coupon__discount_line_product_id -msgid "Product used in the sales order to apply the discount." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_line_product_id -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_line_product_id -msgid "" -"Product used in the sales order to apply the discount. Each coupon program " -"has its own reward product for reporting purpose" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_specific_product_ids -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_specific_product_ids -msgid "Products" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_specific_product_ids -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_specific_product_ids -msgid "" -"Products that will be discounted if the discount is applied on specific " -"products" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__program_id -msgid "Program" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_coupon_program_form -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "Program Name" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__program_type -msgid "Program Type" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__promo_code_usage -msgid "Promo Code Usage" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__promo_code -msgid "Promotion Code" -msgstr "" - -#. module: coupon -#: model:ir.actions.act_window,name:coupon.coupon_program_action_promo_program -msgid "Promotion Programs" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__program_type__promotion_program -msgid "Promotional Program" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_product_quantity -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__reward_product_quantity -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Quantity" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_id -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Reward" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_description -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__reward_description -msgid "Reward Description" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__discount_line_product_id -#: model:ir.model.fields,field_description:coupon.field_coupon_program__discount_line_product_id -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__discount_line_product_id -msgid "Reward Line Product" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__reward_product_id -#: model:ir.model.fields,help:coupon.field_coupon_reward__reward_product_id -msgid "Reward Product" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_type -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__reward_type -msgid "Reward Type" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__reward_product_quantity -#: model:ir.model.fields,help:coupon.field_coupon_reward__reward_product_quantity -msgid "Reward product quantity" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Rewards" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_minimum_amount -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_minimum_amount -msgid "Rule Minimum Amount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_minimum_amount_tax_inclusion -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_minimum_amount_tax_inclusion -msgid "Rule Minimum Amount Tax Inclusion" -msgstr "" - -#. module: coupon -#: model:ir.model,name:coupon.model_report_coupon_report_coupon -msgid "Sales Coupon Report" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Select company" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "Select customer" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Select product" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Select products" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Select reward product" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_tree -msgid "Send" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__promo_applicability__on_next_order -msgid "Send a Coupon" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_view_form -msgid "Send by Email" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__sent -msgid "Sent" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__sequence -msgid "Sequence" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_generate_view_form -msgid "" -"Some selected customers do not have an email address and will not receive " -"the coupon." -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_generate_view_form -msgid "Specify a mail template to send the generated coupons as email." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__rule_date_from -#: model:ir.model.fields,field_description:coupon.field_coupon_rule__rule_date_from -msgid "Start Date" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_coupon__state -msgid "State" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_rule__rule_minimum_amount_tax_inclusion__tax_excluded -msgid "Tax Excluded" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_rule__rule_minimum_amount_tax_inclusion__tax_included -msgid "Tax Included" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Thank you," -msgstr "" - -#. module: coupon -#: model:ir.model.constraint,message:coupon.constraint_coupon_coupon_unique_coupon_code -msgid "The coupon code must be unique!" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "The coupon program for %s is in draft or closed state" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_fixed_amount -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_fixed_amount -msgid "The discount in fixed amount" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__discount_percentage -#: model:ir.model.fields,help:coupon.field_coupon_reward__discount_percentage -msgid "The discount in percentage, between 1 and 100" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_program.py:0 -#, python-format -msgid "The program code must be unique!" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_rules.py:0 -#, python-format -msgid "The start date must be before the end date" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "This coupon %s exists but the origin sales order is not validated yet." -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "This coupon has already been used (%s)." -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "This coupon has been cancelled (%s)." -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon.py:0 -#, python-format -msgid "This coupon is expired (%s)." -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__total_order_count -msgid "Total Order Count" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__reward_product_uom_id -#: model:ir.model.fields,field_description:coupon.field_coupon_reward__reward_product_uom_id -msgid "Unit of Measure" -msgstr "" - -#. module: coupon -#: model:product.product,uom_name:coupon.product_product_10_percent_discount -#: model:product.product,uom_name:coupon.product_product_free_large_cabinet -#: model:product.template,uom_name:coupon.product_product_10_percent_discount_product_template -#: model:product.template,uom_name:coupon.product_product_free_large_cabinet_product_template -msgid "Units" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_program__promo_code_usage__code_needed -msgid "Use a code" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_generate_wizard__template_id -msgid "Use template" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "Use this promo code before" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__used -msgid "Used" -msgstr "" - -#. module: coupon -#: model:ir.model.fields.selection,name:coupon.selection__coupon_coupon__state__new -msgid "Valid" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_form_common -msgid "Validity" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,field_description:coupon.field_coupon_program__validity_duration -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_coupon_program_form -msgid "Validity Duration" -msgstr "" - -#. module: coupon -#: model:ir.model.fields,help:coupon.field_coupon_program__validity_duration -msgid "Validity duration for a coupon after its generation" -msgstr "" - -#. module: coupon -#: code:addons/coupon/models/coupon_program.py:0 -#, python-format -msgid "You can not delete a program in active state" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.coupon_program_view_promo_program_form -msgid "e.g. 10% Discount" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "off %s" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "off on %s" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "off on some products*" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "off on the cheapest product" -msgstr "" - -#. module: coupon -#: model_terms:ir.ui.view,arch_db:coupon.report_coupon -msgid "on your next order" -msgstr "" diff --git a/addons/coupon/models/__init__.py b/addons/coupon/models/__init__.py deleted file mode 100644 index 14d4dcf92a1..00000000000 --- a/addons/coupon/models/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import mail_compose_message -from . import coupon -from . import coupon_reward -from . import coupon_rules -from . import coupon_program diff --git a/addons/coupon/models/coupon.py b/addons/coupon/models/coupon.py deleted file mode 100644 index 4bed33c8a3e..00000000000 --- a/addons/coupon/models/coupon.py +++ /dev/null @@ -1,117 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -import random -from dateutil.relativedelta import relativedelta - -from odoo import api, fields, models, _ - -from uuid import uuid4 - -class Coupon(models.Model): - _name = 'coupon.coupon' - _description = "Coupon" - _rec_name = 'code' - - @api.model - def _generate_code(self): - """Generate a 20 char long pseudo-random string of digits for barcode - generation. - - A decimal serialisation is longer than a hexadecimal one *but* it - generates a more compact barcode (Code128C rather than Code128A). - - Generate 8 bytes (64 bits) barcodes as 16 bytes barcodes are not - compatible with all scanners. - """ - return str(uuid4())[:22] - - code = fields.Char(default=lambda self: self._generate_code(), required=True, readonly=True) - expiration_date = fields.Date('Expiration Date', compute='_compute_expiration_date') - state = fields.Selection([ - ('reserved', 'Pending'), - ('new', 'Valid'), - ('sent', 'Sent'), - ('used', 'Used'), - ('expired', 'Expired'), - ('cancel', 'Cancelled') - ], required=True, default='new') - partner_id = fields.Many2one('res.partner', "For Customer") - program_id = fields.Many2one('coupon.program', "Program") - discount_line_product_id = fields.Many2one('product.product', related='program_id.discount_line_product_id', readonly=False, - help='Product used in the sales order to apply the discount.') - - _sql_constraints = [ - ('unique_coupon_code', 'unique(code)', 'The coupon code must be unique!'), - ] - - @api.depends('create_date', 'program_id.validity_duration') - def _compute_expiration_date(self): - self.expiration_date = 0 - for coupon in self.filtered(lambda x: x.program_id.validity_duration > 0): - coupon.expiration_date = (coupon.create_date + relativedelta(days=coupon.program_id.validity_duration)).date() - - def _get_default_template(self): - return False - - def action_coupon_send(self): - """ Open a window to compose an email, with the edi invoice template - message loaded by default - """ - self.ensure_one() - default_template = self._get_default_template() - compose_form = self.env.ref('mail.email_compose_message_wizard_form', False) - ctx = dict( - default_model='coupon.coupon', - default_res_id=self.id, - default_use_template=bool(default_template), - default_template_id=default_template and default_template.id, - default_composition_mode='comment', - default_email_layout_xmlid='mail.mail_notification_light', - mark_coupon_as_sent=True, - force_email=True, - ) - return { - 'name': _('Compose Email'), - 'type': 'ir.actions.act_window', - 'view_mode': 'form', - 'res_model': 'mail.compose.message', - 'views': [(compose_form.id, 'form')], - 'view_id': compose_form.id, - 'target': 'new', - 'context': ctx, - } - - def action_coupon_cancel(self): - self.state = 'cancel' - - def cron_expire_coupon(self): - self._cr.execute(""" - SELECT C.id FROM COUPON_COUPON as C - INNER JOIN COUPON_PROGRAM as P ON C.program_id = P.id - WHERE C.STATE in ('reserved', 'new', 'sent') - AND P.validity_duration > 0 - AND C.create_date + interval '1 day' * P.validity_duration < now()""") - - expired_ids = [res[0] for res in self._cr.fetchall()] - self.browse(expired_ids).write({'state': 'expired'}) - - def _check_coupon_code(self, order_date, partner_id, **kwargs): - """ Check the validity of this single coupon. - :param order_date Date: - :param partner_id int | boolean: - """ - self.ensure_one() - message = {} - if self.state == 'used': - message = {'error': _('This coupon has already been used (%s).') % (self.code)} - elif self.state == 'reserved': - message = {'error': _('This coupon %s exists but the origin sales order is not validated yet.') % (self.code)} - elif self.state == 'cancel': - message = {'error': _('This coupon has been cancelled (%s).') % (self.code)} - elif self.state == 'expired' or (self.expiration_date and self.expiration_date < order_date): - message = {'error': _('This coupon is expired (%s).') % (self.code)} - elif not self.program_id.active: - message = {'error': _('The coupon program for %s is in draft or closed state') % (self.code)} - elif self.partner_id and self.partner_id.id != partner_id: - message = {'error': _('Invalid partner.')} - return message diff --git a/addons/coupon/models/coupon_program.py b/addons/coupon/models/coupon_program.py deleted file mode 100644 index e5b55603a44..00000000000 --- a/addons/coupon/models/coupon_program.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, fields, models, _ -from odoo.exceptions import UserError, ValidationError - -import ast - - -class CouponProgram(models.Model): - _name = 'coupon.program' - _description = "Coupon Program" - _inherits = {'coupon.rule': 'rule_id', 'coupon.reward': 'reward_id'} - # We should apply 'discount' promotion first to avoid offering free product when we should not. - # Eg: If the discount lower the SO total below the required threshold - # Note: This is only revelant when programs have the same sequence (which they have by default) - _order = "sequence, reward_type" - - name = fields.Char(required=True, translate=True) - active = fields.Boolean('Active', default=True, help="A program is available for the customers when active") - rule_id = fields.Many2one('coupon.rule', string="Coupon Rule", ondelete='restrict', required=True) - reward_id = fields.Many2one('coupon.reward', string="Reward", ondelete='restrict', required=True, copy=False) - sequence = fields.Integer(copy=False, - help="Coupon program will be applied based on given sequence if multiple programs are " + - "defined on same condition(For minimum amount)") - maximum_use_number = fields.Integer(help="Maximum number of sales orders in which reward can be provided") - program_type = fields.Selection([ - ('promotion_program', 'Promotional Program'), - ('coupon_program', 'Coupon Program'), - ], - help="""A promotional program can be either a limited promotional offer without code (applied automatically) - or with a code (displayed on a magazine for example) that may generate a discount on the current - order or create a coupon for a next order. - - A coupon program generates coupons with a code that can be used to generate a discount on the current - order or create a coupon for a next order.""") - promo_code_usage = fields.Selection([ - ('no_code_needed', 'Automatically Applied'), - ('code_needed', 'Use a code')], - help="Automatically Applied - No code is required, if the program rules are met, the reward is applied (Except the global discount or the free shipping rewards which are not cumulative)\n" + - "Use a code - If the program rules are met, a valid code is mandatory for the reward to be applied\n") - promo_code = fields.Char('Promotion Code', copy=False, - help="A promotion code is a code that is associated with a marketing discount. For example, a retailer might tell frequent customers to enter the promotion code 'THX001' to receive a 10%% discount on their whole order.") - promo_applicability = fields.Selection([ - ('on_current_order', 'Apply On Current Order'), - ('on_next_order', 'Send a Coupon')], - default='on_current_order', string="Applicability") - coupon_ids = fields.One2many('coupon.coupon', 'program_id', string="Generated Coupons", copy=False) - coupon_count = fields.Integer(compute='_compute_coupon_count') - company_id = fields.Many2one('res.company', string="Company", required=True, default=lambda self: self.env.company) - currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True) - validity_duration = fields.Integer(default=30, - help="Validity duration for a coupon after its generation") - total_order_count = fields.Integer("Total Order Count", compute="_compute_total_order_count") - - @api.constrains('promo_code') - def _check_promo_code_constraint(self): - """ Program code must be unique """ - for program in self.filtered(lambda p: p.promo_code): - domain = [('id', '!=', program.id), ('promo_code', '=', program.promo_code)] - if self.search(domain): - raise ValidationError(_('The program code must be unique!')) - - @api.depends('coupon_ids') - def _compute_coupon_count(self): - coupon_data = self.env['coupon.coupon']._read_group([('program_id', 'in', self.ids)], ['program_id'], ['program_id']) - mapped_data = dict([(m['program_id'][0], m['program_id_count']) for m in coupon_data]) - for program in self: - program.coupon_count = mapped_data.get(program.id, 0) - - @api.onchange('promo_code_usage') - def _onchange_promo_code_usage(self): - if self.promo_code_usage == 'no_code_needed': - self.promo_code = False - - @api.onchange('reward_product_id') - def _onchange_reward_product_id(self): - if self.reward_product_id: - self.reward_product_uom_id = self.reward_product_id.uom_id - - @api.onchange('discount_type') - def _onchange_discount_type(self): - if self.discount_type == 'fixed_amount': - self.discount_apply_on = 'on_order' - - @api.model_create_multi - def create(self, vals_list): - programs = super().create(vals_list) - for program in programs: - if program.discount_line_product_id: - continue - values = program._get_discount_product_values() - discount_line_product_id = self.env['product.product'].create(values) - program.write({'discount_line_product_id': discount_line_product_id.id}) - return programs - - def write(self, vals): - res = super(CouponProgram, self).write(vals) - reward_fields = [ - 'reward_type', 'reward_product_id', 'discount_type', 'discount_percentage', - 'discount_apply_on', 'discount_specific_product_ids', 'discount_fixed_amount' - ] - if any(field in reward_fields for field in vals): - self.mapped('discount_line_product_id').write({'name': self[0].reward_id.display_name}) - return res - - @api.ondelete(at_uninstall=False) - def _unlink_except_active(self): - if self.filtered('active'): - raise UserError(_('You can not delete a program in active state')) - - def unlink(self): - # get reference to rule and reward - rule = self.rule_id - reward = self.reward_id - # unlink the program - super(CouponProgram, self).unlink() - # then unlink the rule and reward - rule.unlink() - reward.unlink() - return True - - def toggle_active(self): - super(CouponProgram, self).toggle_active() - for program in self: - program.discount_line_product_id.active = program.active - coupons = self.filtered(lambda p: not p.active and p.promo_code_usage == 'code_needed').mapped('coupon_ids') - coupons.filtered(lambda x: x.state != 'used').write({'state': 'expired'}) - - def _compute_program_amount(self, field, currency_to): - self.ensure_one() - return self.currency_id._convert(self[field], currency_to, self.company_id, fields.Date.today()) - - def _is_valid_partner(self, partner): - if self.rule_partners_domain and self.rule_partners_domain != '[]': - domain = ast.literal_eval(self.rule_partners_domain) + [('id', '=', partner.id)] - return bool(self.env['res.partner'].search_count(domain)) - else: - return True - - def _get_valid_products(self, products): - """Get valid products for the program. - - :param products: records of product.product - :return: valid products recordset - """ - if self.rule_products_domain and self.rule_products_domain != "[]": - domain = ast.literal_eval(self.rule_products_domain) - return products.filtered_domain(domain) - return products - - def _generate_coupons(self, partner_id): - '''Generate coupons that can be used in the next order for the given partner_id.''' - generated_coupons = self.env['coupon.coupon'] - for program in self: - generated_coupons |= self.env['coupon.coupon'].create({ - 'program_id': program.id, - 'partner_id': partner_id, - }) - return generated_coupons - - def _compute_total_order_count(self): - for program in self: - program.total_order_count = 0 - - def _get_discount_product_values(self): - return { - 'name': self.reward_id.display_name, - 'type': 'service', - 'taxes_id': False, - 'supplier_taxes_id': False, - 'sale_ok': False, - 'purchase_ok': False, - 'lst_price': 0, #Do not set a high value to avoid issue with coupon code - } diff --git a/addons/coupon/models/coupon_reward.py b/addons/coupon/models/coupon_reward.py deleted file mode 100644 index d5ad92a9196..00000000000 --- a/addons/coupon/models/coupon_reward.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, fields, models, _ -from odoo.exceptions import ValidationError - - -class CouponReward(models.Model): - _name = 'coupon.reward' - _description = "Coupon Reward" - _rec_name = 'reward_description' - - # VFE FIXME multi company - """Rewards are not restricted to a company... - You could have a reward_product_id limited to a specific company A. - But still use this reward as reward of a program of company B... - """ - reward_description = fields.Char('Reward Description') - reward_type = fields.Selection([ - ('discount', 'Discount'), - ('product', 'Free Product'), - ], string='Reward Type', default='discount', - help="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)") - # Product Reward - reward_product_id = fields.Many2one('product.product', string="Free Product", - help="Reward Product") - reward_product_quantity = fields.Integer(string="Quantity", default=1, help="Reward product quantity") - # Discount Reward - discount_type = fields.Selection([ - ('percentage', 'Percentage'), - ('fixed_amount', 'Fixed Amount')], default="percentage", - help="Percentage - Entered percentage discount will be provided\n" + - "Amount - Entered fixed amount discount will be provided") - discount_percentage = fields.Float(string="Discount", default=10, - help='The discount in percentage, between 1 and 100') - discount_apply_on = fields.Selection([ - ('on_order', 'On Order'), - ('cheapest_product', 'On Cheapest Product'), - ('specific_products', 'On Specific Products')], default="on_order", - help="On Order - Discount on whole order\n" + - "Cheapest product - Discount on cheapest product of the order\n" + - "Specific products - Discount on selected specific products") - discount_specific_product_ids = fields.Many2many('product.product', string="Products", - help="Products that will be discounted if the discount is applied on specific products") - discount_max_amount = fields.Float(default=0, - help="Maximum amount of discount that can be provided") - discount_fixed_amount = fields.Float(string="Fixed Amount", help='The discount in fixed amount') - reward_product_uom_id = fields.Many2one(related='reward_product_id.product_tmpl_id.uom_id', string='Unit of Measure', readonly=True) - discount_line_product_id = fields.Many2one('product.product', string='Reward Line Product', copy=False, - help="Product used in the sales order to apply the discount. Each coupon program has its own reward product for reporting purpose") - - @api.constrains('discount_percentage') - def _check_discount_percentage(self): - if self.filtered(lambda reward: reward.discount_type == 'percentage' and (reward.discount_percentage < 0 or reward.discount_percentage > 100)): - raise ValidationError(_('Discount percentage should be between 1-100')) - - def name_get(self): - """ - Returns a complete description of the reward - """ - result = [] - for reward in self: - reward_string = "" - if reward.reward_type == 'product': - reward_string = _("Free Product - %s", reward.reward_product_id.name) - elif reward.reward_type == 'discount': - if reward.discount_type == 'percentage': - reward_percentage = str(reward.discount_percentage) - if reward.discount_apply_on == 'on_order': - reward_string = _("%s%% discount on total amount", reward_percentage) - elif reward.discount_apply_on == 'specific_products': - if len(reward.discount_specific_product_ids) > 1: - reward_string = _("%s%% discount on products", reward_percentage) - else: - reward_string = _( - "%(percentage)s%% discount on %(product_name)s", - percentage=reward_percentage, - product_name=reward.discount_specific_product_ids.name - ) - elif reward.discount_apply_on == 'cheapest_product': - reward_string = _("%s%% discount on cheapest product", reward_percentage) - elif reward.discount_type == 'fixed_amount': - program = self.env['coupon.program'].search([('reward_id', '=', reward.id)]) - reward_string = _( - "%(amount)s %(currency)s discount on total amount", - amount=reward.discount_fixed_amount, - currency=program.currency_id.name - ) - result.append((reward.id, reward_string)) - return result diff --git a/addons/coupon/models/coupon_rules.py b/addons/coupon/models/coupon_rules.py deleted file mode 100644 index 1412d683db0..00000000000 --- a/addons/coupon/models/coupon_rules.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, fields, models, _ -from odoo.exceptions import ValidationError - - -class CouponRule(models.Model): - _name = 'coupon.rule' - _description = "Coupon Rule" - - rule_date_from = fields.Datetime(string="Start Date", help="Coupon program start date") - rule_date_to = fields.Datetime(string="End Date", help="Coupon program end date") - rule_partners_domain = fields.Char(string="Based on Customers", help="Coupon program will work for selected customers only") - rule_products_domain = fields.Char(string="Based on Products", default=[['sale_ok', '=', True]], help="On Purchase of selected product, reward will be given") - rule_min_quantity = fields.Integer(string="Minimum Quantity", default=1, - help="Minimum required product quantity to get the reward") - rule_minimum_amount = fields.Float(default=0.0, help="Minimum required amount to get the reward") - rule_minimum_amount_tax_inclusion = fields.Selection([ - ('tax_included', 'Tax Included'), - ('tax_excluded', 'Tax Excluded')], default="tax_excluded") - - @api.constrains('rule_date_to', 'rule_date_from') - def _check_rule_date_from(self): - if any(applicability for applicability in self - if applicability.rule_date_to and applicability.rule_date_from - and applicability.rule_date_to < applicability.rule_date_from): - raise ValidationError(_('The start date must be before the end date')) - - @api.constrains('rule_minimum_amount') - def _check_rule_minimum_amount(self): - if self.filtered(lambda applicability: applicability.rule_minimum_amount < 0): - raise ValidationError(_('Minimum purchased amount should be greater than 0')) - - @api.constrains('rule_min_quantity') - def _check_rule_min_quantity(self): - if not self.rule_min_quantity > 0: - raise ValidationError(_('Minimum quantity should be greater than 0')) diff --git a/addons/coupon/models/mail_compose_message.py b/addons/coupon/models/mail_compose_message.py deleted file mode 100644 index d4b50a79464..00000000000 --- a/addons/coupon/models/mail_compose_message.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models - - -class MailComposeMessage(models.TransientModel): - _inherit = 'mail.compose.message' - - def _action_send_mail(self, **kwargs): - for wizard in self: - if self._context.get('mark_coupon_as_sent') and wizard.model == 'coupon.coupon' and wizard.partner_ids: - # Mark coupon as sent in sudo, as helpdesk users don't have the right to write on coupons - self.env[wizard.model].sudo().browse(wizard.res_id).state = 'sent' - return super()._action_send_mail(**kwargs) diff --git a/addons/coupon/report/__init__.py b/addons/coupon/report/__init__.py deleted file mode 100644 index 69484aac781..00000000000 --- a/addons/coupon/report/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import coupon_report diff --git a/addons/coupon/report/coupon_report.py b/addons/coupon/report/coupon_report.py deleted file mode 100644 index fd154f6d4d3..00000000000 --- a/addons/coupon/report/coupon_report.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, models - - -class CouponReport(models.AbstractModel): - _name = 'report.coupon.report_coupon' - _description = 'Sales Coupon Report' - - @api.model - def _get_report_values(self, docids, data=None): - docs = self.env['coupon.coupon'].browse(docids) - return { - 'doc_ids': docs.ids, - 'doc_model': 'coupon.coupon', - 'data': data, - 'docs': docs, - } diff --git a/addons/coupon/report/coupon_report.xml b/addons/coupon/report/coupon_report.xml deleted file mode 100644 index 1311db8bbb9..00000000000 --- a/addons/coupon/report/coupon_report.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Coupon Code - coupon.coupon - qweb-pdf - coupon.report_coupon_i18n - coupon.report_coupon_i18n - - report - - - diff --git a/addons/coupon/report/coupon_report_templates.xml b/addons/coupon/report/coupon_report_templates.xml deleted file mode 100644 index 459c6e6dd0c..00000000000 --- a/addons/coupon/report/coupon_report_templates.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - diff --git a/addons/coupon/security/coupon_security.xml b/addons/coupon/security/coupon_security.xml deleted file mode 100644 index 349af6c2b50..00000000000 --- a/addons/coupon/security/coupon_security.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Generate Sales Coupon Rule - - [('create_uid', '=', user.id)] - - diff --git a/addons/coupon/security/ir.model.access.csv b/addons/coupon/security/ir.model.access.csv deleted file mode 100644 index 34836cfdb7c..00000000000 --- a/addons/coupon/security/ir.model.access.csv +++ /dev/null @@ -1,7 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_coupon_coupon,access_coupon_coupon,model_coupon_coupon,base.group_user,0,0,0,0 -access_coupon_reward,access_coupon_reward,model_coupon_reward,base.group_user,0,0,0,0 -access_coupon_rule,access_coupon_rule,model_coupon_rule,base.group_user,0,0,0,0 -access_coupon_program,access_coupon_program,model_coupon_program,base.group_user,0,0,0,0 -access_coupon_generate_wizard,access_coupon_generate_wizard,model_coupon_generate_wizard,base.group_user,0,0,0,0 - diff --git a/addons/coupon/views/coupon_program_views.xml b/addons/coupon/views/coupon_program_views.xml deleted file mode 100644 index 062ee396a83..00000000000 --- a/addons/coupon/views/coupon_program_views.xml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - coupon.program.common.form - coupon.program - -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - coupon.program.form - coupon.program - - primary - - -
-
-
- - - - - - - -
-
- - - coupon.program.tree - coupon.program - - - - - - - - - - - - coupon.program.search - coupon.program - - - - - - - - - - - - coupon.program.kanban - coupon.program - - - - - - -
-
- -
-
-
-
Coupons
-
Active
-
-
- -
-
-
-
-
-
-
-
- - - Coupon Programs - coupon.program - tree,kanban,form - - - [('program_type','=', 'coupon_program')] - { - 'default_program_type': 'coupon_program', - 'promo_code_usage': 'code_needed', - 'search_default_opened': 1 - } - -

- Create a new coupon program -

- Generate and share coupon codes with your customers to get discounts or free products. -

-
-
- - - - - coupon.promotion.program.form - coupon.program - - primary - - - - - - - - - - - - - - - - - - - - - - - - - - - - coupon.promotion.program.tree - coupon.program - - - - - - - - - - - - coupon.promotion.program.search - coupon.program - - - - - - - - - - - Promotion Programs - coupon.program - tree,kanban,form - - - [('program_type', '=', 'promotion_program')] - { - 'default_program_type': 'promotion_program', - 'default_promo_code_usage': 'no_code_needed', - 'default_validity_duration': 0, - 'search_default_opened': 1 - } - -

- Create a new promotion program -

- Build up promotion programs to attract more customers with discounts, free products, free delivery, etc. - You can share promotion codes or grant the promotions automatically if some conditions are met. -

-
-
- diff --git a/addons/coupon/views/coupon_views.xml b/addons/coupon/views/coupon_views.xml deleted file mode 100644 index 8b7cc3968aa..00000000000 --- a/addons/coupon/views/coupon_views.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - coupon.coupon.tree - coupon.coupon - - - - - - -