Skip to content

Commit

Permalink
[IMP] coupon_limit, sale_coupon_limit split
Browse files Browse the repository at this point in the history
Allow coupon_limit settings to be used by other loyalty modules
  • Loading branch information
chienandalu committed Jan 27, 2023
1 parent d254158 commit da66de1
Show file tree
Hide file tree
Showing 27 changed files with 1,180 additions and 156 deletions.
122 changes: 122 additions & 0 deletions coupon_limit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
============
Coupon Limit
============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github
:target: https://github.com/OCA/sale-promotion/tree/15.0/coupon_limit
:alt: OCA/sale-promotion
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-coupon_limit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/296/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to configure a limit on the times a promotion can be applied. Two
limits can be configured: customer and salesman. Those limits apply to either programs
or coupons.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure customer limits:

#. Go to *Sales > Catalog > Coupon Programs* and select or create a new one.
#. Set the *Maximum Customer Applications* to the number of times a coupon can be used
by a customer.

NOTE: The customer limit is applied at commercial entity level, not for each contact
inside the entity.

To configure salesmen limits:

#. Go to *Sales > Catalog > Coupon Programs* and select or create a new one.
#. Add salesmen to the *Salesmen Limits* list and their maximum number of applications.
#. You can add different limits to different salesmen groups.
#. If you want to constrain the use of the promotion to the salesmen list, set the
option *Strict limit* on, so any other salesman won't be able to apply the promotion.

Usage
=====

Once the program limits are configured, apply the programs as usual in your sale orders.

Once the limit for a customer or a salesman is reached, if we try to apply a promotion:

- A code promotion will raise an error.
- A program with no code won't be applied.
- A coupon belonging to a limited program will raise an error.
- A promotion applied on the next order won't generate the coupon.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-promotion/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20coupon_limit%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* David Vidal

* `Akretion <https://www.akretion.com>`_:

* Florian Mounier

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-chienandalu| image:: https://github.com/chienandalu.png?size=40px
:target: https://github.com/chienandalu
:alt: chienandalu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-chienandalu|

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/15.0/coupon_limit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions coupon_limit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions coupon_limit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Coupon Limit",
"summary": "Restrict number of promotions per customer or salesman",
"version": "15.0.1.0.0",
"development_status": "Production/Stable",
"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"],
}
220 changes: 220 additions & 0 deletions coupon_limit/i18n/coupon_limit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * coupon_limit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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_limit
#: model:ir.model,name:coupon_limit.model_sale_coupon_rule_salesmen_limit
msgid "Coupon Rule Salesmen limits"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__create_uid
msgid "Created by"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__create_date
msgid "Created on"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__display_name
msgid "Display Name"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__id
msgid "ID"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_program__rule_salesmen_strict_limit
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_rule__rule_salesmen_strict_limit
msgid ""
"If marked, promotion will only be allowed for the list of salesmen with "
"their quantities"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit____last_update
msgid "Last Modified on"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__write_uid
msgid "Last Updated by"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__write_date
msgid "Last Updated on"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "Max"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "Max. Customer Applications"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "Max. Salesmen Applications"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_program__rule_max_customer_application
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule__rule_max_customer_application
msgid "Maximum Customer Applications"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__rule_max_salesman_application
msgid "Maximum Salesman Applications"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_rule_salesmen_limit__rule_max_salesman_application
msgid "Maximum times a salesman can apply a program. 0 for no limit."
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_program__rule_salesmen_limit_ids
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_rule__rule_salesmen_limit_ids
msgid "Maximum times salesmen can apply a program. Empty for no limit."
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_program__rule_max_customer_application
#: model:ir.model.fields,help:coupon_limit.field_sale_coupon_rule__rule_max_customer_application
msgid ""
"Maximum times that a program can be applied to a customer. 0 for no limit."
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__rule_id
msgid "Rule"
msgstr ""

#. module: coupon_limit
#: model:ir.model,name:coupon_limit.model_sale_coupon
msgid "Sales Coupon"
msgstr ""

#. module: coupon_limit
#: model:ir.model,name:coupon_limit.model_sale_coupon_program
msgid "Sales Coupon Program"
msgstr ""

#. module: coupon_limit
#: model:ir.model,name:coupon_limit.model_sale_coupon_rule
msgid "Sales Coupon Rule"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__rule_user_id
msgid "Salesman"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_program__rule_salesmen_limit_ids
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule__rule_salesmen_limit_ids
msgid "Salesmen Limits"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_program__rule_salesmen_limit_count
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule__rule_salesmen_limit_count
msgid "Salesmen maximum promotions"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_program__rule_salesmen_limit_used_count
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule__rule_salesmen_limit_used_count
msgid "Salesmen promotions used"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_program__rule_salesmen_strict_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule__rule_salesmen_strict_limit
msgid "Strict limit"
msgstr ""

#. module: coupon_limit
#: code:addons/coupon_limit/models/sale_coupon_program.py:0
#, python-format
msgid ""
"This promo code was already applied %s times for this customer and there's "
"an stablished limit of %s for this promotion."
msgstr ""

#. module: coupon_limit
#: code:addons/coupon_limit/models/sale_coupon_program.py:0
#, python-format
msgid ""
"This promo code was already applied %s times for this salesman and there's "
"an stablished limit of %s for this promotion."
msgstr ""

#. module: coupon_limit
#: code:addons/coupon_limit/models/sale_coupon.py:0
#: code:addons/coupon_limit/models/sale_coupon_program.py:0
#, python-format
msgid "This promotion is restricted to the listed salesmen."
msgstr ""

#. module: coupon_limit
#: code:addons/coupon_limit/models/sale_coupon.py:0
#: code:addons/coupon_limit/models/sale_coupon_program.py:0
#, python-format
msgid ""
"This promotion was already applied %s times for this customer and there's an"
" stablished limit of %s."
msgstr ""

#. module: coupon_limit
#: code:addons/coupon_limit/models/sale_coupon.py:0
#, python-format
msgid ""
"This promotion was already applied %s times for this salesman and there's an"
" stablished limit of %s."
msgstr ""

#. module: coupon_limit
#: model:ir.model.constraint,message:coupon_limit.constraint_sale_coupon_rule_salesmen_limit_user_id_uniq
msgid "This salesman limit is already configured"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "Total limit"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "Total used"
msgstr ""

#. module: coupon_limit
#: model:ir.model.fields,field_description:coupon_limit.field_sale_coupon_rule_salesmen_limit__rule_times_used
msgid "Uses"
msgstr ""

#. module: coupon_limit
#: model_terms:ir.ui.view,arch_db:coupon_limit.sale_coupon_program_view_form_common
msgid "used already)"
msgstr ""
1 change: 1 addition & 0 deletions coupon_limit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import coupon_rule
Loading

0 comments on commit da66de1

Please sign in to comment.