Skip to content

Commit

Permalink
[ADD] sale_loyalty_industry
Browse files Browse the repository at this point in the history
  • Loading branch information
santostelmo committed Jan 16, 2024
1 parent 977ad8e commit d944880
Show file tree
Hide file tree
Showing 16 changed files with 737 additions and 0 deletions.
76 changes: 76 additions & 0 deletions sale_loyalty_industry/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
======================
Sale loyality industry
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:88249b5ea969933e22011aa34eac20d073bfec55af55c7f447f3b27993ea5e51
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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/sale_loyalty_industry
: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-sale_loyalty_industry
: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 allow to restrict the industries in which the sale loyalty program applies.

**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:%20sale_loyalty_industry%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
~~~~~~~

* Camptocamp

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

* Telmo Santos <[email protected]>

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.

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/16.0/sale_loyalty_industry>`_ 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_industry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions sale_loyalty_industry/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Sale loyality industry",
"summary": "Sale of loyalty program restricted to industries.",
"version": "16.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-promotion",
"license": "AGPL-3",
"category": "Others",
"depends": [
"sale_loyalty",
"partner_industry_secondary",
],
"data": [
"views/loyalty_program_views.xml",
],
"installable": True,
}
22 changes: 22 additions & 0 deletions sale_loyalty_industry/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_loyalty_industry
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-15 14:23+0000\n"
"PO-Revision-Date: 2023-12-15 14:23+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: sale_loyalty_industry
#: model:ir.model.fields,help:sale_loyalty_industry.field_loyalty_program__industry_ids
msgid "The loyalty program is applied in these industries."
msgstr "Le programme de fidélité est appliqué dans ces secteurs."
36 changes: 36 additions & 0 deletions sale_loyalty_industry/i18n/sale_loyalty_industry.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_loyalty_industry
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-15 14:23+0000\n"
"PO-Revision-Date: 2023-12-15 14:23+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: sale_loyalty_industry
#: model:ir.model.fields,field_description:sale_loyalty_industry.field_loyalty_program__industry_ids
msgid "Industries"
msgstr ""

#. module: sale_loyalty_industry
#: model:ir.model,name:sale_loyalty_industry.model_loyalty_program
msgid "Loyalty Program"
msgstr ""

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

#. module: sale_loyalty_industry
#: model:ir.model.fields,help:sale_loyalty_industry.field_loyalty_program__industry_ids
msgid "The loyalty program is applied in these industries."
msgstr ""
2 changes: 2 additions & 0 deletions sale_loyalty_industry/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import loyalty_program
from . import sale_order
15 changes: 15 additions & 0 deletions sale_loyalty_industry/models/loyalty_program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from odoo import fields, models


class LoyaltyProgram(models.Model):
_inherit = "loyalty.program"

industry_ids = fields.Many2many(
"res.partner.industry",
string="Industries",
help="The loyalty program is applied in these industries.",
)
26 changes: 26 additions & 0 deletions sale_loyalty_industry/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from odoo import models
from odoo.osv import expression


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

def _get_program_domain(self):
base_expression = super()._get_program_domain()
domain = expression.AND(
[
base_expression,
[
"|",
"|",
("industry_ids", "=", False),
("industry_ids", "child_of", self.partner_id.industry_id.ids),
("industry_ids", "parent_of", self.partner_id.industry_id.ids),
],
]
)
return domain
1 change: 1 addition & 0 deletions sale_loyalty_industry/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Telmo Santos <[email protected]>
1 change: 1 addition & 0 deletions sale_loyalty_industry/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allow to restrict the industries in which the sale loyalty program applies.
Loading

0 comments on commit d944880

Please sign in to comment.