Skip to content

Commit

Permalink
[16.0][ADD] stock_picking_packaging_report: Stock picking packaging r…
Browse files Browse the repository at this point in the history
…eport.
  • Loading branch information
alfredoavanzosc committed Dec 10, 2024
1 parent bc8ef4b commit 93cba1d
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_picking_packaging_report/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
28 changes: 28 additions & 0 deletions stock_picking_packaging_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==============================
Stock picking packaging report
==============================

* In stock picking report print packaging.

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

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

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

* Ana Juaristi <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
1 change: 1 addition & 0 deletions stock_picking_packaging_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions stock_picking_packaging_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Picking Packaging Report",
"version": "16.0.1.0.0",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/odoo-addons",
"category": "Inventory/Inventory",
"license": "AGPL-3",
"depends": [
"stock_move_qty_by_packaging",
],
"data": [
"report/report_deliveryslip.xml",
],
"installable": True,
}
21 changes: 21 additions & 0 deletions stock_picking_packaging_report/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 11:12+0000\n"
"PO-Revision-Date: 2024-12-10 11:12+0000\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: stock_picking_packaging_report
#: model:ir.model,name:stock_picking_packaging_report.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Moviment del producte (línia de moviment d'estoc)"
21 changes: 21 additions & 0 deletions stock_picking_packaging_report/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 11:12+0000\n"
"PO-Revision-Date: 2024-12-10 11:12+0000\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: stock_picking_packaging_report
#: model:ir.model,name:stock_picking_packaging_report.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""
21 changes: 21 additions & 0 deletions stock_picking_packaging_report/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 11:13+0000\n"
"PO-Revision-Date: 2024-12-10 11:13+0000\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: stock_picking_packaging_report
#: model:ir.model,name:stock_picking_packaging_report.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Stock Move Line)"
21 changes: 21 additions & 0 deletions stock_picking_packaging_report/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 11:12+0000\n"
"PO-Revision-Date: 2024-12-10 11:12+0000\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: stock_picking_packaging_report
#: model:ir.model,name:stock_picking_packaging_report.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Mouvements de stock"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_packaging_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 11:11+0000\n"
"PO-Revision-Date: 2024-12-10 11:11+0000\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: stock_picking_packaging_report
#: model:ir.model,name:stock_picking_packaging_report.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""
1 change: 1 addition & 0 deletions stock_picking_packaging_report/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move_line
28 changes: 28 additions & 0 deletions stock_picking_packaging_report/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

def _get_aggregated_product_quantities(self, **kwargs):
result = super()._get_aggregated_product_quantities(**kwargs)
for clave in result.keys():
for move_line in self.filtered(
lambda x: x.move_id and x.qty_done and x.product_packaging_id
):
line_key = self._generate_keys_to_found()
if line_key in clave:
result[clave]["product_packaging"] = move_line.product_packaging_id
return result

def _generate_keys_to_found(self):
uom = self.product_uom_id
name = self.product_id.display_name
description = self.move_id.description_picking
product = self.product_id
if description == name or description == self.product_id.name:
description = False
line_key = f'{product.id}_{product.display_name}_{description or ""}_{uom.id}'
return line_key
73 changes: 73 additions & 0 deletions stock_picking_packaging_report/report/report_deliveryslip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_delivery_document" inherit_id="stock.report_delivery_document">
<xpath expr="//td/span[@t-field='move.product_uom_qty']/.." position="inside">
<div
t-if="move.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="move.product_packaging_id.name" />
</div>
</xpath>
<xpath expr="//td/span[@t-field='move.quantity_done']/.." position="inside">
<div
t-if="move.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="move.product_packaging_id.name" />
</div>
</xpath>
<xpath
expr="//td/span[@t-field='bo_line.product_uom_qty']/.."
position="inside"
>
<div
t-if="bo_line.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="bo_line.product_packaging_id.name" />
</div>
</xpath>
</template>

<template
id="stock_report_delivery_has_serial_move_line"
inherit_id="stock.stock_report_delivery_has_serial_move_line"
>
<xpath expr="//td/span[@t-field='move_line.qty_done']/.." position="inside">
<div
t-if="move_line.product_packaging_id"
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-field="move_line.product_packaging_id.name" />
</div>
</xpath>
</template>

<template
id="stock_report_delivery_aggregated_move_lines"
inherit_id="stock.stock_report_delivery_aggregated_move_lines"
>
<t t-if="aggregated_lines[line]['qty_done']" position="after">
<t
t-if="aggregated_lines[line]['qty_done'] and aggregated_lines[line]['product_packaging']"
>
<div
groups="product.group_stock_packaging"
class="text-secondary"
style="white-space: nowrap;"
>
<span t-esc="aggregated_lines[line]['product_packaging'].name" />
</div>
</t>
</t>
</template>
</odoo>

0 comments on commit 93cba1d

Please sign in to comment.