Skip to content

Commit

Permalink
[ADD] purchase_report_hide_line
Browse files Browse the repository at this point in the history
  • Loading branch information
Tisho99 committed Feb 27, 2025
1 parent 906c5f1 commit 83dae43
Show file tree
Hide file tree
Showing 22 changed files with 635 additions and 0 deletions.
119 changes: 119 additions & 0 deletions purchase_report_hide_line/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
=========================
Purchase Report Hide Line
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c523933364f30a3e66836f22380d47950e1818449962ea2a3e1d49ce97ace36c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fpurchase--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-reporting/tree/17.0/purchase_report_hide_line
:alt: OCA/purchase-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-reporting-17-0/purchase-reporting-17-0-purchase_report_hide_line
: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/purchase-reporting&target_branch=17.0
:alt: Try me on Runboat

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

This module allows you to hide purchase order lines from the Purchase
Report.

You will be able to configure which lines will be hidden by default,
having 3 different options to choose:

- Don't hide any line by default
- Hide lines with quantity equal to 0
- Hide lines with price subtotal equal to 0

You will also be able to manually edit whose lines will be hidden in the
purcase order form

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

1. Go to Purchase / Configuration / Settings
2. In the "Orders" section, search the "Purchase Hide In Report Default"
and set your desired default option

Usage
=====

To use this module, you need to:

1. Go to Purchase / Orders / Requests for Quotation
2. Create a new purchase
3. Add a product, you will see a new column "Hide In Report" in the
purchase order line.
4. Set the value to True if it is not set by default
5. Print the "Purchase Order" report, you will see that the selected
line does not appear in the report.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-reporting/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/purchase-reporting/issues/new?body=module:%20purchase_report_hide_line%0Aversion:%2017.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
-------

* Sygel

Contributors
------------

- Alberto Martínez alberto.martinez@sygel.es
- Valentin Vinagre valentin.vinagre@sygel.es
- Harald Panten harald.panten@sygel.es

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.

.. |maintainer-tisho99| image:: https://github.com/tisho99.png?size=40px
:target: https://github.com/tisho99
:alt: tisho99

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-tisho99|

This module is part of the `OCA/purchase-reporting <https://github.com/OCA/purchase-reporting/tree/17.0/purchase_report_hide_line>`_ 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 purchase_report_hide_line/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
22 changes: 22 additions & 0 deletions purchase_report_hide_line/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase Report Hide Line",
"summary": "Hide purchase order lines from the Purchase Report",
"version": "17.0.1.0.0",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-reporting",
"author": "Sygel, Odoo Community Association (OCA)",
"maintainers": ["tisho99"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"purchase",
],
"data": [
"views/report_purchase.xml",
"views/purchase_order_views.xml",
"views/res_config_settings.xml",
],
}
Binary file added purchase_report_hide_line/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions purchase_report_hide_line/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions purchase_report_hide_line/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import purchase_order_line
from . import res_company
from . import res_config_settings
25 changes: 25 additions & 0 deletions purchase_report_hide_line/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

hide_in_report = fields.Boolean(
compute="_compute_hide_in_report", store=True, readonly=False
)

@api.depends("company_id", "product_qty", "price_unit")
def _compute_hide_in_report(self):
for rec in self:
if rec.company_id.purchase_hide_in_report_default != "none":
field = (
"product_qty"
if rec.company_id.purchase_hide_in_report_default == "quantity"
else "price_subtotal"
)
rec.hide_in_report = not rec[field]
else:
rec.hide_in_report = False
18 changes: 18 additions & 0 deletions purchase_report_hide_line/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

purchase_hide_in_report_default = fields.Selection(
selection=[
("none", "None"),
("quantity", "Quantity equal to 0"),
("price", "Price equal to 0"),
],
required=True,
default="none",
)
13 changes: 13 additions & 0 deletions purchase_report_hide_line/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

purchase_hide_in_report_default = fields.Selection(
related="company_id.purchase_hide_in_report_default",
readonly=False,
)
3 changes: 3 additions & 0 deletions purchase_report_hide_line/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions purchase_report_hide_line/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To configure this module, you need to:

1. Go to Purchase / Configuration / Settings
2. In the "Orders" section, search the "Purchase Hide In Report Default" and set your desired default option
3 changes: 3 additions & 0 deletions purchase_report_hide_line/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Alberto Martínez <alberto.martinez@sygel.es>
- Valentin Vinagre <valentin.vinagre@sygel.es>
- Harald Panten <harald.panten@sygel.es>
9 changes: 9 additions & 0 deletions purchase_report_hide_line/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

This module allows you to hide purchase order lines from the Purchase Report.

You will be able to configure which lines will be hidden by default, having 3 different options to choose:
- Don't hide any line by default
- Hide lines with quantity equal to 0
- Hide lines with price subtotal equal to 0

You will also be able to manually edit whose lines will be hidden in the purcase order form
7 changes: 7 additions & 0 deletions purchase_report_hide_line/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module, you need to:

1. Go to Purchase / Orders / Requests for Quotation
2. Create a new purchase
3. Add a product, you will see a new column "Hide In Report" in the purchase order line.
4. Set the value to True if it is not set by default
5. Print the "Purchase Order" report, you will see that the selected line does not appear in the report.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions purchase_report_hide_line/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions purchase_report_hide_line/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Module name</h2>
<p>This module was written to extend the functionality of ... to support ... and allow you to ...</p>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Installation</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To install this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Configuration</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To configure this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Usage</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To use this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
<p class="oe_mt32">For further information, please visit:
<ul>
<li><a href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Known issues / Roadmap</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span12">
<h2 class="oe_slogan">Credits</h2>
</div>
<div class="oe_span12">
<h3>Contributors</h3>
<ul>
<li>Firstname Lastname &lt;<a href="mailto:email.address@example.com">email.address@example.com</a>&gt;</li>
</ul>
</div>
<div class="oe_span12">
<h3>Maintainer</h3>
<p>
This module is maintained by the OCA.<br/>
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.<br/>
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/>
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a>
</p>
</div>
</div>
</section>
3 changes: 3 additions & 0 deletions purchase_report_hide_line/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import test_purchase_report_hide_line
Loading

0 comments on commit 83dae43

Please sign in to comment.