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

[17.0] [MIG] Sale discount display amount #3160

Merged
merged 56 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f55f985
[ADD] add new module to display discount amount on sale orders
Sep 14, 2018
8b56702
[UPD] Update sale_discount_display_amount.pot
oca-travis Sep 18, 2018
fb8b84a
[UPD] README.rst
OCA-git-bot Sep 19, 2018
ca0773a
Added translation using Weblate (French)
Oct 10, 2018
3436e5e
Added translation using Weblate (Spanish)
Oct 10, 2018
98d6dd0
[12.0][MIG] sale_discount_display_amount
Abranes Apr 4, 2019
97f946b
[UPD] README.rst
OCA-git-bot Jun 11, 2019
8e2d4bb
[UPD] Update sale_discount_display_amount.pot
oca-travis Jun 11, 2019
955c062
Update translation files
oca-transbot Jun 16, 2019
c2b7b0b
Added translation using Weblate (German)
marylla Jul 15, 2019
e7c2e78
Translated using Weblate (German)
marylla Jul 15, 2019
9edd6e6
[UPD] README.rst
OCA-git-bot Jul 29, 2019
5280de3
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
b995c38
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
bc82b5e
[IMP] sale_discount_display_amount: black, isort
Oct 18, 2019
07efd1c
[MIG] sale_discount_display_amount: Migration to 13.0
Oct 18, 2019
5d1abcc
[MIG] sale_discount_display_amount: Computed values must be reset by …
lmignon Oct 29, 2019
85bb42f
[IMP] sale_discount_display_amount rename view
Dec 11, 2019
cfd49c0
[UPD] Update sale_discount_display_amount.pot
oca-travis Dec 11, 2019
40b71e4
[UPD] README.rst
OCA-git-bot Dec 11, 2019
f5d0a78
Update translation files
oca-transbot Jan 3, 2020
d72536c
pre-commit update
OCA-git-bot Mar 14, 2020
5bd1466
[FIX] sale_discount_display_amount: Guidelines in compute methods names
pedrobaeza Jun 8, 2020
d91c8e7
Translated using Weblate (Spanish)
danimv5 Jul 27, 2020
c0ef80b
[MIG] sale_discount_display_amount: Migration to 14.0
chafique-delli Oct 12, 2020
350cde7
[UPD] Update sale_discount_display_amount.pot
oca-travis Jan 25, 2021
f7cf5b2
[UPD] README.rst
OCA-git-bot Jan 25, 2021
dc9de30
sale_discount_display_amount 14.0.1.0.1
OCA-git-bot Jan 25, 2021
f230180
Added translation using Weblate (Dutch)
bosd Jan 25, 2021
1a5b64f
Translated using Weblate (Dutch)
bosd Jan 25, 2021
01db8d3
Added translation using Weblate (Catalan)
danimv5 Feb 23, 2021
631897f
Translated using Weblate (Catalan)
danimv5 Feb 23, 2021
6adb361
Translated using Weblate (German)
marylla Jul 9, 2021
598bb1f
sale_discount_display_amount: fix init hook
simahawk Jul 14, 2021
5e793f3
sale_discount_display_amount 14.0.1.0.2
OCA-git-bot Jul 22, 2021
29a4f0d
[14.0][IMP] sale_discount_display_amount: Adds hook for depends
rousseldenis Aug 30, 2021
a7194b1
sale_discount_display_amount 14.0.1.0.3
OCA-git-bot Nov 26, 2021
a50de15
Added translation using Weblate (Italian)
francesco-ooops Jan 21, 2022
5101dd9
Translated using Weblate (Italian)
francesco-ooops Jan 21, 2022
8d620c4
[MIG]sale_discount_display_amount: Migration to 15.0
manuelregidor Jun 1, 2022
f9f7591
[UPD] Update sale_discount_display_amount.pot
Jun 2, 2022
3c2da7c
[UPD] README.rst
OCA-git-bot Jun 2, 2022
490e212
sale_discount_display_amount 15.0.1.0.1
OCA-git-bot Jun 2, 2022
cb47a29
Translated using Weblate (Italian)
mymage Mar 23, 2023
e823eea
[MIG] sale_discount_display_amount: Migration to 16.0
Mar 29, 2023
27bdc95
[UPD] Update sale_discount_display_amount.pot
Jun 7, 2023
9da19d3
[UPD] README.rst
OCA-git-bot Jun 7, 2023
649a8c1
Update translation files
weblate Jun 7, 2023
96c2391
Translated using Weblate (Italian)
francesco-ooops Aug 31, 2023
8d1c330
[UPD] README.rst
OCA-git-bot Sep 3, 2023
a88bf8b
[IMP] sale_discount_display_amount: Show total discount on sale report.
May 3, 2024
b9d677f
[UPD] Update sale_discount_display_amount.pot
May 8, 2024
e6b83c4
[BOT] post-merge updates
OCA-git-bot May 8, 2024
579dc32
Update translation files
weblate May 8, 2024
20e704e
Translated using Weblate (Italian)
mymage May 13, 2024
f457b22
[MIG] Sale Discount Display Amount: Migration to 17.0
FSchiepers May 29, 2024
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
106 changes: 106 additions & 0 deletions sale_discount_display_amount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
============================
Sale Discount Display Amount
============================

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

