[IMP] stock_picking_batch: add quick access to batch
This commit adds a quick access to all the batches and waves of a picking type (only transfers picking type) ready to be processed from the Inventory dashboard. Task : 2411102 Part-of: odoo/odoo#63291
This commit is contained in:
@@ -759,7 +759,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div t-if="record.count_picking_backorders.raw_value > 0" class="row">
|
||||
<div t-if="record.count_picking_backorders.raw_value > 0" class="row" name="picking_type_backorder_count">
|
||||
<div class="col-12">
|
||||
<a class="oe_kanban_stock_picking_type_list" name="get_action_picking_tree_backorder" type="object">
|
||||
<field name="count_picking_backorders"/>
|
||||
|
||||
@@ -4,6 +4,36 @@
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = "stock.picking.type"
|
||||
|
||||
count_picking_batch = fields.Integer(compute='_compute_picking_count')
|
||||
count_picking_wave = fields.Integer(compute='_compute_picking_count')
|
||||
|
||||
def _compute_picking_count(self):
|
||||
super()._compute_picking_count()
|
||||
domains = {
|
||||
'count_picking_batch': [('is_wave', '=', False)],
|
||||
'count_picking_wave': [('is_wave', '=', True)],
|
||||
}
|
||||
for field in domains:
|
||||
data = self.env['stock.picking.batch'].read_group(domains[field] +
|
||||
[('state', 'not in', ('done', 'cancel')), ('picking_type_id', 'in', self.ids)],
|
||||
['picking_type_id'], ['picking_type_id'])
|
||||
count = {
|
||||
x['picking_type_id'][0]: x['picking_type_id_count']
|
||||
for x in data if x['picking_type_id']
|
||||
}
|
||||
for record in self:
|
||||
record[field] = count.get(record.id, 0)
|
||||
|
||||
def get_action_picking_tree_batch(self):
|
||||
return self._get_action('stock_picking_batch.stock_picking_batch_action')
|
||||
|
||||
def get_action_picking_tree_wave(self):
|
||||
return self._get_action('stock_picking_batch.action_picking_tree_wave')
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
|
||||
@@ -34,6 +34,31 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_type_kanban_batch" model="ir.ui.view">
|
||||
<field name="name">picking.type.kanban.batch</field>
|
||||
<field name="model">stock.picking.type</field>
|
||||
<field name="inherit_id" ref="stock.stock_picking_type_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='picking_type_backorder_count']" position="after">
|
||||
<div t-if="record.count_picking_batch.raw_value > 0" class="row">
|
||||
<div class="col-12">
|
||||
<a class="oe_kanban_stock_picking_type_list" name="get_action_picking_tree_batch" type="object">
|
||||
<field name="count_picking_batch"/>
|
||||
Batches
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="record.count_picking_wave.raw_value > 0" class="row">
|
||||
<div class="col-12">
|
||||
<a class="oe_kanban_stock_picking_type_list" name="get_action_picking_tree_wave" type="object">
|
||||
<field name="count_picking_wave"/>
|
||||
Waves
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<menuitem
|
||||
action="action_picking_tree_wave"
|
||||
id="stock_picking_wave_menu"
|
||||
|
||||
Reference in New Issue
Block a user