-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
18 changed files
with
1,366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
============= | ||
Loyalty Limit | ||
============= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:c1badaa74b82a3331c9b943affe0cd31f7fffd24e1815aea5cacb0db04390fcf | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/16.0/loyalty_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-16-0/sale-promotion-16-0-loyalty_limit | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to configure a limit on the times a promotion can be applied. It's a | ||
technical base to be extended with top level functionality (sales, pos). | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20loyalty_limit%0Aversion:%2016.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 | ||
* Pilar Vargas | ||
|
||
* `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/16.0/loyalty_limit>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "Loyalty Limit", | ||
"summary": "Restrict number of promotions per customer or salesman", | ||
"version": "16.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": ["loyalty"], | ||
"data": ["views/loyalty_program_views.xml", "security/ir.model.access.csv"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * loyalty_limit | ||
# | ||
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_limit | ||
#: model:ir.model,name:loyalty_limit.model_coupon_rule | ||
msgid "Coupon Rule" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model,name:loyalty_limit.model_coupon_rule_salesmen_limit | ||
msgid "Coupon Rule Salesmen limits" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__create_uid | ||
msgid "Created by" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__create_date | ||
msgid "Created on" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_program__rule_salesmen_strict_limit | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_rule__rule_salesmen_strict_limit | ||
msgid "" | ||
"If marked, promotion will only be allowed for the list of salesmen with " | ||
"their quantities" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__write_uid | ||
msgid "Last Updated by" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__write_date | ||
msgid "Last Updated on" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "Max" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "Max. Customer Applications" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "Max. Salesmen Applications" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_program__rule_max_customer_application | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule__rule_max_customer_application | ||
msgid "Maximum Customer Applications" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__rule_max_salesman_application | ||
msgid "Maximum Salesman Applications" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_rule_salesmen_limit__rule_max_salesman_application | ||
msgid "Maximum times a salesman can apply a program. 0 for no limit." | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_program__rule_salesmen_limit_ids | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_rule__rule_salesmen_limit_ids | ||
msgid "Maximum times salesmen can apply a program. Empty for no limit." | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_program__rule_max_customer_application | ||
#: model:ir.model.fields,help:loyalty_limit.field_coupon_rule__rule_max_customer_application | ||
msgid "" | ||
"Maximum times that a program can be applied to a customer. 0 for no limit." | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__rule_id | ||
msgid "Rule" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__rule_user_id | ||
msgid "Salesman" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_program__rule_salesmen_limit_ids | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule__rule_salesmen_limit_ids | ||
msgid "Salesmen Limits" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_program__rule_salesmen_limit_count | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule__rule_salesmen_limit_count | ||
msgid "Salesmen maximum promotions" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_program__rule_salesmen_limit_used_count | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule__rule_salesmen_limit_used_count | ||
msgid "Salesmen promotions used" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_program__rule_salesmen_strict_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule__rule_salesmen_strict_limit | ||
msgid "Strict limit" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.constraint,message:loyalty_limit.constraint_coupon_rule_salesmen_limit_user_id_uniq | ||
msgid "This salesman limit is already configured" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "Total limit" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "Total used" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model:ir.model.fields,field_description:loyalty_limit.field_coupon_rule_salesmen_limit__rule_times_used | ||
msgid "Uses" | ||
msgstr "" | ||
|
||
#. module: loyalty_limit | ||
#: model_terms:ir.ui.view,arch_db:loyalty_limit.sale_coupon_program_view_form_common | ||
msgid "used already)" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Copyright 2023 Tecnativa - Pilar Vargas | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
_field_renames = [ | ||
("loyalty.salesmen.limit", "loyalty_salesmen_limit", "rule_user_id", "user_id"), | ||
( | ||
"loyalty.salesmen.limit", | ||
"loyalty_salesmen_limit", | ||
"rule_max_salesman_application", | ||
"max_salesman_application", | ||
), | ||
] | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_models( | ||
env.cr, [("coupon.rule.salesmen.limit", "loyalty.salesmen.limit")] | ||
) | ||
openupgrade.rename_tables( | ||
env.cr, [("coupon_rule_salesmen_limit", "loyalty_salesmen_limit")] | ||
) | ||
openupgrade.rename_fields(env.cr, _field_renames) | ||
# Create the 'program_id' field if it does not exist in the 'loyalty_salesmen_limit' | ||
# table and fill the 'program_id' field with values from 'loyalty_rule.program_id' | ||
# where 'loyalty_rule.id' is equal to old field 'loyalty_salesmen_limit.rule_id' | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE loyalty_salesmen_limit | ||
ADD COLUMN IF NOT EXISTS program_id INT | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE loyalty_salesmen_limit | ||
SET program_id = loyalty_rule.program_id | ||
FROM loyalty_rule | ||
WHERE loyalty_salesmen_limit.rule_id = loyalty_rule.id | ||
""", | ||
) | ||
# Delete constraints to recreate it | ||
openupgrade.delete_sql_constraint_safely( | ||
env, "loyalty_limit", "loyalty_salesmen_limit", "user_id_uniq" | ||
) | ||
# Move fields 'max_customer_application', 'salesmen_limit_ids' and 'salesmen_strict_limit' | ||
# from loyalty_rule to loyalty_program table | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE loyalty_program | ||
ADD COLUMN IF NOT EXISTS max_customer_application INT | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE loyalty_program | ||
ADD COLUMN IF NOT EXISTS salesmen_limit_ids INT | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE loyalty_program | ||
ADD COLUMN IF NOT EXISTS salesmen_strict_limit BOOLEAN | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE loyalty_program AS lp | ||
SET | ||
max_customer_application = lr.rule_max_customer_application, | ||
salesmen_limit_ids = lr.rule_salesmen_limit_ids, | ||
salesmen_strict_limit = lr.rule_salesmen_strict_limit | ||
FROM loyalty_rule AS lr | ||
WHERE lp.id = lr.program_id | ||
""", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import loyalty_program |
Oops, something went wrong.