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
6 changes: 6 additions & 0 deletions account_invoice_report_service/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ msgstr ""
"Caso no implementado: La misma línea de factura pertenece a diferentes "
"pedidos"

#. module: account_invoice_report_service
#: code:addons/account_invoice_report_service/models/account_invoice.py:0
#, python-format
msgid "Not implemented case: The same invoice line %(line)s belongs to different orders %(orders)s"
msgstr "Caso no implementado: La misma línea de factura %(line)s pertenece a diferentes pedidos %(orders)s"

#. module: account_invoice_report_service
#: model:ir.model.fields,field_description:account_invoice_report_service.field_sale_order__date_order_tz
msgid "Order Date TZ"
Expand Down
2 changes: 0 additions & 2 deletions account_invoice_report_service/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from . import res_company
from . import account_invoice
from . import res_config_settings
Expand Down
37 changes: 26 additions & 11 deletions account_invoice_report_service/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,34 @@ def print_report_invoice_service(self):
)
return self.company_id.report_service_id.report_action(self)

def _group_by_order(self):
def _group_invoice_lines_by_order(self):
order_d, no_order = {}, self.env["account.move.line"]
for iline in self.invoice_line_ids:
if iline.sale_line_ids:
for oline in iline.sale_line_ids:
order = oline.order_id
if order not in order_d:
order_d[order] = self.env["account.move.line"]
order_d[order] |= iline
else:
orders = list(filter(None, iline._get_orders()))
if len(orders) == 1:
order = orders[0]
if order not in order_d:
order_d[order] = self.env["account.move.line"]
order_d[order] |= iline
elif not orders:
no_order += iline

else:
raise ValidationError(
_(
"Not implemented case: "
"The same invoice line %(line)s "
"belongs to different orders %(orders)s"
)
% {
"line": iline.name,
"orders": ", ".join([x.name for x in orders]),
}
)
return order_d, no_order

def get_service_lines_by_order(self):
# group by order
order_d, no_order = self._group_by_order()
order_d, no_order = self._group_invoice_lines_by_order()

# grouping by round trip code
order_rt_date_l = []
Expand Down Expand Up @@ -89,7 +100,7 @@ def get_service_lines_by_order(self):

def get_delivery_lines_by_order(self):
# group by order
order_d, no_order = self._group_by_order()
order_d, no_order = self._group_invoice_lines_by_order()

# sort and join with lines w/o orders
order_sorted_l = []
Expand All @@ -114,6 +125,10 @@ def get_delivery_lines_by_order(self):
class AccountMoveLine(models.Model):
_inherit = "account.move.line"

def _get_orders(self):
# we use a list to allow different types of orders, sale, repair, etc
return [x for x in self.sale_line_ids.order_id]

def get_line_lots(self):
return (
self.move_line_ids.mapped("lot_id").sorted(lambda x: x.name).mapped("name")
Expand Down
63 changes: 63 additions & 0 deletions account_invoice_report_service_repair/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
=============================
Service invoice report repair
=============================

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

.. |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-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/14.0/account_invoice_report_service_repair
:alt: NuoBiT/odoo-addons

|badge1| |badge2| |badge3|

The "Account Invoice Report Service Repair" module enhances the invoice delivery report by including information about the associated repair order. When a service repair is performed and invoiced, this module ensures that the repair order reference is visible on the invoice delivery report. This feature improves traceability and transparency for both internal users and customers, making it easier to track which repair operations are linked to each invoice. The module is especially useful for companies that manage repair services and need to provide detailed documentation to their clients.

**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:%20account_invoice_report_service_repair%0Aversion:%2014.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
* S.L.

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/14.0/account_invoice_report_service_repair>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions account_invoice_report_service_repair/__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_invoice_report_service_repair/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 NuoBiT - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "Service invoice report repair",
"summary": "This module displays the related repair order on the "
"invoice delivery report, providing a clear link between "
"service repairs and their corresponding invoices.",
"version": "14.0.1.0.0",
"author": "NuoBiT Solutions, S.L.",
"license": "AGPL-3",
"category": "Accounting",
"website": "https://github.com/nuobit/odoo-addons",
"depends": ["account_invoice_report_service", "repair"],
"auto_install": True,
}
2 changes: 2 additions & 0 deletions account_invoice_report_service_repair/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_move_line
from . import repair_order
15 changes: 15 additions & 0 deletions account_invoice_report_service_repair/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 NuoBiT - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from odoo import models


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

def _get_orders(self):
# we use a list to allow different types of orders, sale, repair, etc
return super()._get_orders() + [
x for x in self.repair_fee_ids.repair_id | self.repair_line_ids.repair_id
]
30 changes: 30 additions & 0 deletions account_invoice_report_service_repair/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2025 NuoBiT - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields, models


class Repair(models.Model):
_inherit = "repair.order"

date_order = fields.Datetime(related="move_id.date", readonly=True)
Comment thread
eantones marked this conversation as resolved.

client_order_ref = fields.Char(compute="_compute_client_order_ref")

Comment thread
eantones marked this conversation as resolved.
def _compute_client_order_ref(self):
Comment thread
eantones marked this conversation as resolved.
for order in self:
Comment thread
eantones marked this conversation as resolved.
order.client_order_ref = False

service_number = fields.Integer(compute="_compute_service_number")

def _compute_service_number(self):
for order in self:
Comment thread
eantones marked this conversation as resolved.
order.service_number = 0

date_order_tz = fields.Date(
string="Order Date TZ", readonly=True, compute="_compute_date_order_tz"
)

def _compute_date_order_tz(self):
for rec in self:
rec.date_order_tz = fields.Date.context_today(rec, rec.date_order)
3 changes: 3 additions & 0 deletions account_invoice_report_service_repair/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>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The "Account Invoice Report Service Repair" module enhances the invoice delivery report by including information about the associated repair order. When a service repair is performed and invoiced, this module ensures that the repair order reference is visible on the invoice delivery report. This feature improves traceability and transparency for both internal users and customers, making it easier to track which repair operations are linked to each invoice. The module is especially useful for companies that manage repair services and need to provide detailed documentation to their clients.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading