Skip to content
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 sale_packaging_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
=====================
Sale Packaging Report
=====================

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

.. |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%2Fsale--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/sale-reporting/tree/17.0/sale_packaging_report
:alt: OCA/sale-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-reporting-17-0/sale-reporting-17-0-sale_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/sale-reporting&target_branch=17.0
:alt: Try me on Runboat

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

This module displays packaging data (quantity and type) in:

- Sale order printed reports.
- Sale 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:

1. Go to *Sales > Configuration > Settings*.
2. Enable *Product Packagings*.
3. Save.

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

Usage
=====

To print sale order packaging data:

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

To query sale packaging BI data:

1. Go to *Sales > Reporting*.
2. Use the new options at will:

- *Measures > Packaging Qty*
- *Measures > Packaging Delivered Qty* (based on a ratio between *Qty
Delivered* and *Packaging Qty*).
- *Group By > Packaging*.

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

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

- Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

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

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

|maintainer-yajo|

This module is part of the `OCA/sale-reporting <https://github.com/OCA/sale-reporting/tree/17.0/sale_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 sale_packaging_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import report
21 changes: 21 additions & 0 deletions sale_packaging_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

{
"name": "Sale Packaging Report",
"summary": "Packaging data in sale reports",
"version": "17.0.1.0.0",
"development_status": "Alpha",
"category": "Sales",
"website": "https://github.com/OCA/sale-reporting",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["yajo"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["sale"],
"data": [
"report/sale_report_view.xml",
"views/report_sale_order.xml",
],
}
39 changes: 39 additions & 0 deletions sale_packaging_report/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-08 10:27+0000\n"
"PO-Revision-Date: 2023-09-08 11:27+0100\n"
"Last-Translator: Jairo Llopis <[email protected]>\n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.3.1\n"

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_id
#: model_terms:ir.ui.view,arch_db:sale_packaging_report.view_order_product_search_inherit_sale
msgid "Packaging"
msgstr "Envase"

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_qty_delivered
msgid "Packaging Delivered Qty"
msgstr "Cant. de envases entregados"

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_qty
msgid "Packaging Qty"
msgstr "Cant. de envases"

#. module: sale_packaging_report
#: model:ir.model,name:sale_packaging_report.model_sale_report
msgid "Sales Analysis Report"
msgstr "Informe de análisis de ventas"
38 changes: 38 additions & 0 deletions sale_packaging_report/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-12 11:34+0000\n"
"Last-Translator: mymage <[email protected]>\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: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_id
#: model_terms:ir.ui.view,arch_db:sale_packaging_report.view_order_product_search_inherit_sale
msgid "Packaging"
msgstr "Imballaggio"

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_qty_delivered
msgid "Packaging Delivered Qty"
msgstr "Q.tà consegnata imballaggio"

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

#. module: sale_packaging_report
#: model:ir.model,name:sale_packaging_report.model_sale_report
msgid "Sales Analysis Report"
msgstr "Resoconto analisi vendite"
35 changes: 35 additions & 0 deletions sale_packaging_report/i18n/sale_packaging_report.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_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: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_id
#: model_terms:ir.ui.view,arch_db:sale_packaging_report.view_order_product_search_inherit_sale
msgid "Packaging"
msgstr ""

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_qty_delivered
msgid "Packaging Delivered Qty"
msgstr ""

#. module: sale_packaging_report
#: model:ir.model.fields,field_description:sale_packaging_report.field_sale_report__product_packaging_qty
msgid "Packaging Qty"
msgstr ""

#. module: sale_packaging_report
#: model:ir.model,name:sale_packaging_report.model_sale_report
msgid "Sales Analysis Report"
msgstr ""
3 changes: 3 additions & 0 deletions sale_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 sale_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:

1. Go to *Sales \> Configuration \> Settings*.
2. Enable *Product Packagings*.
3. Save.

Now, make sure the products you use for testing this module have some
packaging configured.
2 changes: 2 additions & 0 deletions sale_packaging_report/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Jairo Llopis ([Moduon](https://www.moduon.team/))
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
4 changes: 4 additions & 0 deletions sale_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:

- Sale order printed reports.
- Sale BI reports.
14 changes: 14 additions & 0 deletions sale_packaging_report/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
To print sale order packaging data:

1. Go to *Sales \> Orders \> Quotations* and pick or create one.
2. Add some product(s) with packaging information (type and quantity).
3. Print it.

To query sale packaging BI data:

1. Go to *Sales \> Reporting*.
2. Use the new options at will:
- *Measures \> Packaging Qty*
- *Measures \> Packaging Delivered Qty* (based on a ratio between
*Qty Delivered* and *Packaging Qty*).
- *Group By \> Packaging*.
1 change: 1 addition & 0 deletions sale_packaging_report/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_report
50 changes: 50 additions & 0 deletions sale_packaging_report/report/sale_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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 Name(models.AbstractModel):
_inherit = "sale.report"

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

def _select_additional_fields(self):
result = super()._select_additional_fields()
return dict(
result,
product_packaging_id="l.product_packaging_id",
product_packaging_qty="SUM(l.product_packaging_qty)",
product_packaging_qty_delivered="""
COALESCE(
SUM(
l.qty_delivered
/ u.factor * u2.factor
/ product_packaging.qty
),
0
)
""",
)

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

def _group_by_sale(self):
result = super()._group_by_sale()
return f"{result}, l.product_packaging_id"
26 changes: 26 additions & 0 deletions sale_packaging_report/report/sale_report_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Moduon Team S.L.
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) -->
<data>
<record id="view_order_product_search_inherit_sale" model="ir.ui.view">
<field name="name">Sale report: search packagings</field>
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.view_order_product_search" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field
name="product_packaging_id"
groups="product.group_stock_packaging"
/>
</field>
<filter name="Category" position="after">
<filter
name="groupby_product_packaging_id"
string="Packaging"
context="{'group_by': 'product_packaging_id'}"
groups="product.group_stock_packaging"
/>
</filter>
</field>
</record>
</data>
Binary file added sale_packaging_report/static/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.
Loading
Loading