Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] sale_loyalty_criteria_multi_product: Migration to 18. #258

Open
wants to merge 12 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions sale_loyalty_criteria_multi_product/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
======================================
Loyalty multi product criteria in sale
======================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4cbdadadd77c36d0cb03ec834458bc03506e902fca8da528b88a66f318e909d6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.0/sale_loyalty_criteria_multi_product
: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-18-0/sale-promotion-18-0-sale_loyalty_criteria_multi_product
: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=18.0
:alt: Try me on Runboat

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

Module that extends from *loyalty_criteria_multi_product* and allows to
use it's configuration in sale orders.

**Table of contents**

.. contents::
:local:

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

Follow the steps described in the base module.

Usage
=====

Once configured, apply the programs as usual.

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:%20sale_loyalty_criteria_multi_product%0Aversion:%2018.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
- Stefan Ungureanu
- Pilar Vargas

- `Domatix <https://www.domatix.com>`__:

- Álvaro López Oró
- Carolina Ferrer

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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/18.0/sale_loyalty_criteria_multi_product>`_ 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 sale_loyalty_criteria_multi_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions sale_loyalty_criteria_multi_product/__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": "Loyalty multi product criteria in sale",
"summary": "Allows to set as promotion criteria multi-product conditions",
"version": "18.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_criteria_multi_product", "sale_loyalty", "sale"],
"data": ["security/ir.model.access.csv"],
}
72 changes: 72 additions & 0 deletions sale_loyalty_criteria_multi_product/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_loyalty_criteria_multi_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-03 09:06+0000\n"
"PO-Revision-Date: 2023-03-03 10:08+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.2.2\n"

#. module: sale_loyalty_criteria_multi_product
#: model:ir.model,name:sale_loyalty_criteria_multi_product.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_loyalty_criteria_multi_product
#. odoo-python
#: code:addons/sale_loyalty_criteria_multi_product/models/sale_order.py:0
#, python-format
msgid "You don't have the required product quantities on your sales order."
msgstr ""

#~ msgid "Can product quantities count multiple times or not"
#~ msgstr "Las cantidades de productos pueden contarse varias veces o no"

#~ msgid "Coupon Program"
#~ msgstr "Programa de cupones"

#~ msgid "Created by"
#~ msgstr "Creado por"

#~ msgid "Created on"
#~ msgstr "Creado el"

#~ msgid "Display Name"
#~ msgstr "Nombre a mostrar"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última modificación el"

#~ msgid "Last Updated by"
#~ msgstr "Última actualización por"

#~ msgid "Last Updated on"
#~ msgstr "Última actualización en"

#~ msgid "Min. Quantity"
#~ msgstr "Cantidad mínima"

#~ msgid "Minimum required product quantity to get the reward"
#~ msgstr "Cantidad mínima de producto requerida para obtener la recompensa"

#~ msgid "Products"
#~ msgstr "Productos"

#~ msgid "Program"
#~ msgstr "Programa"

#~ msgid "Repeat"
#~ msgstr "Repetir"
30 changes: 30 additions & 0 deletions sale_loyalty_criteria_multi_product/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_loyalty_criteria_multi_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-15 11:58+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: sale_loyalty_criteria_multi_product
#: model:ir.model,name:sale_loyalty_criteria_multi_product.model_sale_order
msgid "Sales Order"
msgstr "Ordine di vendita"

#. module: sale_loyalty_criteria_multi_product
#. odoo-python
#: code:addons/sale_loyalty_criteria_multi_product/models/sale_order.py:0
#, python-format
msgid "You don't have the required product quantities on your sales order."
msgstr ""
"Non si dispone della quantità prodotto richiesta nell'ordine di vendita."
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_loyalty_criteria_multi_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: sale_loyalty_criteria_multi_product
#: model:ir.model,name:sale_loyalty_criteria_multi_product.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_loyalty_criteria_multi_product
#. odoo-python
#: code:addons/sale_loyalty_criteria_multi_product/models/sale_order.py:0
#, python-format
msgid "You don't have the required product quantities on your sales order."
msgstr ""
1 change: 1 addition & 0 deletions sale_loyalty_criteria_multi_product/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
38 changes: 38 additions & 0 deletions sale_loyalty_criteria_multi_product/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2021 Tecnativa - David Vidal
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, models


class SaleOrder(models.Model):
_inherit = "sale.order"

def _program_check_compute_points(self, programs):
res = super()._program_check_compute_points(programs)
# Iterate through the programs that initially have no errors
for program, result in res.items():
if result.get("error", False):
continue
# Check that all rules have the criterion in place.
if all(
rule.loyalty_criteria == "multi_product" for rule in program.rule_ids
):
order_products = self.order_line.filtered(
lambda x: not x.is_reward_line and x.product_uom_qty > 0
).mapped("product_id")
# Check that at least one rule has all products in loyalty_criteria_ids
# present in the order lines.
if not any(
all(
product_id in order_products
for product_id in rule.loyalty_criteria_ids.product_ids
)
for rule in program.rule_ids
):
res[program] = {
"error": _(
"You don't have the required product quantities "
"on your sales order."
)
}
return res
3 changes: 3 additions & 0 deletions sale_loyalty_criteria_multi_product/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions sale_loyalty_criteria_multi_product/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Follow the steps described in the base module.
10 changes: 10 additions & 0 deletions sale_loyalty_criteria_multi_product/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- [Tecnativa](https://www.tecnativa.com):
- Pedro M. Baeza
- David Vidal
- Stefan Ungureanu
- Pilar Vargas
- [Domatix](https://www.domatix.com):
- Álvaro López Oró
- Carolina Ferrer
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia
2 changes: 2 additions & 0 deletions sale_loyalty_criteria_multi_product/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Module that extends from *loyalty_criteria_multi_product* and allows to
use it's configuration in sale orders.
1 change: 1 addition & 0 deletions sale_loyalty_criteria_multi_product/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Once configured, apply the programs as usual.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_criteria_salesman,salesman,loyalty_criteria_multi_product.model_loyalty_criteria,sales_team.group_sale_salesman,1,0,0,0
access_criteria_manager,criteria manager,loyalty_criteria_multi_product.model_loyalty_criteria,sales_team.group_sale_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading