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
77 changes: 77 additions & 0 deletions account_move_report_secondary_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
==================================
Account Move Report Secondary Unit
==================================

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

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

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

Show the secondary unit of measure and the secondary quantity in invoice
reports

**Table of contents**

.. contents::
:local:

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

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

* Solvos

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

- Iria Alonso <iria.alonso@solvos.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.

This module is part of the `OCA/account-invoice-reporting <https://github.com/OCA/account-invoice-reporting/tree/18.0/account_move_report_secondary_unit>`_ 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 account_move_report_secondary_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions account_move_report_secondary_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# © 2026 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Account Move Report Secondary Unit",
"summary": """
Show the secondary unit of measure and the secondary quantity in invoice reports
""",
"author": "Solvos, Odoo Community Association (OCA)",
"license": "AGPL-3",
"version": "18.0.1.0.0",
"category": "Sales/Sales",
"website": "https://github.com/OCA/account-invoice-reporting",
"depends": ["sale_order_secondary_unit"],
"data": ["report/report_invoice_document.xml"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_report_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-08 13:40+0000\n"
"PO-Revision-Date: 2025-04-08 13:40+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: account_move_report_secondary_unit
#: model_terms:ir.ui.view,arch_db:account_move_report_secondary_unit.report_invoice_document
msgid "<span>Second. Qty</span>"
msgstr ""

#. module: account_move_report_secondary_unit
#: model:ir.model,name:account_move_report_secondary_unit.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: account_move_report_secondary_unit
#: model:ir.model.fields,field_description:account_move_report_secondary_unit.field_account_move_line__secondary_uom_id
msgid "Secondary Uom"
msgstr ""

#. module: account_move_report_secondary_unit
#: model:ir.model.fields,field_description:account_move_report_secondary_unit.field_account_move_line__secondary_uom_qty
msgid "Secondary Uom Qty"
msgstr ""
36 changes: 36 additions & 0 deletions account_move_report_secondary_unit/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_report_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-08 13:40+0000\n"
"PO-Revision-Date: 2025-04-08 13:40+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: account_move_report_secondary_unit
#: model_terms:ir.ui.view,arch_db:account_move_report_secondary_unit.report_invoice_document
msgid "<span>Second. Qty</span>"
msgstr "<span>Cant. sec.</span>"

#. module: account_move_report_secondary_unit
#: model:ir.model,name:account_move_report_secondary_unit.model_account_move_line
msgid "Journal Item"
msgstr "Apunte contable"

#. module: account_move_report_secondary_unit
#: model:ir.model.fields,field_description:account_move_report_secondary_unit.field_account_move_line__secondary_uom_id
msgid "Secondary Uom"
msgstr ""

#. module: account_move_report_secondary_unit
#: model:ir.model.fields,field_description:account_move_report_secondary_unit.field_account_move_line__secondary_uom_qty
msgid "Secondary Uom Qty"
msgstr ""
1 change: 1 addition & 0 deletions account_move_report_secondary_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_line
33 changes: 33 additions & 0 deletions account_move_report_secondary_unit/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# © 2026 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, fields, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

secondary_uom_id = fields.Many2one(
comodel_name="product.secondary.unit",
compute="_compute_secondary_uom_id",
)

secondary_uom_qty = fields.Float(
compute="_compute_secondary_uom_id", digits="Product Unit of Measure"
)

@api.depends(
"product_id.sale_secondary_uom_id",
"product_id.sale_secondary_uom_id.factor",
"sale_line_ids.secondary_uom_id",
)
def _compute_secondary_uom_id(self):
for record in self:
secondary_unit = (
record.sale_line_ids[:1].secondary_uom_id
or record.product_id.sale_secondary_uom_id
)
record.secondary_uom_id = secondary_unit

if secondary_unit and secondary_unit.factor:
record.secondary_uom_qty = record.quantity / secondary_unit.factor
3 changes: 3 additions & 0 deletions account_move_report_secondary_unit/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions account_move_report_secondary_unit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Iria Alonso \<iria.alonso@solvos.es\>
1 change: 1 addition & 0 deletions account_move_report_secondary_unit/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show the secondary unit of measure and the secondary quantity in invoice reports
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//th[@name='th_description']" position="after">
<t
t-set="display_secondary_uom"
t-value="any(line.secondary_uom_id and (line.secondary_uom_id.uom_id != line.product_uom_id) for line in o.invoice_line_ids)"
/>
<t t-if="display_secondary_uom">
<th name="th_secondary_qty" class="text-end">
<span>Second. Qty</span>
</th>
</t>
</xpath>
<xpath expr="//td[@name='td_quantity']" position="before">
<t t-if="display_secondary_uom">
<td name="td_secondary_qty" class="text-end">
<t
t-if="line.secondary_uom_id and line.secondary_uom_id.uom_id != line.product_uom_id"
>
<span t-field="line.secondary_uom_qty" />
-
<span t-field="line.secondary_uom_id.name" />
</t>
</td>
</t>
</xpath>
</template>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading