Skip to content

Commit

Permalink
[IMP] sale_discount_display_amount: add total without discount in report
Browse files Browse the repository at this point in the history
  • Loading branch information
renda-dev authored and henrybackman committed Oct 9, 2024
1 parent f8ce23c commit ebe39bf
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 25 deletions.
23 changes: 12 additions & 11 deletions sale_discount_display_amount/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sale Discount Display Amount
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b59683db12bdd36f5bf6f7d1cf976b0182658afc00567ad84b3bba6c02f5952c
!! source digest: sha256:b8f5751d5a54623c56c41d0264ef8c3764328fa33af00e1c26294068740d9b39
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -45,9 +45,8 @@ Configuration

To configure this module, you need to:

1. Go to Sales/Settings and check "Allow discounts on sales order lines"
2. Go to Sales/Settings and check or uncheck "Show the Discount with
TAX" depending on your needs
#. Go to Sales/Settings and check "Allow discounts on sales order lines"
#. Also check "Display Total without discount in report" in order to add this field to report.

Usage
=====
Expand Down Expand Up @@ -80,14 +79,16 @@ Authors
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>`__:
* Cédric Pigeon <[email protected]>
* Abraham Anes <[email protected]>
* Chafique Delli <[email protected]>
* Ruchir Shukla <[email protected]>
* Manuel Regidor <[email protected]>
* PyTech srl <[email protected]>
* Ooops404 <[email protected]>
* `Pesol <https://www.pesol.es>`__:

- Jonathan Oscategui Taza <[email protected]>
* Jonathan Oscategui Taza <[email protected]>

Maintainers
-----------
Expand Down
3 changes: 2 additions & 1 deletion sale_discount_display_amount/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
sale_order_line and sale_order level""",
"version": "17.0.1.0.1",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale_management"],
"data": [
"views/res_config_settings_view.xml",
"views/sale_view.xml",
"views/res_config_settings_views.xml",
"report/sale_report_template.xml"
Expand Down
2 changes: 2 additions & 0 deletions sale_discount_display_amount/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
from . import res_config_settings
from . import sale_order
from . import sale_order_line
from . import res_company
from . import res_config_settings
1 change: 1 addition & 0 deletions sale_discount_display_amount/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
class ResCompany(models.Model):
_inherit = "res.company"

report_total_without_discount = fields.Boolean("Report Total Without Discount")
display_discount_with_tax = fields.Boolean(Name="Show the Discount with TAX")
3 changes: 3 additions & 0 deletions sale_discount_display_amount/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

report_total_without_discount = fields.Boolean(
related="company_id.report_total_without_discount", readonly=False
)
display_discount_with_tax = fields.Boolean(
Name="Show the Discount with TAX",
help="Check this field to show the Discount with TAX",
Expand Down
26 changes: 20 additions & 6 deletions sale_discount_display_amount/report/sale_report_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,26 @@
inherit_id="sale.report_saleorder_document"
>
<xpath expr="//tr[hasclass('o_total')]" position="before">
<tr class="border-black" groups="product.group_discount_per_so_line">
<td name="td_discount_total_label"><strong>Discount</strong></td>
<td name="td_discount_total" class="text-right">
<span t-field="doc.discount_total" />
</td>
</tr>
<t groups="product.group_discount_per_so_line" t-if="doc.discount_total">
<tr class="border-black">
<td name="td_discount_total_label">
<strong>Discount</strong>
</td>
<td name="td_discount_total" class="text-right">
<span t-field="doc.discount_total" />
</td>
</tr>
<tr
t-if="doc.company_id.report_total_without_discount and doc.price_total_no_discount != doc.amount_total"
>
<td name="td_total_without_discount_label">
<strong>Total Without Discount</strong>
</td>
<td name="td_total_without_discount" class="text-right">
<span t-field="doc.price_total_no_discount" />
</td>
</tr>
</t>
</xpath>
</template>
</odoo>
11 changes: 4 additions & 7 deletions sale_discount_display_amount/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Sale Discount Display Amount</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b59683db12bdd36f5bf6f7d1cf976b0182658afc00567ad84b3bba6c02f5952c
!! source digest: sha256:b8f5751d5a54623c56c41d0264ef8c3764328fa33af00e1c26294068740d9b39
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_discount_display_amount"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_discount_display_amount"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>In standard Odoo only display the rate of the discount applied, never
Expand Down Expand Up @@ -395,8 +395,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to Sales/Settings and check “Allow discounts on sales order lines”</li>
<li>Go to Sales/Settings and check or uncheck “Show the Discount with
TAX” depending on your needs</li>
<li>Also check “Display Total without discount in report” in order to add this field to report.</li>
</ol>
</div>
<div class="section" id="usage">
Expand Down Expand Up @@ -433,10 +432,8 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Chafique Delli &lt;<a class="reference external" href="mailto:chafique.delli&#64;akretion.com">chafique.delli&#64;akretion.com</a>&gt;</li>
<li>Ruchir Shukla &lt;<a class="reference external" href="mailto:ruchir&#64;bizzappdev.com">ruchir&#64;bizzappdev.com</a>&gt;</li>
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
<li><a class="reference external" href="https://www.pesol.es">Pesol</a>:<ul>
<li>Jonathan Oscategui Taza &lt;<a class="reference external" href="mailto:info&#64;pesol.es">info&#64;pesol.es</a>&gt;</li>
</ul>
</li>
<li>PyTech srl &lt;<a class="reference external" href="mailto:info&#64;pytech.it">info&#64;pytech.it</a>&gt;</li>
<li>Ooops404 &lt;<a class="reference external" href="mailto:info&#64;ooops404.com">info&#64;ooops404.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
28 changes: 28 additions & 0 deletions sale_discount_display_amount/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.sale</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="10" />
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='proforma_configuration']" position="after">
<div
class="col-12 col-lg-6 o_setting_box"
id="report_total_without_discount_configuration"
>
<div class="o_setting_left_pane">
<field name="report_total_without_discount" />
</div>
<div class="o_setting_right_pane">
<label for="report_total_without_discount" />
<div class="text-muted">
Display "Total without discount" in report
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

0 comments on commit ebe39bf

Please sign in to comment.