Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] account_invoice_section_repair: Account invoice with repair info section #128

Closed
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
31 changes: 31 additions & 0 deletions account_invoice_sale_info_section/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. 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

=================================
Account invoice sale info section
=================================

* When creating an invoice from a sales order, a section with the order
information is created in the sales order, which will be carried over to the
invoice.


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>
2 changes: 2 additions & 0 deletions account_invoice_sale_info_section/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
16 changes: 16 additions & 0 deletions account_invoice_sale_info_section/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Account Invoice Sale Info Section",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/mrp-repair-addons",
"category": "Invoices & Payments",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": [
"sale",
"account"
],
"data": [],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_sale_info_section
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-31 06:51+0000\n"
"PO-Revision-Date: 2025-01-31 06:51+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_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__display_name
msgid "Display Name"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__id
msgid "ID"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_invoice_sale_info_section
#: code:addons/account_invoice_sale_info_section/models/sale_order.py:0
#, python-format
msgid "Order: %(order)s, Date: %(date)s"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_order
msgid "Sales Order"
msgstr ""
50 changes: 50 additions & 0 deletions account_invoice_sale_info_section/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_sale_info_section
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-31 06:51+0000\n"
"PO-Revision-Date: 2025-01-31 06:51+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_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__display_name
msgid "Display Name"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__id
msgid "ID"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_invoice_sale_info_section
#: code:addons/account_invoice_sale_info_section/models/sale_order.py:0
#, python-format
msgid "Order: %(order)s, Date: %(date)s"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_order
msgid "Sales Order"
msgstr ""
50 changes: 50 additions & 0 deletions account_invoice_sale_info_section/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_sale_info_section
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-31 06:51+0000\n"
"PO-Revision-Date: 2025-01-31 06:51+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_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order__id
msgid "ID"
msgstr ""

#. module: account_invoice_sale_info_section
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_invoice_sale_info_section.field_sale_order____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: account_invoice_sale_info_section
#: code:addons/account_invoice_sale_info_section/models/sale_order.py:0
#, python-format
msgid "Order: %(order)s, Date: %(date)s"
msgstr "Pedido: %(order)s, Fecha: %(date)s"

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr "Ventas. Anticipo pago factura"

#. module: account_invoice_sale_info_section
#: model:ir.model,name:account_invoice_sale_info_section.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"
1 change: 1 addition & 0 deletions account_invoice_sale_info_section/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
30 changes: 30 additions & 0 deletions account_invoice_sale_info_section/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, models


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

def create_sale_info_section(self):
for sale in self:
my_name = _("Order: %(order)s, Date: %(date)s") % {
"order": sale.name,
"date": sale.date_order.date(),
}
line = sale.order_line.filtered(lambda x: x.name == my_name)
if not line:
line = self.env["sale.order.line"].create(
sale._get_values_sale_info_section(my_name)
)
line._compute_invoice_status()
self._cr.commit() # pylint: disable=E8102

def _get_values_sale_info_section(self, my_name):
vals = {
"name": my_name,
"order_id": self.id,
"sequence": 1,
"display_type": "line_section",
}
return vals
1 change: 1 addition & 0 deletions account_invoice_sale_info_section/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_advance_payment_inv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models


class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"

def create_invoices(self):
sales = self.env["sale.order"].browse(self._context.get('active_ids', []))
sales.create_sale_info_section()
return super().create_invoices()
6 changes: 6 additions & 0 deletions setup/account_invoice_sale_info_section/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,
)
Loading