diff --git a/l10n_it_delivery_note_order_link/README.rst b/l10n_it_delivery_note_order_link/README.rst new file mode 100644 index 000000000000..395362dcc29d --- /dev/null +++ b/l10n_it_delivery_note_order_link/README.rst @@ -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 `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Openindustry.it Sas + +Contributors +~~~~~~~~~~~~ + +* Andrea Piovesana +* Giuseppe Borruso - Dinamiche Aziendali srl + +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 `__: + +|maintainer-As400it| |maintainer-andreampiovesana| + +This module is part of the `OCA/l10n-italy `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_delivery_note_order_link/__init__.py b/l10n_it_delivery_note_order_link/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/l10n_it_delivery_note_order_link/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_it_delivery_note_order_link/__manifest__.py b/l10n_it_delivery_note_order_link/__manifest__.py new file mode 100644 index 000000000000..887ae5d67be1 --- /dev/null +++ b/l10n_it_delivery_note_order_link/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright (c) 2019, Openindustry.it Sas +# @author: Andrea Piovesana +# 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", + ], +} diff --git a/l10n_it_delivery_note_order_link/i18n/it.po b/l10n_it_delivery_note_order_link/i18n/it.po new file mode 100644 index 000000000000..2cc0e8e61516 --- /dev/null +++ b/l10n_it_delivery_note_order_link/i18n/it.po @@ -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" diff --git a/l10n_it_delivery_note_order_link/i18n/l10n_it_delivery_note_order_link.pot b/l10n_it_delivery_note_order_link/i18n/l10n_it_delivery_note_order_link.pot new file mode 100644 index 000000000000..3853d338822b --- /dev/null +++ b/l10n_it_delivery_note_order_link/i18n/l10n_it_delivery_note_order_link.pot @@ -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 "" + diff --git a/l10n_it_delivery_note_order_link/models/__init__.py b/l10n_it_delivery_note_order_link/models/__init__.py new file mode 100644 index 000000000000..396335a9df65 --- /dev/null +++ b/l10n_it_delivery_note_order_link/models/__init__.py @@ -0,0 +1,3 @@ +from . import purchase_order +from . import sale_order +from . import stock_delivery_note diff --git a/l10n_it_delivery_note_order_link/models/purchase_order.py b/l10n_it_delivery_note_order_link/models/purchase_order.py new file mode 100644 index 000000000000..61a2da936851 --- /dev/null +++ b/l10n_it_delivery_note_order_link/models/purchase_order.py @@ -0,0 +1,57 @@ +# Copyright (c) 2019, Link IT Europe Srl +# @author: Matteo Bilotta + +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) diff --git a/l10n_it_delivery_note_order_link/models/sale_order.py b/l10n_it_delivery_note_order_link/models/sale_order.py new file mode 100644 index 000000000000..d81e72d81cdd --- /dev/null +++ b/l10n_it_delivery_note_order_link/models/sale_order.py @@ -0,0 +1,22 @@ +# Copyright (c) 2019, Openindustry.it Sas +# @author: Andrea Piovesana + +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) diff --git a/l10n_it_delivery_note_order_link/models/stock_delivery_note.py b/l10n_it_delivery_note_order_link/models/stock_delivery_note.py new file mode 100644 index 000000000000..f27dfd05b7c5 --- /dev/null +++ b/l10n_it_delivery_note_order_link/models/stock_delivery_note.py @@ -0,0 +1,10 @@ +# @author: Andrea Piovesana +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 + ) diff --git a/l10n_it_delivery_note_order_link/readme/CONFIGURE.rst b/l10n_it_delivery_note_order_link/readme/CONFIGURE.rst new file mode 100644 index 000000000000..83608f0df07f --- /dev/null +++ b/l10n_it_delivery_note_order_link/readme/CONFIGURE.rst @@ -0,0 +1,7 @@ +**English** + +No configuration required after module installation. + +**Italiano** + +Dopo l'installazione del modulo non sono necessarie ulteriori configurazioni. diff --git a/l10n_it_delivery_note_order_link/readme/CONTRIBUTORS.rst b/l10n_it_delivery_note_order_link/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..e888c403b73b --- /dev/null +++ b/l10n_it_delivery_note_order_link/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Andrea Piovesana +* Giuseppe Borruso - Dinamiche Aziendali srl diff --git a/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst b/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..d3dc5571580c --- /dev/null +++ b/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst @@ -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. diff --git a/l10n_it_delivery_note_order_link/readme/USAGE.rst b/l10n_it_delivery_note_order_link/readme/USAGE.rst new file mode 100644 index 000000000000..de3a13dc4830 --- /dev/null +++ b/l10n_it_delivery_note_order_link/readme/USAGE.rst @@ -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. diff --git a/l10n_it_delivery_note_order_link/static/description/icon.png b/l10n_it_delivery_note_order_link/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/l10n_it_delivery_note_order_link/static/description/icon.png differ diff --git a/l10n_it_delivery_note_order_link/static/description/index.html b/l10n_it_delivery_note_order_link/static/description/index.html new file mode 100644 index 000000000000..5698c9b5bc6f --- /dev/null +++ b/l10n_it_delivery_note_order_link/static/description/index.html @@ -0,0 +1,441 @@ + + + + + + +ITA - Documento di trasporto - Collegamento con ordine di vendita/acquisto + + + +
+

ITA - Documento di trasporto - Collegamento con ordine di vendita/acquisto

+ + +

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

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

+ +
+

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. +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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Openindustry.it Sas
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainers:

+

As400it andreampiovesana

+

This module is part of the OCA/l10n-italy project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_it_delivery_note_order_link/views/purchase_order.xml b/l10n_it_delivery_note_order_link/views/purchase_order.xml new file mode 100644 index 000000000000..17fcef468486 --- /dev/null +++ b/l10n_it_delivery_note_order_link/views/purchase_order.xml @@ -0,0 +1,36 @@ + + + + + + purchase.order.form + purchase.order + + + + + + + + + + diff --git a/l10n_it_delivery_note_order_link/views/sale_order.xml b/l10n_it_delivery_note_order_link/views/sale_order.xml new file mode 100644 index 000000000000..6bd57ca1ae22 --- /dev/null +++ b/l10n_it_delivery_note_order_link/views/sale_order.xml @@ -0,0 +1,33 @@ + + + + + + sale.order.form + sale.order + + + + + + + + + + diff --git a/setup/l10n_it_delivery_note_order_link/odoo/addons/l10n_it_delivery_note_order_link b/setup/l10n_it_delivery_note_order_link/odoo/addons/l10n_it_delivery_note_order_link new file mode 120000 index 000000000000..3304deaeb187 --- /dev/null +++ b/setup/l10n_it_delivery_note_order_link/odoo/addons/l10n_it_delivery_note_order_link @@ -0,0 +1 @@ +../../../../l10n_it_delivery_note_order_link \ No newline at end of file diff --git a/setup/l10n_it_delivery_note_order_link/setup.py b/setup/l10n_it_delivery_note_order_link/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_delivery_note_order_link/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)