diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index 7c9aa5a7c04..d8ab7a42284 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -10,6 +10,7 @@ class StockMoveLine(models.Model):
workorder_id = fields.Many2one('mrp.workorder', 'Work Order', check_company=True)
production_id = fields.Many2one('mrp.production', 'Production Order', check_company=True)
+ description_bom_line = fields.Char(related='move_id.description_bom_line')
@api.depends('production_id')
def _compute_picking_type_id(self):
@@ -123,6 +124,22 @@ class StockMove(models.Model):
help="The percentage of the final production cost for this by-product. The total of all by-products' cost share must be smaller or equal to 100.")
product_qty_available = fields.Float('Product On Hand Quantity', related='product_id.qty_available')
product_virtual_available = fields.Float('Product Forecasted Quantity', related='product_id.virtual_available')
+ description_bom_line = fields.Char('Kit', compute='_compute_description_bom_line')
+
+ @api.depends('bom_line_id')
+ def _compute_description_bom_line(self):
+ bom_line_description = {}
+ for bom in self.bom_line_id.bom_id:
+ if bom.type != 'phantom':
+ continue
+ line_ids = bom.bom_line_ids.ids
+ total = len(line_ids)
+ name = bom.display_name
+ for i, line_id in enumerate(line_ids):
+ bom_line_description[line_id] = '%s - %d/%d' % (name, i+1, total)
+
+ for move in self:
+ move.description_bom_line = bom_line_description.get(move.bom_line_id.id)
@api.depends('raw_material_production_id.priority')
def _compute_priority(self):
diff --git a/addons/mrp/models/stock_picking.py b/addons/mrp/models/stock_picking.py
index 06d6ee7df9d..6420682b087 100644
--- a/addons/mrp/models/stock_picking.py
+++ b/addons/mrp/models/stock_picking.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import fields, models
+from odoo import api, fields, models
class StockPickingType(models.Model):
@@ -53,6 +53,13 @@ class StockPickingType(models.Model):
class StockPicking(models.Model):
_inherit = 'stock.picking'
+ has_kits = fields.Boolean(compute='_compute_has_kits')
+
+ @api.depends('move_lines')
+ def _compute_has_kits(self):
+ for picking in self:
+ picking.has_kits = any(picking.move_lines.mapped('bom_line_id'))
+
def _less_quantities_than_expected_add_documents(self, moves, documents):
documents = super(StockPicking, self)._less_quantities_than_expected_add_documents(moves, documents)
diff --git a/addons/mrp/views/stock_picking_views.xml b/addons/mrp/views/stock_picking_views.xml
index 120b07916e0..b00d5bde610 100644
--- a/addons/mrp/views/stock_picking_views.xml
+++ b/addons/mrp/views/stock_picking_views.xml
@@ -98,6 +98,32 @@
+
+
+ view.picking.form.inherit.mrp
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+
+ stock.move.line.operations.tree.mrp
+ stock.move.line
+
+
+
+
+
+
+
+
Operation Types
stock.picking.type