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
6 changes: 1 addition & 5 deletions account_invoice_report_grouped_by_picking/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Account Invoice Grouped by Picking
==================================
Expand All @@ -17,7 +13,7 @@ Account Invoice Grouped by Picking
.. |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/license-AGPL--3-blue.png
.. |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%2Faccount--invoice--reporting-lightgray.png?logo=github
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_report_grouped_by_picking/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["sale_stock_picking_invoice_link"],
"data": ["views/report_invoice.xml"],
"data": ["views/report_invoice.xml", "views/account_journal_views.xml"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import account_move
from . import account_journal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# © 2026 Solvos Consultoría Informática (<https://www.solvos.es>)
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class AccountJournal(models.Model):
_inherit = "account.journal"

show_group_by_picking_report = fields.Boolean(
default=True,
string="Invoice Report - Show Grouped by Picking",
help="Leave unmarked if original Odoo behavior (not grouped"
" is required for invoices belonging this journal.",
)
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ def lines_grouped_by_picking(self):
"""This prepares a data structure for printing the invoice report
grouped by pickings."""
self.ensure_one()
if not self.journal_id.show_group_by_picking_report:
return [
{
"picking": self.env["stock.picking"],
"line": line,
"quantity": line.quantity,
}
for line in self.invoice_line_ids
]
picking_dict = {}
lines_dict = {}
picking_obj = self.env["stock.picking"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Account Invoice Grouped by Picking</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="account-invoice-grouped-by-picking">
<h1 class="title">Account Invoice Grouped by Picking</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="account-invoice-grouped-by-picking">
<h1>Account Invoice Grouped by Picking</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:edd0bcffe97ef1d223c016dd781d30e863d7cae9f98c78487e6b3c639c3bacb3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoice-reporting/tree/18.0/account_invoice_report_grouped_by_picking"><img alt="OCA/account-invoice-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--invoice--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoice-reporting-18-0/account-invoice-reporting-18-0-account_invoice_report_grouped_by_picking"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoice-reporting&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoice-reporting/tree/18.0/account_invoice_report_grouped_by_picking"><img alt="OCA/account-invoice-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--invoice--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoice-reporting-18-0/account-invoice-reporting-18-0-account_invoice_report_grouped_by_picking"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoice-reporting&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows print invoices with picking info. This module groups
invoice lines and shows information related to sales and pickings on
every group.</p>
Expand All @@ -396,7 +391,7 @@ <h1>Account Invoice Grouped by Picking</h1>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ol class="arabic simple">
<li>Create several quotation orders and confirm them.</li>
<li>Deliver pickings related to each sale order.</li>
Expand All @@ -408,23 +403,23 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
</ol>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoice-reporting/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/account-invoice-reporting/issues/new?body=module:%20account_invoice_report_grouped_by_picking%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Carlos Dauden</li>
Expand All @@ -446,12 +441,12 @@ <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
</ul>
</div>
<div class="section" id="other-credits">
<h3><a class="toc-backref" href="#toc-entry-6">Other credits</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<p>The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -464,6 +459,5 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,30 @@ def test_account_invoice_group_picking_refund_without_return(self):
self.assertEqual(self._count_sale_in_picking_header(content, self.sale.name), 1)
# information about pickings is printed
self.assertTrue(picking.name in tbody)

def test_account_invoice_group_picking_disabled(self):
self.sale.action_confirm()
self.sale.picking_ids[:1].action_confirm()
self.sale.picking_ids[:1].move_line_ids.write({"quantity": 1})
wiz_act = self.sale.picking_ids[:1].button_validate()
wiz = Form(
self.env[wiz_act["res_model"]].with_context(**wiz_act["context"])
).save()
wiz.process()
invoice = self.sale._create_invoices()
invoice.journal_id.show_group_by_picking_report = False
groups = invoice.lines_grouped_by_picking()
self.assertEqual(len(groups), len(invoice.invoice_line_ids))
for group in groups:
self.assertFalse(group["picking"])
content = html.document_fromstring(
self.env["ir.actions.report"]._render_qweb_html(
"account.account_invoices", invoice.id
)[0]
)
tbody = content.xpath("//tbody[@class='invoice_tbody']")
tbody = [html.tostring(line, encoding="utf-8").strip() for line in tbody][
0
].decode()
self.assertEqual(self._count_sale_in_picking_header(content, self.sale.name), 0)
self.assertFalse(self.sale.invoice_ids.picking_ids[:1].name in tbody)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<odoo>
<record
id="view_account_journal_form_inherit_grouped_by_picking"
model="ir.ui.view"
>
<field name="name">
account.journal.form.grouped.by.picking (in account_invoice_report_grouped_by_picking)
</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="arch" type="xml">
<xpath
expr="//notebook/page[@name='advanced_settings']/group"
position="after"
>
<group name="invoice_report" string="Invoice Report">
<field
name="show_group_by_picking_report"
string="Show Grouped by Picking"
widget="boolean_toggle"
/>
</group>
</xpath>
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</xpath>
<xpath expr="//tbody[hasclass('invoice_tbody')]" position="inside">
<t t-set="subtotal" t-value="0.0" />
<t t-set="last_picking" t-value="None" />
</xpath>
<xpath expr="//t[contains(@t-foreach, 'lines')]" position="attributes">
<attribute name="t-foreach">lines_grouped</attribute>
Expand All @@ -30,7 +31,9 @@
<t t-set="line_last" t-value="False" />
<t t-set="line_index" t-value="0" />

<t t-if="picking != last_picking">
<t
t-if="o.journal_id.show_group_by_picking_report and picking != last_picking"
>
<t t-set="last_picking" t-value="picking" />
<tr t-if="picking">
<td colspan="10">
Expand Down Expand Up @@ -96,7 +99,9 @@
expr="//t[@t-foreach='lines_grouped']//td[hasclass('o_price_total')]"
position="after"
>
<tr t-if="picking != next_picking[0]">
<tr
t-if="o.journal_id.show_group_by_picking_report and picking != next_picking[0]"
>
<td colspan="10" class="text-right">
<strong>Subtotal: </strong>
<strong
Expand Down
Loading