.. |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--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_discount_display_amount
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_discount_display_amount
: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-workflow&target_branch=16.0
:alt: Try me on Runboat

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

In standard Odoo only display the rate of the discount applied, never the
amount. It could be great to be able to tell the customer how much he spares.
This is the goal of this addons, it will show on a sale
order the total without the discount and the value of the discount.
You can choose if you want the discount on the Total with or the Total without TAX.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

#. Go to Sales/Settings and check "Allow discounts on sales order lines"
#. Go to Sales/Settings and check or uncheck "Show the Discount with TAX" depending on your needs

Usage
=====


To use this module, you need to:

#. Go on a sale order
#. Set a discount on a line
#. The value of the discount is dislayed in the total section as well as the total without it.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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-workflow/issues/new?body=module:%20sale_discount_display_amount%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
~~~~~~~

* ACSONE SA/NV

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

* Cédric Pigeon <[email protected]>
* Abraham Anes <[email protected]>
* Chafique Delli <[email protected]>
* Ruchir Shukla <[email protected]>
* Manuel Regidor <[email protected]>

* `Pesol <https://www.pesol.es>`__:

* Jonathan Oscategui Taza <[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-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_discount_display_amount>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_discount_display_amount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from .hooks import post_init_hook
from .hooks import pre_init_hook
17 changes: 17 additions & 0 deletions sale_discount_display_amount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Sale Discount Display Amount",
"summary": """
This addon intends to display the amount of the discount computed on
sale_order_line and sale_order level""",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale_management"],
"data": ["views/sale_view.xml", "views/res_config_settings_views.xml"],
"pre_init_hook": "pre_init_hook",
"post_init_hook": "post_init_hook",
}
58 changes: 58 additions & 0 deletions sale_discount_display_amount/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging

from odoo.tools.sql import column_exists, create_column

_logger = logging.getLogger(__name__)

COLUMNS = (
("sale_order", "price_subtotal_no_discount"),
("sale_order", "price_total_no_discount"),
("sale_order", "discount_total"),
("sale_order", "discount_subtotal"),
("sale_order_line", "price_subtotal_no_discount"),
("sale_order_line", "price_total_no_discount"),
("sale_order_line", "discount_total"),
("sale_order_line", "discount_subtotal"),
)


def pre_init_hook(env):
cr = env.cr # Retrieve the database cursor
for table, column in COLUMNS:
if not column_exists(cr, table, column):
_logger.info("Create discount column %s in database", column)
create_column(cr, table, column, "numeric")


def post_init_hook(env):
cr = env.cr # Retrieve the database cursor
_logger.info("Compute discount columns")

query = """
update sale_order_line
set
price_subtotal_no_discount = price_subtotal,
price_total_no_discount = price_total
where discount = 0.0
"""
cr.execute(query)

