From 0bd45db3bccd98b2405a61ca2e5db635ac321d98 Mon Sep 17 00:00:00 2001 From: nicolasjamoulle Date: Fri, 22 Mar 2019 15:32:08 +0100 Subject: [PATCH] [ADD] beesdoo_stock: actions on articles in stock.picking [ADD] Add files and action menu [IMP] Tests to fill wizard with products lines [ADD] Get product.template method [ADD] Load right template wizard [ADD] Method to get lines product [ADD] beesdoo_stock: actions on articles in stock.picking --- beesdoo_stock/__init__.py | 1 + beesdoo_stock/__openerp__.py | 21 +++++++++++++++++++++ beesdoo_stock/models/__init__.py | 1 + beesdoo_stock/models/stock.py | 29 +++++++++++++++++++++++++++++ beesdoo_stock/views/stock_view.xml | 13 +++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 beesdoo_stock/__init__.py create mode 100644 beesdoo_stock/__openerp__.py create mode 100644 beesdoo_stock/models/__init__.py create mode 100644 beesdoo_stock/models/stock.py create mode 100644 beesdoo_stock/views/stock_view.xml diff --git a/beesdoo_stock/__init__.py b/beesdoo_stock/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/beesdoo_stock/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/beesdoo_stock/__openerp__.py b/beesdoo_stock/__openerp__.py new file mode 100644 index 0000000..9670b09 --- /dev/null +++ b/beesdoo_stock/__openerp__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Coop IT Easy SCRLfs +# Nicolas Jamoulle, +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Action on products in receipt", + "version": "9.0.1.0", + "depends": [ + 'stock', + ], + "author": "Coop IT Easy SCRLfs", + "license": "AGPL-3", + "website": "www.coopiteasy.be", + "description": """ + Enable action on multiple lines of a receipt via checkboxes + """, + "data": [ + 'views/stock_view.xml', + ], + 'installable': True, +} diff --git a/beesdoo_stock/models/__init__.py b/beesdoo_stock/models/__init__.py new file mode 100644 index 0000000..12bab77 --- /dev/null +++ b/beesdoo_stock/models/__init__.py @@ -0,0 +1 @@ +from . import stock diff --git a/beesdoo_stock/models/stock.py b/beesdoo_stock/models/stock.py new file mode 100644 index 0000000..18f15c1 --- /dev/null +++ b/beesdoo_stock/models/stock.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from openerp import api, fields, models + + +class StockPackOperation(models.Model): + _inherit = 'stock.picking' + + @api.multi + def actions_on_articles(self): + ids = self._ids + context = self._context + ctx = (context or {}).copy() + ctx['articles'] = [] + for line in self.browse(ids).pack_operation_ids: + ctx['articles'].append(line.product_id.product_tmpl_id.id) + if ctx['articles']: + return { + 'name': 'Articles', + 'view_type': 'list', + 'view_mode': 'list', + 'res_model': 'product.template', + 'view_id': False, + 'target': 'current', + 'type': 'ir.actions.act_window', + 'context': ctx, + 'nodestroy': True, + 'res_id': ctx['articles'], + 'domain': [('id', '=', ctx['articles'])], + } diff --git a/beesdoo_stock/views/stock_view.xml b/beesdoo_stock/views/stock_view.xml new file mode 100644 index 0000000..160ae63 --- /dev/null +++ b/beesdoo_stock/views/stock_view.xml @@ -0,0 +1,13 @@ + + + + stock.picking.form.inherit + stock.picking + + + + + +