Skip to content

Commit

Permalink
Merge PR #167 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 26, 2023
2 parents f080b8c + 9abd20a commit 968df0d
Show file tree
Hide file tree
Showing 15 changed files with 676 additions and 0 deletions.
100 changes: 100 additions & 0 deletions loyalty_initial_date_validity/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
=============================
Loyalty Initial Date Validity
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:100c118d1c13555f87ce49e63864cbf8d27b5c8b51068e4beb67a887d902c862
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/loyalty_initial_date_validity
: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_initial_date_validity
: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 extends the functionality of Loyalty to add the date_from field to
promotions. The aim of this is to be able to set a start date for a promotion.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module is created in v16 because in v15 there was a field rule_date_from to set the
start date of a promotion in the coupon_program module and in v16 this field disappears
and there is no other field to replace it. This is why it was decided to add the
date_from field at promotion level as well as the date_to field and recover this
functionality.

Usage
=====

To use this module simply go to edit or create a promotion and set a start date in
the field labelled "Start date".

Known issues / Roadmap
======================

This module will not be needed in v17 as this functionality is reinstated.
https://github.com/odoo/odoo/commit/bce4aededc37bac40c89aae44a157f20a873528f

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_initial_date_validity%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>`_:

* Pilar Vargas

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/loyalty_initial_date_validity>`_ 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 loyalty_initial_date_validity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions loyalty_initial_date_validity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Loyalty Initial Date Validity",
"summary": "Set a start date for a promotion",
"version": "16.0.1.0.0",
"category": "Sale",
"website": "https://github.com/OCA/sale-promotion",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["loyalty"],
"data": ["views/loyalty_program_views.xml"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * loyalty_initial_date_validity
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 11:09+0000\n"
"PO-Revision-Date: 2023-10-26 11:09+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: loyalty_initial_date_validity
#: model:ir.model.fields,field_description:loyalty_initial_date_validity.field_loyalty_program__date_to
msgid "End date"
msgstr ""

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

#. module: loyalty_initial_date_validity
#: model:ir.model.fields,field_description:loyalty_initial_date_validity.field_loyalty_program__date_from
msgid "Start Date"
msgstr ""

#. module: loyalty_initial_date_validity
#: model:ir.model.fields,help:loyalty_initial_date_validity.field_loyalty_program__date_to
msgid "The end date is included in the validity period of this program"
msgstr ""

#. module: loyalty_initial_date_validity
#: model:ir.model.fields,help:loyalty_initial_date_validity.field_loyalty_program__date_from
msgid "The start date is included in the validity period of this program"
msgstr ""

#. module: loyalty_initial_date_validity
#. odoo-python
#: code:addons/loyalty_initial_date_validity/models/loyalty_program.py:0
#, python-format
msgid ""
"The validity period's start date must be anterior or equal to its end date."
msgstr ""
1 change: 1 addition & 0 deletions loyalty_initial_date_validity/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import loyalty_program
28 changes: 28 additions & 0 deletions loyalty_initial_date_validity/models/loyalty_program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError


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

date_from = fields.Date(
string="Start Date",
help="The start date is included in the validity period of this program",
)
# Overwrite field to modify the string and add help
date_to = fields.Date(
string="End date",
help="The end date is included in the validity period of this program",
)

@api.constrains("date_from", "date_to")
def _check_date_from_date_to(self):
if any(p.date_to and p.date_from and p.date_from > p.date_to for p in self):
raise UserError(
_(
"The validity period's start date must be anterior or equal to its "
"end date."
)
)
5 changes: 5 additions & 0 deletions loyalty_initial_date_validity/readme/CONTEXT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module is created in v16 because in v15 there was a field rule_date_from to set the
start date of a promotion in the coupon_program module and in v16 this field disappears
and there is no other field to replace it. This is why it was decided to add the
date_from field at promotion level as well as the date_to field and recover this
functionality.
3 changes: 3 additions & 0 deletions loyalty_initial_date_validity/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Pilar Vargas
3 changes: 3 additions & 0 deletions loyalty_initial_date_validity/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module extends the functionality of Loyalty to add the date_from field to
promotions. The aim of this is to be able to set a start date for a promotion.
It's a technical base to be extended with top level functionality (sales, pos).
2 changes: 2 additions & 0 deletions loyalty_initial_date_validity/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module will not be needed in v17 as this functionality is reinstated.
https://github.com/odoo/odoo/commit/bce4aededc37bac40c89aae44a157f20a873528f
2 changes: 2 additions & 0 deletions loyalty_initial_date_validity/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To use this module simply go to edit or create a promotion and set a start date in
the field labelled "Start date".
Loading

0 comments on commit 968df0d

Please sign in to comment.