From b68d2d001af518d163e9f8ee3b23a6464c760ef1 Mon Sep 17 00:00:00 2001 From: "gborruso@dinamicheaziendali.it" Date: Fri, 11 Dec 2020 10:37:57 +0100 Subject: [PATCH] [IMP] l10n_it_delivery_note_order_link: black, isort, prettier --- .../__manifest__.py | 31 ++++++------- .../models/purchase_order.py | 46 +++++++++++-------- .../models/sale_order.py | 12 +++-- .../models/stock_delivery_note.py | 8 ++-- .../readme/CONFIGURE.rst | 1 - .../readme/DESCRIPTION.rst | 1 - .../readme/USAGE.rst | 1 - .../views/purchase_order.xml | 24 ++++++---- .../views/sale_order.xml | 24 ++++++---- .../addons/l10n_it_delivery_note_order_link | 1 + .../l10n_it_delivery_note_order_link/setup.py | 6 +++ 11 files changed, 87 insertions(+), 68 deletions(-) create mode 120000 setup/l10n_it_delivery_note_order_link/odoo/addons/l10n_it_delivery_note_order_link create mode 100644 setup/l10n_it_delivery_note_order_link/setup.py diff --git a/l10n_it_delivery_note_order_link/__manifest__.py b/l10n_it_delivery_note_order_link/__manifest__.py index 03efddaab886..5d77b05c8d52 100644 --- a/l10n_it_delivery_note_order_link/__manifest__.py +++ b/l10n_it_delivery_note_order_link/__manifest__.py @@ -4,22 +4,21 @@ # noinspection PyStatementEffect { - 'name': 'ITA - Documento di trasporto - Collegamento con ordine di vendita', - 'summary': 'Crea collegamento tra i DDT e ordine di vendita', - 'author': 'Openindustry.it Sas, Odoo Community Association (OCA)', - 'website': "https://github.com/OCA/l10n-italy/tree/12.0/" - "l10n_it_delivery_note_order_link", - 'version': '12.0.1.0.0', - 'license': 'AGPL-3', - 'maintainers': ['As400it', 'andreampiovesana'], - 'category': 'Localization', - 'depends': [ - 'purchase_stock', - 'sale_stock', - 'l10n_it_delivery_note', + "name": "ITA - Documento di trasporto - Collegamento con ordine di vendita", + "summary": "Crea collegamento tra i DDT e ordine di vendita", + "author": "Openindustry.it Sas, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy" "l10n_it_delivery_note_order_link", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "maintainers": ["As400it", "andreampiovesana"], + "category": "Localization", + "depends": [ + "purchase_stock", + "sale_stock", + "l10n_it_delivery_note", ], - 'data': [ - 'views/purchase_order.xml', - 'views/sale_order.xml', + "data": [ + "views/purchase_order.xml", + "views/sale_order.xml", ], } diff --git a/l10n_it_delivery_note_order_link/models/purchase_order.py b/l10n_it_delivery_note_order_link/models/purchase_order.py index 95acf615cd08..88af81e481ea 100644 --- a/l10n_it_delivery_note_order_link/models/purchase_order.py +++ b/l10n_it_delivery_note_order_link/models/purchase_order.py @@ -5,49 +5,55 @@ class PurchaseOrder(models.Model): - _inherit = 'purchase.order' + _inherit = "purchase.order" - delivery_note_ids = fields.Many2many('stock.delivery.note', - compute='_compute_delivery_notes') - delivery_note_count = fields.Integer(compute='_compute_delivery_notes') + delivery_note_ids = fields.Many2many( + "stock.delivery.note", compute="_compute_delivery_notes" + ) + delivery_note_count = fields.Integer(compute="_compute_delivery_notes") @api.multi def _compute_delivery_notes(self): for order in self: delivery_notes = order.order_line.mapped( - 'delivery_note_line_ids.delivery_note_id') + "delivery_note_line_ids.delivery_note_id" + ) order.delivery_note_ids = delivery_notes order.delivery_note_count = len(delivery_notes) @api.multi def goto_delivery_notes(self, **kwargs): - delivery_notes = self.mapped('delivery_note_ids') + delivery_notes = self.mapped("delivery_note_ids") action = self.env.ref( - 'l10n_it_delivery_note.stock_delivery_note_action').read()[0] + "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)] + 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 + 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'} + action = {"type": "ir.actions.act_window_close"} return action class PurchaseOrderLine(models.Model): - _inherit = 'purchase.order.line' + _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) + 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 index b404fbe1c4e5..df2caa11b1ba 100644 --- a/l10n_it_delivery_note_order_link/models/sale_order.py +++ b/l10n_it_delivery_note_order_link/models/sale_order.py @@ -5,17 +5,19 @@ class SaleOrder(models.Model): - _inherit = 'sale.order' + _inherit = "sale.order" - delivery_note_ids = fields.Many2many('stock.delivery.note', - compute='_compute_delivery_notes') - delivery_note_count = fields.Integer(compute='_compute_delivery_notes') + delivery_note_ids = fields.Many2many( + "stock.delivery.note", compute="_compute_delivery_notes" + ) + delivery_note_count = fields.Integer(compute="_compute_delivery_notes") @api.multi def _compute_delivery_notes(self): for order in self: delivery_notes = order.order_line.mapped( - 'delivery_note_line_ids.delivery_note_id') + "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 index 09eb12573d6f..f27dfd05b7c5 100644 --- a/l10n_it_delivery_note_order_link/models/stock_delivery_note.py +++ b/l10n_it_delivery_note_order_link/models/stock_delivery_note.py @@ -3,8 +3,8 @@ class StockDeliveryNoteLine(models.Model): - _inherit = 'stock.delivery.note.line' + _inherit = "stock.delivery.note.line" - purchase_line_id = fields.Many2one('purchase.order.line', - related='move_id.purchase_line_id', - store=True) + 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 index 6ad0f20c991e..83608f0df07f 100644 --- a/l10n_it_delivery_note_order_link/readme/CONFIGURE.rst +++ b/l10n_it_delivery_note_order_link/readme/CONFIGURE.rst @@ -5,4 +5,3 @@ 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/DESCRIPTION.rst b/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst index 9f4c22a388b4..804519b8136a 100644 --- a/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst +++ b/l10n_it_delivery_note_order_link/readme/DESCRIPTION.rst @@ -5,4 +5,3 @@ This module link delivery notes to purchase orders. **Italiano** Questo modulo consente di collegare gli ordini di 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 index 44f1fc562a12..052e40a678d3 100644 --- a/l10n_it_delivery_note_order_link/readme/USAGE.rst +++ b/l10n_it_delivery_note_order_link/readme/USAGE.rst @@ -5,4 +5,3 @@ A smart button will appear on each purchase order, so you can link them to DNs. **Italiano** Su ciascun ordine di acquisto comparirà un pulsante (smart button) che permette di collegarlo ai DDT. - diff --git a/l10n_it_delivery_note_order_link/views/purchase_order.xml b/l10n_it_delivery_note_order_link/views/purchase_order.xml index a52cc0104d60..fff6e53cd2fc 100644 --- a/l10n_it_delivery_note_order_link/views/purchase_order.xml +++ b/l10n_it_delivery_note_order_link/views/purchase_order.xml @@ -1,10 +1,8 @@ - - + - @@ -13,13 +11,19 @@ - diff --git a/l10n_it_delivery_note_order_link/views/sale_order.xml b/l10n_it_delivery_note_order_link/views/sale_order.xml index ee1ee40e27be..8e276f29f848 100644 --- a/l10n_it_delivery_note_order_link/views/sale_order.xml +++ b/l10n_it_delivery_note_order_link/views/sale_order.xml @@ -1,10 +1,8 @@ - - + - @@ -13,13 +11,19 @@ - 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, +)