Skip to content

Commit

Permalink
Merge PR #4225 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by sergiocorato
  • Loading branch information
OCA-git-bot committed Jul 12, 2024
2 parents 58d5e03 + 5bd4a46 commit eae1a94
Show file tree
Hide file tree
Showing 15 changed files with 711 additions and 5 deletions.
118 changes: 118 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
===================================================
ITA - Fattura PA - sale orders as related documents
===================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:62e9ea53b28e2845aa4728960d96554f12afac66d2b7d62c36aca149fd2f13ea
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_auto_sale_order
: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_auto_sale_order
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0
:alt: Try me on Runboat

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

**Italiano**

Modulo opzionale per aggiungere automaticamente i dati dei sale order in
fattura elettronica (FatturaPA)

**English**

Additional module to add sale order data in the electronic invoice
(FatturaPA)

**Table of contents**

.. contents::
:local:

Installation
============



Configuration
=============

**Italiano**

- Alla creazione di una fattura da ordine di vendita, viene aggiunto
automaticamente l'ordine come documento collegato, e nell'XML
FatturaPA apparirà nella stanza DatiOrdineAcquisto.

**English**

- When creating an invoice from a sale order, a related document is
created, and will appear in the DatiOrdineAcquisto element inside the
FatturaPA XML .

Usage
=====

**Italiano**

Il modulo funziona automaticamente alla creazione di una fattura da sale
order.

**English**

The module adds sale order data to the invoice automatically.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_auto_sale_order%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
-------

* Marco Colombo

Contributors
------------

- `Phi Srl <https://www.phi.technology/>`__:

- Marco Colombo <https://github.com/TheMule71>

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_auto_sale_order>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions l10n_it_fatturapa_auto_sale_order/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ITA - Fattura PA - sale orders as related documents",
"version": "16.0.1.0.0",
"sequence": 10,
"summary": "Automatically set sale orders as related documents",
"category": "Localization/Italy",
"depends": [
"sale",
"l10n_it_fatturapa",
],
"author": "Marco Colombo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-italy",
"license": "AGPL-3",
"installable": True,
"application": False,
"auto_install": False,
}
1 change: 1 addition & 0 deletions l10n_it_fatturapa_auto_sale_order/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
33 changes: 33 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from odoo import api, models


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

@api.model_create_multi
def create(self, vals_list):
ret = super().create(vals_list)

vl = []

# consider only sale documents
for move in ret.filtered(lambda m: m.is_sale_document()):
# skip invoices that already have related documents of type "order",
# assuming the user took care of the matter
if move.related_documents.filtered(lambda rd: rd.type == "order"):
continue

for so in move.line_ids.sale_line_ids.order_id:
v = {
"invoice_id": move.id,
"type": "order",
"name": f"{so.name} ({so.client_order_ref})"
if so.client_order_ref
else so.name,
"date": so.date_order,
"numitem": so.id,
}
vl.append(v)

self.env["fatturapa.related_document_type"].create(vl)
return ret
3 changes: 3 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
11 changes: 11 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Italiano**

- Alla creazione di una fattura da ordine di vendita, viene
aggiunto automaticamente l'ordine come documento collegato,
e nell'XML FatturaPA apparirà nella stanza DatiOrdineAcquisto.

**English**

- When creating an invoice from a sale order, a related
document is created, and will appear in the
DatiOrdineAcquisto element inside the FatturaPA XML .
2 changes: 2 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Phi Srl](https://www.phi.technology/):
- Marco Colombo \<<https://github.com/TheMule71>\>
9 changes: 9 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**Italiano**

Modulo opzionale per aggiungere automaticamente i dati
dei sale order in fattura elettronica (FatturaPA)

**English**

Additional module to add sale order data in the
electronic invoice (FatturaPA)
Empty file.
8 changes: 8 additions & 0 deletions l10n_it_fatturapa_auto_sale_order/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Italiano**

Il modulo funziona automaticamente alla creazione di una fattura
da sale order.

**English**

The module adds sale order data to the invoice automatically.
Loading

0 comments on commit eae1a94

Please sign in to comment.