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/__manifest__.py b/beesdoo_stock/__manifest__.py new file mode 100644 index 0000000..aa41105 --- /dev/null +++ b/beesdoo_stock/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Coop IT Easy SCRLfs +# Nicolas Jamoulle, +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "BEES coop Stock", + "version": "12.0.1.0.0", + "depends": [ + 'stock', + ], + "author": "Coop IT Easy SCRLfs", + "license": "AGPL-3", + "website": "www.coopiteasy.be", + "description": """ + Enable action on multiple products of a stock receipt + """, + "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..6139855 --- /dev/null +++ b/beesdoo_stock/models/stock.py @@ -0,0 +1,28 @@ +from odoo 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).move_line_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', 'in', ctx['articles'])], + } diff --git a/beesdoo_stock/views/stock_view.xml b/beesdoo_stock/views/stock_view.xml new file mode 100644 index 0000000..f31d21b --- /dev/null +++ b/beesdoo_stock/views/stock_view.xml @@ -0,0 +1,13 @@ + + + + stock.picking.form.inherit + stock.picking + + + + + +