Skip to content
Merged
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
72 changes: 72 additions & 0 deletions sale_invoice_partial_lines/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==========================
Sale Invoice Partial Lines
==========================

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

.. |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
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-nuobit%2Fodoo--addons-lightgray.png?logo=github
:target: https://github.com/nuobit/odoo-addons/tree/16.0/sale_invoice_partial_lines
:alt: nuobit/odoo-addons

|badge1| |badge2| |badge3|

* Add a per-line ``Selected`` checkbox on sale orders so users can pick
which lines go into the next regular invoice.
* Persist the selection in the database, so it survives pagination,
refreshes, and closing the browser.
* Extend the standard *Create Invoice* wizard with an ``Only selected lines``
option that includes only those flagged lines and resets the flag once
the invoice is created.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/nuobit/odoo-addons/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/nuobit/odoo-addons/issues/new?body=module:%20sale_invoice_partial_lines%0Aversion:%2016.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
~~~~~~~

* NuoBiT Solutions SL

Contributors
~~~~~~~~~~~~

* `NuoBiT <https://www.nuobit.com>`__:

* Eric Antones <eantones@nuobit.com>

Maintainers
~~~~~~~~~~~

This module is part of the `nuobit/odoo-addons <https://github.com/nuobit/odoo-addons/tree/16.0/sale_invoice_partial_lines>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions sale_invoice_partial_lines/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
19 changes: 19 additions & 0 deletions sale_invoice_partial_lines/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2026 NuoBiT Solutions SL - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Invoice Partial Lines",
"summary": "Mark sale order lines and invoice only the marked ones",
"author": "NuoBiT Solutions SL",
"category": "Sales",
"version": "16.0.1.2.1",
"license": "AGPL-3",
"website": "https://github.com/nuobit/odoo-addons",
"depends": [
"sale",
],
"data": [
"views/sale_order_views.xml",
"wizards/sale_advance_payment_inv_views.xml",
],
}
77 changes: 77 additions & 0 deletions sale_invoice_partial_lines/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_invoice_partial_lines
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-04-27 14:00+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order_line__selected
msgid ""
"Mark this line for batch operations (invoicing, grouping, exporting, etc.)."
msgstr ""
"Marca aquesta línia per a operacions per lots (facturació, agrupació, "
"exportació, etc.)."

#. module: sale_invoice_partial_lines
#. odoo-python
#: code:addons/sale_invoice_partial_lines/wizards/sale_advance_payment_inv.py:0
#, python-format
msgid ""
"No selected order lines are ready to invoice. Tick the 'Selected' checkbox on "
"invoiceable lines before creating the invoice."
msgstr ""
"No hi ha cap línia seleccionada a punt per facturar. Marca la casella "
"'Seleccionada' a les línies facturables abans de crear la factura."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order__selected_lines_count
msgid "Number of selected order lines (sections and notes excluded)."
msgstr "Nombre de línies de comanda seleccionades (sense seccions ni notes)."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_advance_payment_inv__only_selected_lines
msgid "Only selected lines"
msgstr "Només línies seleccionades"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order_line__selected
msgid "Selected"
msgstr "Seleccionada"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order__selected_lines_count
msgid "Selected lines"
msgstr "Línies seleccionades"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order__selected_lines_amount
msgid "Subtotal of selected lines"
msgstr "Subtotal de les línies seleccionades"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order__selected_lines_amount
msgid "Sum of the untaxed subtotal of the selected order lines."
msgstr ""
"Suma del subtotal sense impostos de les línies de comanda seleccionades."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_advance_payment_inv__only_selected_lines
msgid ""
"When set, the invoice will include only the order lines flagged as "
"'Selected'. After the invoice is created, the flag is reset on every line "
"that was just invoiced."
msgstr ""
"Quan està activat, la factura inclourà només les línies marcades com a "
"'Seleccionada'. Després de crear la factura, l'indicador es restableix a "
"cada línia facturada."
76 changes: 76 additions & 0 deletions sale_invoice_partial_lines/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_invoice_partial_lines
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-04-27 14:00+0000\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: \n"
"Plural-Forms: \n"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order_line__selected
msgid ""
"Mark this line for batch operations (invoicing, grouping, exporting, etc.)."
msgstr ""
"Marca esta línea para operaciones por lotes (facturación, agrupación, "
"exportación, etc.)."

#. module: sale_invoice_partial_lines
#. odoo-python
#: code:addons/sale_invoice_partial_lines/wizards/sale_advance_payment_inv.py:0
#, python-format
msgid ""
"No selected order lines are ready to invoice. Tick the 'Selected' checkbox on "
"invoiceable lines before creating the invoice."
msgstr ""
"No hay líneas seleccionadas listas para facturar. Marca la casilla "
"'Seleccionada' en las líneas facturables antes de crear la factura."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order__selected_lines_count
msgid "Number of selected order lines (sections and notes excluded)."
msgstr "Número de líneas de pedido seleccionadas (sin secciones ni notas)."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_advance_payment_inv__only_selected_lines
msgid "Only selected lines"
msgstr "Sólo líneas seleccionadas"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order_line__selected
msgid "Selected"
msgstr "Seleccionada"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order__selected_lines_count
msgid "Selected lines"
msgstr "Líneas seleccionadas"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,field_description:sale_invoice_partial_lines.field_sale_order__selected_lines_amount
msgid "Subtotal of selected lines"
msgstr "Subtotal de las líneas seleccionadas"

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_order__selected_lines_amount
msgid "Sum of the untaxed subtotal of the selected order lines."
msgstr "Suma del subtotal sin impuestos de las líneas de pedido seleccionadas."

#. module: sale_invoice_partial_lines
#: model:ir.model.fields,help:sale_invoice_partial_lines.field_sale_advance_payment_inv__only_selected_lines
msgid ""
"When set, the invoice will include only the order lines flagged as "
"'Selected'. After the invoice is created, the flag is reset on every line "
"that was just invoiced."
msgstr ""
"Cuando está activo, la factura incluirá sólo las líneas marcadas como "
"'Seleccionada'. Después de crear la factura, el indicador se restablece en "
"cada línea facturada."
2 changes: 2 additions & 0 deletions sale_invoice_partial_lines/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order_line
from . import sale_order
73 changes: 73 additions & 0 deletions sale_invoice_partial_lines/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2026 NuoBiT Solutions SL - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

selected_lines_count = fields.Integer(
string="Selected lines",
compute="_compute_selected_lines",
help="Number of selected order lines (sections and notes excluded).",
)
selected_lines_amount = fields.Monetary(
string="Subtotal of selected lines",
compute="_compute_selected_lines",
currency_field="currency_id",
help="Sum of the untaxed subtotal of the selected order lines.",
)

@api.depends(
"order_line.selected",
"order_line.price_subtotal",
"order_line.display_type",
)
def _compute_selected_lines(self):
for order in self:
selected = order.order_line.filtered(
lambda line: line.selected and not line.display_type
)
order.selected_lines_count = len(selected)
order.selected_lines_amount = sum(selected.mapped("price_subtotal"))

def _get_invoiceable_lines(self, final=False):
invoiceable_lines = super()._get_invoiceable_lines(final=final)
if not self.env.context.get("only_selected_lines"):
return invoiceable_lines

# Keep the result from super() as the source of truth for what is
# invoiceable, then only narrow regular lines to the selected ones.
invoiceable_line_ids = []
down_payment_line_ids = []
group_lines = []
group_has_selected_line = False

def flush_group():
nonlocal group_lines, group_has_selected_line
if group_has_selected_line:
invoiceable_line_ids.extend(
line.id
for line in group_lines
if line.display_type or line.selected
)
group_lines = []
group_has_selected_line = False

for line in invoiceable_lines:
if line.is_downpayment and not line.display_type:
down_payment_line_ids.append(line.id)
continue
if line.display_type == "line_section":
flush_group()
group_lines = [line]
continue
group_lines.append(line)
if not line.display_type and line.selected:
group_has_selected_line = True
flush_group()

return self.env["sale.order.line"].browse(
invoiceable_line_ids + down_payment_line_ids
)
15 changes: 15 additions & 0 deletions sale_invoice_partial_lines/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 NuoBiT Solutions SL - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

selected = fields.Boolean(
default=False,
copy=False,
help="Mark this line for batch operations (invoicing, grouping, "
"exporting, etc.).",
)
3 changes: 3 additions & 0 deletions sale_invoice_partial_lines/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `NuoBiT <https://www.nuobit.com>`__:

* Eric Antones <eantones@nuobit.com>
7 changes: 7 additions & 0 deletions sale_invoice_partial_lines/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* Add a per-line ``Selected`` checkbox on sale orders so users can pick
which lines go into the next regular invoice.
* Persist the selection in the database, so it survives pagination,
refreshes, and closing the browser.
* Extend the standard *Create Invoice* wizard with an ``Only selected lines``
option that includes only those flagged lines and resets the flag once
the invoice is created.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading