Browse Source

Merge pull request #144 from beescoop/12.0-mig-beesdoo_stock-vvrossem

[12.0] [MIG] beesdoo_stock
pull/149/head
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
ab34e00593
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      beesdoo_stock/__init__.py
  2. 20
      beesdoo_stock/__manifest__.py
  3. 1
      beesdoo_stock/models/__init__.py
  4. 28
      beesdoo_stock/models/stock.py
  5. 13
      beesdoo_stock/views/stock_view.xml

1
beesdoo_stock/__init__.py

@ -0,0 +1 @@
from . import models

20
beesdoo_stock/__manifest__.py

@ -0,0 +1,20 @@
# Copyright 2019 Coop IT Easy SCRLfs
# Nicolas Jamoulle, <nicolas@coopiteasy.be>
# 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,
}

1
beesdoo_stock/models/__init__.py

@ -0,0 +1 @@
from . import stock

28
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'])],
}

13
beesdoo_stock/views/stock_view.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_picking_form_inherited" model="ir.ui.view">
<field name="name">stock.picking.form.inherit</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"></field>
<field name="arch" type="xml">
<button name="button_validate" position="after">
<button name="actions_on_articles" string="Actions on articles" type="object" class="oe_highlight"/>
</button>
</field>
</record>
</odoo>
Loading…
Cancel
Save