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

[16.0][ADD]pos_sale_loyalty_discount_attribute #134

Open
wants to merge 1 commit into
base: 16.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
95 changes: 95 additions & 0 deletions pos_sale_loyalty_discount_attribute/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
================================================
POS - Promotion Discounts on Selected Attributes
================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/pos_sale_loyalty_discount_attribute
: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-pos_sale_loyalty_discount_attribute
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/sale-promotion&target_branch=16.0
:alt: Try me on Runboat

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

Allow attribute prices to not be subject to promotion discounts in POS.

**Table of contents**

.. contents::
:local:

Usage
=====

On the Discount & Loyalty form, in the Rewards popup screen, a "Limit Discounted Attributes" selection list enables this feature.
Options are: empty (disabled), "On List Price and Attributes", or "On Attributes Only".
This makes available a "Discounted Attributes" field, to select zero or more Attributes that will have the discount applied.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20pos_sale_loyalty_discount_attribute%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
~~~~~~~

* Open Source Integrators

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

* Sandip Vyas <[email protected]>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Open Source Integrators <https://opensourceintegrators.com>

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-ursais| image:: https://github.com/ursais.png?size=40px
:target: https://github.com/ursais
:alt: ursais

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ursais|

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/16.0/pos_sale_loyalty_discount_attribute>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions pos_sale_loyalty_discount_attribute/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2023 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
20 changes: 20 additions & 0 deletions pos_sale_loyalty_discount_attribute/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2023 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "POS - Promotion Discounts on Selected Attributes",
"version": "16.0.1.0.0",
"summary": """Allow attribute prices to not be subject to promotion discounts in POS.""",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Point of Sale",
"maintainer": "Open Source Integrators",
"website": "https://github.com/OCA/sale-promotion",
"depends": ["pos_loyalty", "sale_loyalty_discount_attribute"],
"maintainers": ["ursais"],
"installable": True,
"assets": {
"point_of_sale.assets": [
"pos_sale_loyalty_discount_attribute/static/src/js/**/*.js",
],
},
}
4 changes: 4 additions & 0 deletions pos_sale_loyalty_discount_attribute/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2023 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import pos_session
22 changes: 22 additions & 0 deletions pos_sale_loyalty_discount_attribute/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2023 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _get_attributes_by_ptal_id(self):
res = super(PosSession, self)._get_attributes_by_ptal_id()
for _key, values in res.items():
for attribute_value in values["values"]:
line = self.env["product.attribute.value"].browse(attribute_value["id"])
attribute_value.update({"attribute_id": line.attribute_id.id})
return res

def _loader_params_loyalty_reward(self):
result = super()._loader_params_loyalty_reward()
result["search_params"]["fields"].append("limit_discounted_attributes")
result["search_params"]["fields"].append("discount_attribute_ids")
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sandip Vyas <[email protected]>
3 changes: 3 additions & 0 deletions pos_sale_loyalty_discount_attribute/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

* Open Source Integrators <https://opensourceintegrators.com>
1 change: 1 addition & 0 deletions pos_sale_loyalty_discount_attribute/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow attribute prices to not be subject to promotion discounts in POS.
3 changes: 3 additions & 0 deletions pos_sale_loyalty_discount_attribute/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
On the Discount & Loyalty form, in the Rewards popup screen, a "Limit Discounted Attributes" selection list enables this feature.
Options are: empty (disabled), "On List Price and Attributes", or "On Attributes Only".
This makes available a "Discounted Attributes" field, to select zero or more Attributes that will have the discount applied.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading