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

[14.0] Migration: l10n_it_delivery_note_order_link #1974

Merged
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
113 changes: 113 additions & 0 deletions l10n_it_delivery_note_order_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
==========================================================================
ITA - Documento di trasporto - Collegamento con ordine di vendita/acquisto
==========================================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/14.0/l10n_it_delivery_note_order_link
: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-14-0/l10n-italy-14-0-l10n_it_delivery_note_order_link
: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/14.0
:alt: Try me on Runbot

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

**English**

This module link delivery notes to sale/purchase orders.

**Italiano**

Questo modulo consente di collegare gli ordini di vendita/acquisto ai DDT.

**Table of contents**

.. contents::
:local:

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

**English**

No configuration required after module installation.

**Italiano**

Dopo l'installazione del modulo non sono necessarie ulteriori configurazioni.

Usage
=====

**English**

A smart button will appear on each sale/purchase order, so you can link them to DNs.

**Italiano**

Su ciascun ordine di vendita/acquisto comparirà un pulsante (smart button) che permette di collegarlo ai DDT.

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_delivery_note_order_link%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
~~~~~~~

* Openindustry.it Sas

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

* Andrea Piovesana <andrea.m.piovesana@gmail.com>
* Giuseppe Borruso - Dinamiche Aziendali srl <gborruso@dinamicheaziendali.com>

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.

.. |maintainer-As400it| image:: https://github.com/As400it.png?size=40px
:target: https://github.com/As400it
:alt: As400it
.. |maintainer-andreampiovesana| image:: https://github.com/andreampiovesana.png?size=40px
:target: https://github.com/andreampiovesana
:alt: andreampiovesana

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-As400it| |maintainer-andreampiovesana|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_delivery_note_order_link>`_ 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_delivery_note_order_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions l10n_it_delivery_note_order_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2019, Openindustry.it Sas
# @author: Andrea Piovesana <andrea.m.piovesana@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

# noinspection PyStatementEffect
{
"name": "ITA - Documento di trasporto - Collegamento con ordine di "
"vendita/acquisto",
"summary": "Crea collegamento tra i DDT e ordine di vendita/acquisto",
"author": "Openindustry.it Sas, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-italy",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"maintainers": ["andreampiovesana"],
"category": "Localization/Italy",
"depends": [
"purchase_stock",
"sale_stock",
"l10n_it_delivery_note",
],
"data": [
"views/purchase_order.xml",
"views/sale_order.xml",
],
}
62 changes: 62 additions & 0 deletions l10n_it_delivery_note_order_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_delivery_note_order_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-15 08:42+0000\n"
"PO-Revision-Date: 2020-10-15 08:42+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order__delivery_note_ids
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_sale_order__delivery_note_ids
msgid "Delivery Note"
msgstr "DdT"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order__delivery_note_count
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_sale_order__delivery_note_count
msgid "Delivery Note Count"
msgstr "Conto DdT"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_stock_delivery_note_line
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order_line__delivery_note_line_ids
msgid "Delivery Note Line"
msgstr "Riga DdT"

#. module: l10n_it_delivery_note_order_link
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_order_link.purchase_order_form_view_delivery_note
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_order_link.sale_order_form_view
msgid "Delivery Notes"
msgstr "DdT"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order_line__delivery_picking_id
msgid "Delivery Picking"
msgstr "Prelievo DdT"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_purchase_order_line
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_stock_delivery_note_line__purchase_line_id
msgid "Purchase Order Line"
msgstr "Riga ordine di acquisto"

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_sale_order
msgid "Sale Order"
msgstr "Ordine di vendita"
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_delivery_note_order_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order__delivery_note_ids
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_sale_order__delivery_note_ids
msgid "Delivery Note"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order__delivery_note_count
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_sale_order__delivery_note_count
msgid "Delivery Note Count"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_stock_delivery_note_line
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order_line__delivery_note_line_ids
msgid "Delivery Note Line"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_order_link.purchase_order_form_view_delivery_note
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_order_link.sale_order_form_view
msgid "Delivery Notes"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_purchase_order_line__delivery_picking_id
msgid "Delivery Picking"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_purchase_order_line
#: model:ir.model.fields,field_description:l10n_it_delivery_note_order_link.field_stock_delivery_note_line__purchase_line_id
msgid "Purchase Order Line"
msgstr ""

#. module: l10n_it_delivery_note_order_link
#: model:ir.model,name:l10n_it_delivery_note_order_link.model_sale_order
msgid "Sale Order"
msgstr ""

3 changes: 3 additions & 0 deletions l10n_it_delivery_note_order_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import purchase_order
from . import sale_order
from . import stock_delivery_note
57 changes: 57 additions & 0 deletions l10n_it_delivery_note_order_link/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright (c) 2019, Link IT Europe Srl
# @author: Matteo Bilotta <mbilotta@linkeurope.it>

from odoo import fields, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

delivery_note_ids = fields.Many2many(
"stock.delivery.note", compute="_compute_delivery_notes"
)
delivery_note_count = fields.Integer(compute="_compute_delivery_notes")

def _compute_delivery_notes(self):
for order in self:
delivery_notes = order.order_line.mapped(
"delivery_note_line_ids.delivery_note_id"
)

order.delivery_note_ids = delivery_notes
order.delivery_note_count = len(delivery_notes)

def goto_delivery_notes(self, **kwargs):
delivery_notes = self.mapped("delivery_note_ids")
action = self.env.ref(
"l10n_it_delivery_note." "stock_delivery_note_action"
).read()[0]
action.update(kwargs)

if len(delivery_notes) > 1:
action["domain"] = [("id", "in", delivery_notes.ids)]

elif len(delivery_notes) == 1:
action["views"] = [
(
self.env.ref(
"l10n_it_delivery_note." "stock_delivery_note_form_view"
).id,
"form",
)
]
action["res_id"] = delivery_notes.id

else:
action = {"type": "ir.actions.act_window_close"}

return action


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

delivery_note_line_ids = fields.One2many(
"stock.delivery.note.line", "purchase_line_id", readonly=True
)
delivery_picking_id = fields.Many2one("stock.picking", readonly=True, copy=False)
22 changes: 22 additions & 0 deletions l10n_it_delivery_note_order_link/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2019, Openindustry.it Sas
# @author: Andrea Piovesana <andrea.m.piovesana@gmail.com>

from odoo import fields, models


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

delivery_note_ids = fields.Many2many(
"stock.delivery.note", compute="_compute_delivery_notes"
)
delivery_note_count = fields.Integer(compute="_compute_delivery_notes")

def _compute_delivery_notes(self):
for order in self:
delivery_notes = order.order_line.mapped(
"delivery_note_line_ids.delivery_note_id"
)

order.delivery_note_ids = delivery_notes
order.delivery_note_count = len(delivery_notes)
10 changes: 10 additions & 0 deletions l10n_it_delivery_note_order_link/models/stock_delivery_note.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @author: Andrea Piovesana <andrea.m.piovesana@gmail.com>
from odoo import fields, models


class StockDeliveryNoteLine(models.Model):
_inherit = "stock.delivery.note.line"

purchase_line_id = fields.Many2one(
"purchase.order.line", related="move_id.purchase_line_id", store=True
)
7 changes: 7 additions & 0 deletions l10n_it_delivery_note_order_link/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**English**

No configuration required after module installation.

**Italiano**

Dopo l'installazione del modulo non sono necessarie ulteriori configurazioni.
2 changes: 2 additions & 0 deletions l10n_it_delivery_note_order_link/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Andrea Piovesana <andrea.m.piovesana@gmail.com>
* Giuseppe Borruso - Dinamiche Aziendali srl <gborruso@dinamicheaziendali.com>
7 changes: 7 additions & 0 deletions l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**English**

This module link delivery notes to sale/purchase orders.

**Italiano**

Questo modulo consente di collegare gli ordini di vendita/acquisto ai DDT.
7 changes: 7 additions & 0 deletions l10n_it_delivery_note_order_link/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**English**

A smart button will appear on each sale/purchase order, so you can link them to DNs.

**Italiano**

Su ciascun ordine di vendita/acquisto comparirà un pulsante (smart button) che permette di collegarlo ai DDT.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading