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

[MIG] sale_discount_display_amount: Migration to 17.0 #3026

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6a66157
[ADD] add new module to display discount amount on sale orders
Sep 14, 2018
b88907d
[UPD] Update sale_discount_display_amount.pot
oca-travis Sep 18, 2018
0853d60
[UPD] README.rst
OCA-git-bot Sep 19, 2018
95bc881
Added translation using Weblate (French)
Oct 10, 2018
cd1efae
Added translation using Weblate (Spanish)
Oct 10, 2018
9af07f6
[12.0][MIG] sale_discount_display_amount
Abranes Apr 4, 2019
4be8431
[UPD] README.rst
OCA-git-bot Jun 11, 2019
48beb1c
[UPD] Update sale_discount_display_amount.pot
oca-travis Jun 11, 2019
ab4c8c2
Update translation files
oca-transbot Jun 16, 2019
6b9c56f
Added translation using Weblate (German)
marylla Jul 15, 2019
af016a1
Translated using Weblate (German)
marylla Jul 15, 2019
9bb7adc
[UPD] README.rst
OCA-git-bot Jul 29, 2019
9683b24
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
c5b7a46
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
5cd1a3e
[IMP] sale_discount_display_amount: black, isort
Oct 18, 2019
03b9621
[MIG] sale_discount_display_amount: Migration to 13.0
Oct 18, 2019
26104ca
[MIG] sale_discount_display_amount: Computed values must be reset by …
lmignon Oct 29, 2019
0f25030
[IMP] sale_discount_display_amount rename view
Dec 11, 2019
fd2bb41
[UPD] Update sale_discount_display_amount.pot
oca-travis Dec 11, 2019
1d7f05c
[UPD] README.rst
OCA-git-bot Dec 11, 2019
6982e36
Update translation files
oca-transbot Jan 3, 2020
4377aba
pre-commit update
OCA-git-bot Mar 14, 2020
bf6d6d8
[FIX] sale_discount_display_amount: Guidelines in compute methods names
pedrobaeza Jun 8, 2020
ff09d8a
Translated using Weblate (Spanish)
danimv5 Jul 27, 2020
8fe1067
[MIG] sale_discount_display_amount: Migration to 14.0
chafique-delli Oct 12, 2020
9dd0071
[UPD] Update sale_discount_display_amount.pot
oca-travis Jan 25, 2021
e63ae11
[UPD] README.rst
OCA-git-bot Jan 25, 2021
89033f2
sale_discount_display_amount 14.0.1.0.1
OCA-git-bot Jan 25, 2021
5634baf
Added translation using Weblate (Dutch)
bosd Jan 25, 2021
1a7ba39
Translated using Weblate (Dutch)
bosd Jan 25, 2021
6cb2a74
Added translation using Weblate (Catalan)
danimv5 Feb 23, 2021
a0518ff
Translated using Weblate (Catalan)
danimv5 Feb 23, 2021
8994355
Translated using Weblate (German)
marylla Jul 9, 2021
bd73835
sale_discount_display_amount: fix init hook
simahawk Jul 14, 2021
23747c5
sale_discount_display_amount 14.0.1.0.2
OCA-git-bot Jul 22, 2021
484fca0
[14.0][IMP] sale_discount_display_amount: Adds hook for depends
rousseldenis Aug 30, 2021
9408b20
sale_discount_display_amount 14.0.1.0.3
OCA-git-bot Nov 26, 2021
a20140a
Added translation using Weblate (Italian)
francesco-ooops Jan 21, 2022
f7659c3
Translated using Weblate (Italian)
francesco-ooops Jan 21, 2022
b7807d3
[MIG]sale_discount_display_amount: Migration to 15.0
manuelregidor Jun 1, 2022
6823bbf
[UPD] Update sale_discount_display_amount.pot
Jun 2, 2022
e31d01a
[UPD] README.rst
OCA-git-bot Jun 2, 2022
7469f9a
sale_discount_display_amount 15.0.1.0.1
OCA-git-bot Jun 2, 2022
cb7ea40
Translated using Weblate (Italian)
mymage Mar 23, 2023
1122e37
[MIG] sale_discount_display_amount: Migration to 16.0
Mar 29, 2023
917823e
[UPD] Update sale_discount_display_amount.pot
Jun 7, 2023
434dc9d
[UPD] README.rst
OCA-git-bot Jun 7, 2023
608da57
Update translation files
weblate Jun 7, 2023
38db790
Translated using Weblate (Italian)
francesco-ooops Aug 31, 2023
bfc270e
[UPD] README.rst
OCA-git-bot Sep 3, 2023
c8118c6
[MIG] sale_discount_display_amount: Migration to 17.0
FSchiepers Mar 18, 2024
e0d9ff6
Update __manifest__.py
FSchiepers Mar 19, 2024
d3b4780
Update hooks.py
FSchiepers Mar 19, 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
FSchiepers marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[IMP]sale_discount_display_amount: : renamed Logger to _logger

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