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
82 changes: 82 additions & 0 deletions l10n_it_fatturapa_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
================================================
ITA - Fattura elettronica - Integrazione vendite
================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fatturapa_sale
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_fatturapa_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/16.0
:alt: Try me on Runbot

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

**Italiano**

Questo modulo permette di impostare i documenti correlati e il riferimento amministrazione nell'ordine di vendita (o le sue righe) e propagarli alla fattura (o le sue righe) durante la creazione della fattura.

**English**

This module allows to set related documents and Admin. Ref. in the sale order (or its lines) and propagate them to the invoice (or its lines) during invoice creation.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_sale%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
~~~~~~~

* Agile Business Group

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

* Agile Business Group
* `Ooops <https://www.ooops404.com>`_:

* Giovanni Serra <giovanni@gslab.it>

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/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fatturapa_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions l10n_it_fatturapa_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
22 changes: 22 additions & 0 deletions l10n_it_fatturapa_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "ITA - Fattura elettronica - Integrazione vendite",
"summary": "Aggiunge alcuni dati per la "
"fatturazione elettronica nell'ordine di vendita",
"version": "16.0.1.0.0",
"website": "https://github.com/OCA/l10n-italy",
"author": "Agile Business Group, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Hidden",
"auto_install": True,
"depends": [
"l10n_it_fatturapa",
"sale_management",
],
"data": [
"views/related_document_type_views.xml",
"views/sale_order_line_views.xml",
"views/sale_order_views.xml",
],
}
80 changes: 80 additions & 0 deletions l10n_it_fatturapa_sale/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_fatturapa_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-26 09:50+0000\n"
"PO-Revision-Date: 2022-03-04 11:54+0000\n"
"Last-Translator: Francesco Foresti <francesco.foresti@ooops404.com>\n"
"Language-Team: \n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__admin_ref
msgid "Admin. ref."
msgstr "Rif. ammin."

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_fatturapa_related_document_type
msgid "E-invoice Related Document Type"
msgstr "Tipo documento relativo alla e-fattura"

#. module: l10n_it_fatturapa_sale
#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_sale.sale_order_line_view_form_readonly
#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_sale.view_order_form
msgid "Electronic Invoice"
msgstr "Fattura elettronica"

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_account_invoice
msgid "Invoice"
msgstr "Fattura"

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_account_invoice_line
msgid "Invoice Line"
msgstr "Riga fattura"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order__related_documents
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__related_documents
msgid "Related Documents"
msgstr "Documenti collegati"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__invoice_id
msgid "Related Invoice"
msgstr "Fattura collegata"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__invoice_line_id
msgid "Related Invoice Line"
msgstr "Riga fattura collegata"

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_sale_order
msgid "Sale Order"
msgstr "Ordine di vendita"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__sale_order_id
msgid "Sale order"
msgstr "Ordine di vendita"

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__sale_order_line_id
msgid "Sale order line"
msgstr "Riga ordine di vendita"

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_sale_order_line
msgid "Sales Order Line"
msgstr "Riga ordine di vendita"
103 changes: 103 additions & 0 deletions l10n_it_fatturapa_sale/i18n/l10n_it_fatturapa_sale.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_fatturapa_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \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: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__admin_ref
msgid "Admin. ref."
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move__display_name
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move_line__display_name
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__display_name
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order__display_name
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__display_name
msgid "Display Name"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_fatturapa_related_document_type
msgid "E-invoice Related Document Type"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_sale.sale_order_line_view_form_readonly
#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_sale.view_order_form
msgid "Electronic Invoice"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move__id
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move_line__id
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__id
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order__id
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__id
msgid "ID"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_account_move
msgid "Journal Entry"
msgstr ""

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

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move____last_update
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_account_move_line____last_update
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type____last_update
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order____last_update
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line____last_update
msgid "Last Modified on"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order__related_documents
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_sale_order_line__related_documents
msgid "Related Documents"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__invoice_id
msgid "Related Invoice"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__invoice_line_id
msgid "Related Invoice Line"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__sale_order_id
msgid "Sale order"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model.fields,field_description:l10n_it_fatturapa_sale.field_fatturapa_related_document_type__sale_order_line_id
msgid "Sale order line"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: l10n_it_fatturapa_sale
#: model:ir.model,name:l10n_it_fatturapa_sale.model_sale_order_line
msgid "Sales Order Line"
msgstr ""
7 changes: 7 additions & 0 deletions l10n_it_fatturapa_sale/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_move
from . import account_move_line
from . import related_document
from . import sale_order
from . import sale_order_line
14 changes: 14 additions & 0 deletions l10n_it_fatturapa_sale/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


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

def unlink(self):
related_documents = self.mapped("related_documents")
res = super().unlink()
related_documents.check_unlink().unlink()
return res
14 changes: 14 additions & 0 deletions l10n_it_fatturapa_sale/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


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

def unlink(self):
related_documents = self.mapped("related_documents")
res = super().unlink()
related_documents.check_unlink().unlink()
return res
51 changes: 51 additions & 0 deletions l10n_it_fatturapa_sale/models/related_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2020 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class FatturapaRelatedDocumentType(models.Model):
_inherit = "fatturapa.related_document_type"

invoice_line_id = fields.Many2one(
ondelete="set null",
)
invoice_id = fields.Many2one(
ondelete="set null",
)
sale_order_id = fields.Many2one(
comodel_name="sale.order",
string="Sale order",
index=True,
readonly=True,
)
sale_order_line_id = fields.Many2one(
comodel_name="sale.order.line",
string="Sale order line",
index=True,
readonly=True,
)

def check_unlink(self):
"""
Related documents only make sense if they are related (linked)
to some other record.
When this condition is no more satisfied,
the document can be deleted.
"""
to_delete = self.env[self._name].browse()
check_fields = [
"invoice_line_id",
"invoice_id",
"sale_order_id",
"sale_order_line_id",
]
for related_document in self:
for check_field in check_fields:
if related_document[check_field].exists():
break
else:
# `related_document` has to be deleted only
# if none of the records in `check_fields` exists
to_delete |= related_document
return to_delete
Loading