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

[17.0][MIG] purchase_packaging_report: Migration to 17.0 #77

Open
wants to merge 9 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
124 changes: 124 additions & 0 deletions purchase_packaging_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
=========================
Purchase Packaging Report
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8b7207332513658db9206dc6c00893ad62f07ff9132a5cf6947ba271d75ef6cf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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_packaging_report
: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_packaging_report
: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 displays packaging data (quantity and type) in:

- Purchase order printed reports.
- Purchase BI reports.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

#. Go to *Purchase > Configuration > Settings*. #. Enable *Product
Packagings*. #. Save.

Now, make sure the products you use for testing this module have some
packaging configured.

Usage
=====

To print purchase order packaging data:

#. Go to *Purchase > Orders > Quotations* and pick or create one. #. Add
some product(s) with packaging information (type and quantity). #. Print
it.

To query purchase packaging BI data:

#. Go to *Purchase > Reporting > Purchase*. #. Use the new options at
will:

- *Measures > Packaging Qty*
- *Group By > Packaging*.

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_packaging_report%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
-------

* Moduon

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

- Eduardo de Miguel (``Moduon <https://www.moduon.team/>``\ \_\_)

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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-Shide| image:: https://github.com/Shide.png?size=40px
:target: https://github.com/Shide
:alt: Shide

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

|maintainer-Shide|

This module is part of the `OCA/purchase-reporting <https://github.com/OCA/purchase-reporting/tree/17.0/purchase_packaging_report>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_packaging_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import report
24 changes: 24 additions & 0 deletions purchase_packaging_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2024 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

{
"name": "Purchase Packaging Report",
"summary": "Packaging data in purchase reports",
"version": "17.0.1.0.0",
"development_status": "Alpha",
"category": "Inventory/Purchase",
"website": "https://github.com/OCA/purchase-reporting",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["Shide"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"purchase",
],
"data": [
"report/purchase_report_views.xml",
"report/purchase_order_templates.xml",
"report/purchase_quotation_templates.xml",
],
}
52 changes: 52 additions & 0 deletions purchase_packaging_report/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-28 09:54+0000\n"
"PO-Revision-Date: 2024-05-28 11:54+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4.4\n"

#. module: purchase_packaging_report
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.report_purchaseorder_document
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.report_purchasequotation_document
msgid "<span>(</span>"
msgstr "<span>(</span>"

#. module: purchase_packaging_report
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.report_purchaseorder_document
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.report_purchasequotation_document
msgid "<span>)</span>"
msgstr ""
"<span>Correo electrónico</span>\n"
"<span> *</span>"

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_id
msgid "Packaging"
msgstr "Envase"

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_qty
msgid "Packaging Qty"
msgstr "Cantidad de Envases"

#. module: purchase_packaging_report
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.view_purchase_order_search
msgid "Product Packaging"
msgstr "Envase del Producto"

#. module: purchase_packaging_report
#: model:ir.model,name:purchase_packaging_report.model_purchase_report
msgid "Purchase Report"
msgstr "Informe de Compras"
37 changes: 37 additions & 0 deletions purchase_packaging_report/i18n/it.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:
# * purchase_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-06-04 15:39+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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.17\n"

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_id
msgid "Packaging"
msgstr "Imballaggio"

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_qty
msgid "Packaging Qty"
msgstr "Q.tà imballagio"

#. module: purchase_packaging_report
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.view_purchase_order_search
msgid "Product Packaging"
msgstr "Imballaggio prodotto"

#. module: purchase_packaging_report
#: model:ir.model,name:purchase_packaging_report.model_purchase_report
msgid "Purchase Report"
msgstr "Resoconto di acquisto"
34 changes: 34 additions & 0 deletions purchase_packaging_report/i18n/purchase_packaging_report.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_id
msgid "Packaging"
msgstr ""

#. module: purchase_packaging_report
#: model:ir.model.fields,field_description:purchase_packaging_report.field_purchase_report__product_packaging_qty
msgid "Packaging Qty"
msgstr ""

#. module: purchase_packaging_report
#: model_terms:ir.ui.view,arch_db:purchase_packaging_report.view_purchase_order_search
msgid "Product Packaging"
msgstr ""

#. module: purchase_packaging_report
#: model:ir.model,name:purchase_packaging_report.model_purchase_report
msgid "Purchase Report"
msgstr ""
3 changes: 3 additions & 0 deletions purchase_packaging_report/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
8 changes: 8 additions & 0 deletions purchase_packaging_report/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
To configure this module, you need to:

#. Go to *Purchase > Configuration > Settings*.
#. Enable *Product Packagings*.
#. Save.

Now, make sure the products you use for testing this module have some packaging
configured.
3 changes: 3 additions & 0 deletions purchase_packaging_report/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia
4 changes: 4 additions & 0 deletions purchase_packaging_report/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module displays packaging data (quantity and type) in:

- Purchase order printed reports.
- Purchase BI reports.
12 changes: 12 additions & 0 deletions purchase_packaging_report/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
To print purchase order packaging data:

#. Go to *Purchase > Orders > Quotations* and pick or create one.
#. Add some product(s) with packaging information (type and quantity).
#. Print it.

To query purchase packaging BI data:

#. Go to *Purchase > Reporting > Purchase*.
#. Use the new options at will:
- *Measures > Packaging Qty*
- *Group By > Packaging*.
1 change: 1 addition & 0 deletions purchase_packaging_report/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_report
19 changes: 19 additions & 0 deletions purchase_packaging_report/report/purchase_order_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_purchaseorder_document"
inherit_id="purchase.report_purchaseorder_document"
>
<xpath expr="//td/span[@t-field='line.product_qty']/.." position="inside">
<div
t-if="line.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="line.product_packaging_id" />:
<span t-field="line.product_packaging_qty" />
</div>
</xpath>
</template>
</odoo>
19 changes: 19 additions & 0 deletions purchase_packaging_report/report/purchase_quotation_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_purchasequotation_document"
inherit_id="purchase.report_purchasequotation_document"
>
<xpath expr="//td/span[@t-field='order_line.product_qty']/.." position="inside">
<div
t-if="order_line.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="order_line.product_packaging_id" />:
<span t-field="order_line.product_packaging_qty" />
</div>
</xpath>
</template>
</odoo>
38 changes: 38 additions & 0 deletions purchase_packaging_report/report/purchase_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)


from odoo import fields, models


class PurchaseReport(models.Model):
_inherit = "purchase.report"

product_packaging_id = fields.Many2one(
"product.packaging",
string="Packaging",
readonly=True,
)
product_packaging_qty = fields.Float(
string="Packaging Qty",
readonly=True,
)

def _select(self):
result = super()._select()
return f"""
{result},
l.product_packaging_id AS product_packaging_id,
SUM(l.product_packaging_qty) AS product_packaging_qty
"""

def _from(self):
result = super()._from()
return f"""
{result}
LEFT JOIN product_packaging ON l.product_packaging_id = product_packaging.id
"""

def _group_by(self):
result = super()._group_by()
return f"{result}, l.product_packaging_id"
Loading