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

Syncing from upstream OCA/sale-promotion (14.0) #49

Merged
merged 6 commits into from
Jun 8, 2024
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ addon | version | maintainers | summary
[sale_coupon_product_exclude](sale_coupon_product_exclude/) | 14.0.1.0.0 | | Apply a discount to the order, excluding products matching the domain
[sale_coupon_reward_add_product](sale_coupon_reward_add_product/) | 14.0.1.0.0 | [![jcoux](https://github.com/jcoux.png?size=30px)](https://github.com/jcoux) [![ivantodorovich](https://github.com/ivantodorovich.png?size=30px)](https://github.com/ivantodorovich) | Sale Coupon Automatic free product as normal
[sale_coupon_reward_fixed_price](sale_coupon_reward_fixed_price/) | 14.0.1.1.0 | | Apply fixed price for domain matching products
[sale_coupon_reward_fixed_price_order_line_link](sale_coupon_reward_fixed_price_order_line_link/) | 14.0.1.0.0 | [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) | Bridge module to track promotions on SOL with the discount in field
[sale_promotion_discount_in_field](sale_promotion_discount_in_field/) | 14.0.1.1.0 | [![CetmixGitDrone](https://github.com/CetmixGitDrone.png?size=30px)](https://github.com/CetmixGitDrone) [![Volodiay622](https://github.com/Volodiay622.png?size=30px)](https://github.com/Volodiay622) | Put promotion discount into discount field

[//]: # (end addons)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ def _set_reward_fixed_price_for_lines(self, program):
lambda line: program._get_valid_products(line.product_id),
)
lines.write({"price_unit": program.price_unit})
return lines
else:
super()._set_reward_fixed_price_for_lines(program)
return super()._set_reward_fixed_price_for_lines(program)
10 changes: 3 additions & 7 deletions sale_coupon_reward_fixed_price/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def _set_reward_fixed_price_for_lines(self, program):
price_unit = program.price_unit
lines = self._get_paid_order_lines()
if program.discount_apply_on == "cheapest_product":
line = self._get_cheapest_line()
if line:
line.price_unit = price_unit
lines = self._get_cheapest_line()
elif program.discount_apply_on in ["specific_products", "on_order"]:
if program.discount_apply_on == "specific_products":
# We should not exclude reward line that offer this product
Expand All @@ -102,15 +100,13 @@ def _set_reward_fixed_price_for_lines(self, program):
lambda x: x.product_id
in (program.discount_specific_product_ids | free_product_lines),
)
for line in lines:
line.price_unit = price_unit
elif program.discount_apply_on == "domain_product":
# for compatibility with `sale_promotion_domain_product_discount` module
lines = (self.order_line - self._get_reward_lines()).filtered(
lambda line: program._get_valid_products(line.product_id),
)
for line in lines:
line.price_unit = price_unit
lines.write({"price_unit": price_unit})
return lines

def _get_reward_line_values(self, program):
"""
Expand Down
99 changes: 99 additions & 0 deletions sale_coupon_reward_fixed_price_order_line_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
=========================================
Coupon Reward Fixed Price Order Line Link
=========================================

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

.. |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/14.0/sale_coupon_reward_fixed_price_order_line_link
: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-14-0/sale-promotion-14-0-sale_coupon_reward_fixed_price_order_line_link
: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=14.0
:alt: Try me on Runboat

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

Bridge module between Sale Coupon Order Line Link and
Sale Coupon Reward Fixed Price

**Table of contents**

.. contents::
:local:

Usage
=====

No action necessary, module works out of the box.

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_coupon_reward_fixed_price_order_line_link%0Aversion:%2014.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
~~~~~~~

* PyTech SRL

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


* `PyTech SRL <https://www.pytech.it>`__:

* Alessandro Uffreduzzi <[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.

.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px
:target: https://github.com/aleuffre
:alt: aleuffre
.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px
:target: https://github.com/renda-dev
:alt: renda-dev
.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba

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

|maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba|

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/14.0/sale_coupon_reward_fixed_price_order_line_link>`_ 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_coupon_reward_fixed_price_order_line_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions sale_coupon_reward_fixed_price_order_line_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Coupon Reward Fixed Price Order Line Link",
"version": "14.0.1.0.0",
"summary": "Bridge module to track promotions on SOL " "with the discount in field",
"author": "PyTech SRL, Odoo Community Association (OCA)",
"maintainers": ["aleuffre", "renda-dev", "PicchiSeba"],
"license": "AGPL-3",
"category": "Sales Management",
"website": "https://github.com/OCA/sale-promotion",
"depends": [
"sale_coupon_order_line_link",
"sale_coupon_reward_fixed_price",
],
"demo": [],
"data": [],
"installable": True,
"application": False,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_coupon_reward_fixed_price_order_line_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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_coupon_reward_fixed_price_order_line_link
#: model:ir.model.fields,field_description:sale_coupon_reward_fixed_price_order_line_link.field_sale_order__display_name
msgid "Display Name"
msgstr ""

#. module: sale_coupon_reward_fixed_price_order_line_link
#: model:ir.model.fields,field_description:sale_coupon_reward_fixed_price_order_line_link.field_sale_order__id
msgid "ID"
msgstr ""

#. module: sale_coupon_reward_fixed_price_order_line_link
#: model:ir.model.fields,field_description:sale_coupon_reward_fixed_price_order_line_link.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""

#. module: sale_coupon_reward_fixed_price_order_line_link
#: model:ir.model,name:sale_coupon_reward_fixed_price_order_line_link.model_sale_order
msgid "Sales Order"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


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

def _set_reward_fixed_price_for_lines(self, program):
lines = super()._set_reward_fixed_price_for_lines(program)
if lines:
lines.write({"coupon_program_id": program.id})
return lines
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

* `PyTech SRL <https://www.pytech.it>`__:

* Alessandro Uffreduzzi <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bridge module between Sale Coupon Order Line Link and
Sale Coupon Reward Fixed Price
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No action necessary, module works out of the box.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading