Skip to content

Commit 3241ce9

Browse files
[ADD] purchase_report_discount_visibility
1 parent 2fc864e commit 3241ce9

File tree

12 files changed

+617
-0
lines changed

12 files changed

+617
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
===================================
2+
Purchase Report Discount Visibility
3+
===================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:05dac72a6e6696a83805350b894a8e6e1060336c5cdee57062a239faa1bc4885
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--reporting-lightgray.png?logo=github
20+
:target: https://github.com/OCA/purchase-reporting/tree/18.0/purchase_report_discount_visibility
21+
:alt: OCA/purchase-reporting
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/purchase-reporting-18-0/purchase-reporting-18-0-purchase_report_discount_visibility
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-reporting&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module hides the Discount column in the Purchase Order report if
32+
all order lines have no discount applied.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Bug Tracker
40+
===========
41+
42+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-reporting/issues>`_.
43+
In case of trouble, please check there if your issue has already been reported.
44+
If you spotted it first, help us to smash it by providing a detailed and welcomed
45+
`feedback <https://github.com/OCA/purchase-reporting/issues/new?body=module:%20purchase_report_discount_visibility%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
46+
47+
Do not contact contributors directly about support or help with technical issues.
48+
49+
Credits
50+
=======
51+
52+
Authors
53+
-------
54+
55+
* Quartile
56+
57+
Contributors
58+
------------
59+
60+
- `Quartile <https://www.quartile.co>`__:
61+
62+
- Aung Ko Ko Lin
63+
64+
Maintainers
65+
-----------
66+
67+
This module is maintained by the OCA.
68+
69+
.. image:: https://odoo-community.org/logo.png
70+
:alt: Odoo Community Association
71+
:target: https://odoo-community.org
72+
73+
OCA, or the Odoo Community Association, is a nonprofit organization whose
74+
mission is to support the collaborative development of Odoo features and
75+
promote its widespread use.
76+
77+
.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
78+
:target: https://github.com/yostashiro
79+
:alt: yostashiro
80+
.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px
81+
:target: https://github.com/aungkokolin1997
82+
:alt: aungkokolin1997
83+
84+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
85+
86+
|maintainer-yostashiro| |maintainer-aungkokolin1997|
87+
88+
This module is part of the `OCA/purchase-reporting <https://github.com/OCA/purchase-reporting/tree/18.0/purchase_report_discount_visibility>`_ project on GitHub.
89+
90+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2026 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Purchase Report Discount Visibility",
5+
"summary": "Configure visibility of discount column in purchase reports",
6+
"version": "18.0.1.0.0",
7+
"category": "Reporting",
8+
"license": "AGPL-3",
9+
"website": "https://github.com/OCA/purchase-reporting",
10+
"author": "Quartile, Odoo Community Association (OCA)",
11+
"depends": ["purchase"],
12+
"data": [
13+
"report/purchase_report_templates.xml",
14+
],
15+
"maintainers": ["yostashiro", "aungkokolin1997"],
16+
"installable": True,
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import purchase_order
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2026 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class PurchaseOrder(models.Model):
8+
_inherit = "purchase.order"
9+
10+
def _should_hide_discount_column(self):
11+
self.ensure_one()
12+
return not any(line.discount for line in self.order_line)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Quartile](https://www.quartile.co):
2+
- Aung Ko Ko Lin
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module hides the Discount column in the Purchase Order report if all order lines have
2+
no discount applied.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<template
4+
id="report_purchaseorder_document_hide_discount"
5+
inherit_id="purchase.report_purchaseorder_document"
6+
>
7+
<xpath expr="//div[@id='informations']" position="after">
8+
<t
9+
t-set="hide_discount_column"
10+
t-value="o._should_hide_discount_column()"
11+
/>
12+
</xpath>
13+
<xpath expr="//th[@name='th_discount']" position="attributes">
14+
<attribute name="t-if">not hide_discount_column</attribute>
15+
</xpath>
16+
<xpath expr="//td[span/span[@t-field='line.discount']]" position="attributes">
17+
<attribute name="t-if">not hide_discount_column</attribute>
18+
</xpath>
19+
</template>
20+
</odoo>

0 commit comments

Comments
 (0)