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 committed Sep 14, 2023
1 parent c4d2e54 commit 10cf030
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 9 deletions.
5 changes: 4 additions & 1 deletion 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:e21382b902ec20c35d54796dca6229acfcbe884bcbc853d57db157dd8da17742
!! source digest: sha256:b8f5751d5a54623c56c41d0264ef8c3764328fa33af00e1c26294068740d9b39
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -44,6 +44,7 @@ Configuration
To configure this module, you need to:

#. 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,6 +81,8 @@ Contributors
* Abraham Anes <[email protected]>
* Chafique Delli <[email protected]>
* Manuel Regidor <[email protected]>
* PyTech srl <[email protected]>
* Ooops404 <[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": "14.0.1.3.0",
"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",
"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
@@ -1,2 +1,4 @@
from . import sale_order
from . import sale_order_line
from . import res_company
from . import res_config_settings
7 changes: 7 additions & 0 deletions sale_discount_display_amount/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

report_total_without_discount = fields.Boolean("Report Total Without Discount")
9 changes: 9 additions & 0 deletions sale_discount_display_amount/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

report_total_without_discount = fields.Boolean(
related="company_id.report_total_without_discount", readonly=False
)
1 change: 1 addition & 0 deletions sale_discount_display_amount/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
To configure this module, you need to:

#. 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.
2 changes: 2 additions & 0 deletions sale_discount_display_amount/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
* Abraham Anes <[email protected]>
* Chafique Delli <[email protected]>
* Manuel Regidor <[email protected]>
* PyTech SRL <[email protected]>
* Ooops404 <[email protected]>
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>
5 changes: 4 additions & 1 deletion 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:e21382b902ec20c35d54796dca6229acfcbe884bcbc853d57db157dd8da17742
!! 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/14.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-14-0/sale-workflow-14-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=14.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 the
Expand All @@ -393,6 +393,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>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 @@ -427,6 +428,8 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Abraham Anes &lt;<a class="reference external" href="mailto:abrahamanes&#64;gmail.com">abrahamanes&#64;gmail.com</a>&gt;</li>
<li>Chafique Delli &lt;<a class="reference external" href="mailto:chafique.delli&#64;akretion.com">chafique.delli&#64;akretion.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>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 10cf030

Please sign in to comment.