Skip to content

Commit

Permalink
[ADD] sale_loyalty_initial_date_validity: New module
Browse files Browse the repository at this point in the history
45685
  • Loading branch information
pilarvargas-tecnativa committed Oct 27, 2023
1 parent f080b8c commit b8f191f
Show file tree
Hide file tree
Showing 16 changed files with 744 additions and 0 deletions.
96 changes: 96 additions & 0 deletions sale_loyalty_initial_date_validity/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
==================================
Sale Loyalty Initial Date Validity
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2d01e4e9ea5054e103feba82525c0c13dd362089aa805aaf26f92ed3ed601c38
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_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-sale_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_initial_date_validity to make checks
when applying a promotion based on the start date of the promotion.

**Table of contents**

.. contents::
:local:

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

This module is required to complete the loyalty_initial_date_validity functionality.

Usage
=====

To use this module, simply go to edit or create a promotion and set a start date in the
"Start date" field and then apply the promotion to a sales order.

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:%20sale_loyalty_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/sale_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 sale_loyalty_initial_date_validity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions sale_loyalty_initial_date_validity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Loyalty Initial Date Validity",
"summary": "",
"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": ["sale_loyalty", "loyalty_initial_date_validity"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_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:10+0000\n"
"PO-Revision-Date: 2023-10-26 11:10+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_initial_date_validity
#: model:ir.model,name:sale_loyalty_initial_date_validity.model_sale_order
msgid "Sales Order"
msgstr ""
1 change: 1 addition & 0 deletions sale_loyalty_initial_date_validity/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
34 changes: 34 additions & 0 deletions sale_loyalty_initial_date_validity/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.osv import expression


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

def _get_program_domain(self):
res = super()._get_program_domain()
return expression.AND(
[
res,
[
"|",
("date_from", "=", False),
("date_from", "<=", fields.Date.context_today(self)),
],
]
)

def _get_trigger_domain(self):
res = super()._get_trigger_domain()
return expression.AND(

Check warning on line 25 in sale_loyalty_initial_date_validity/models/sale_order.py

View check run for this annotation

Codecov / codecov/patch

sale_loyalty_initial_date_validity/models/sale_order.py#L24-L25

Added lines #L24 - L25 were not covered by tests
[
res,
[
"|",
("date_from", "=", False),
("date_from", "<=", fields.Date.context_today(self)),
],
]
)
1 change: 1 addition & 0 deletions sale_loyalty_initial_date_validity/readme/CONTEXT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module is required to complete the loyalty_initial_date_validity functionality.
3 changes: 3 additions & 0 deletions sale_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
2 changes: 2 additions & 0 deletions sale_loyalty_initial_date_validity/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of loyalty_initial_date_validity to make checks
when applying a promotion based on the start date of the promotion.
2 changes: 2 additions & 0 deletions sale_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 sale_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
"Start date" field and then apply the promotion to a sales order.
Loading

0 comments on commit b8f191f

Please sign in to comment.