query = """
update sale_order
set
price_subtotal_no_discount = amount_untaxed,
price_total_no_discount = amount_total
"""
cr.execute(query)

query = """
select distinct order_id from sale_order_line where discount > 0.0;
"""

cr.execute(query)
order_ids = cr.fetchall()

orders = env["sale.order"].search([("id", "in", order_ids)])
orders.mapped("order_line")._update_discount_display_fields()
48 changes: 48 additions & 0 deletions sale_discount_display_amount/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_discount_display_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-02-23 17:45+0000\n"
"Last-Translator: Daniel Martinez Vila <[email protected]>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__discount_total
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__discount_total
msgid "Discount Subtotal"
msgstr "Subtotal de descompte"

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order
msgid "Sales Order"
msgstr "Comanda de venda"

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línia de comandes de vendes"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__price_total_no_discount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__price_total_no_discount
msgid "Subtotal Without Discount"
msgstr "Subtotal sense descompte"

#~ msgid "Display Name"
#~ msgstr "Nom Visible"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Darrera modificació el"
81 changes: 81 additions & 0 deletions sale_discount_display_amount/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_discount_display_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-22 09:19+0000\n"
"PO-Revision-Date: 2024-02-22 09:19+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_discount_display_amount
#: model:ir.model.fields,help:sale_discount_display_amount.field_res_config_settings__display_discount_with_tax
#: model:ir.model.fields,help:sale_discount_display_amount.field_sale_order__display_discount_with_tax
msgid "Check this field to show the Discount with TAX"
msgstr "Aktivieren Sie dieses Feld, um den Rabatt mit Steuern anzuzeigen."

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_res_company
msgid "Companies"
msgstr "Unternehmen"

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__discount_subtotal
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__discount_subtotal
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__discount_total
msgid "Discount Subtotal"
msgstr "Rabatt-Nettobetrag"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__discount_total
msgid "Discount total"
msgstr "Rabatt-Bruttobetrag"

#. module: sale_discount_display_amount
#: model_terms:ir.ui.view,arch_db:sale_discount_display_amount.res_config_settings_view_form
msgid ""
"OFF = Shows the Discount without TAX<br/>ON = Shows the Discount with TAX"
msgstr ""
"OFF = Zeigt den Rabatt ohne Steuer<br/>ON = Zeigt den Rabatt mit Steuer"

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

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order_line
msgid "Sales Order Line"
msgstr "Kundenauftragszeile"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_res_company__display_discount_with_tax
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_res_config_settings__display_discount_with_tax
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__display_discount_with_tax
msgid "Show the Discount with TAX"
msgstr "Den Rabatt mit Steuer anzeigen"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__price_subtotal_no_discount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__price_subtotal_no_discount
msgid "Subtotal Without Discount"
msgstr "Nettobetrag ohne Rabatt"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__price_total_no_discount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__price_total_no_discount
msgid "Total Without Discount"
msgstr "Bruttobetrag ohne Rabatt"
39 changes: 39 additions & 0 deletions sale_discount_display_amount/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_discount_display_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-07-27 10:19+0000\n"
"Last-Translator: Daniel Martinez Vila <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__discount_total
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__discount_total
msgid "Discount Subtotal"
msgstr "Descuento total"

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order
msgid "Sales Order"
msgstr "Órdenes de venta"

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea pedido de venta"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__price_total_no_discount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__price_total_no_discount
msgid "Subtotal Without Discount"
msgstr "Total Sin Descuento"
37 changes: 37 additions & 0 deletions sale_discount_display_amount/i18n/es_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_discount_display_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__discount_total
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__discount_total
msgid "Discount Subtotal"
msgstr ""

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

#. module: sale_discount_display_amount
#: model:ir.model,name:sale_discount_display_amount.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_discount_display_amount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order__price_total_no_discount
#: model:ir.model.fields,field_description:sale_discount_display_amount.field_sale_order_line__price_total_no_discount
msgid "Subtotal Without Discount"
msgstr ""
Loading
Loading