[FIX] stock: fix dropship picking type in kanban view
Community PR: https://github.com/odoo/odoo/pull/112805 Since https://github.com/odoo/odoo/commit/a26db9a3a71a3b1a7b1ca5ac9931e137f2af3b1c, the Kanban view for picking types did not include the new dropship picking type from v16. This commit fixes this by adding a `show_picking_type` computed boolean field on the picking type. closes odoo/odoo#112805 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -95,6 +95,7 @@ class PickingType(models.Model):
|
||||
" * Ask: users are asked to choose if they want to make a backorder for remaining products\n"
|
||||
" * Always: a backorder is automatically created for the remaining products\n"
|
||||
" * Never: remaining products are cancelled")
|
||||
show_picking_type = fields.Boolean(compute='_compute_show_picking_type')
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
@@ -267,6 +268,11 @@ class PickingType(models.Model):
|
||||
def get_stock_picking_action_picking_type(self):
|
||||
return self._get_action('stock.stock_picking_action_picking_type')
|
||||
|
||||
@api.depends('code')
|
||||
def _compute_show_picking_type(self):
|
||||
for record in self:
|
||||
record.show_picking_type = record.code in ['incoming', 'outgoing', 'internal']
|
||||
|
||||
|
||||
class Picking(models.Model):
|
||||
_name = "stock.picking"
|
||||
|
||||
@@ -137,9 +137,10 @@
|
||||
<field name="count_picking_waiting"/>
|
||||
<field name="count_picking_late"/>
|
||||
<field name="count_picking_backorders"/>
|
||||
<field name="show_picking_type" invisible="1"/>
|
||||
<templates>
|
||||
<t t-name="kanban-menu" t-if="!selection_mode">
|
||||
<div class="container" t-if="['incoming', 'outgoing', 'internal'].indexOf(record.code.raw_value) > -1">
|
||||
<div class="container" t-if="record.show_picking_type.raw_value">
|
||||
<div class="row">
|
||||
<div class="col-6 o_kanban_card_manage_section o_kanban_manage_view">
|
||||
<div role="menuitem" class="o_kanban_card_manage_title">
|
||||
@@ -183,7 +184,7 @@
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="kanban-box">
|
||||
<div t-if="['incoming', 'outgoing', 'internal'].indexOf(record.code.raw_value) > -1" t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''}" name="stock_picking">
|
||||
<div t-if="record.show_picking_type.raw_value" t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''}" name="stock_picking">
|
||||
<div t-attf-class="o_kanban_card_header">
|
||||
<div class="o_kanban_card_header_title">
|
||||
<div class="o_primary" t-if="!selection_mode">
|
||||
@@ -201,9 +202,7 @@
|
||||
<div class="row">
|
||||
<div class="col-6 o_kanban_primary_left">
|
||||
<button class="btn btn-primary" name="get_action_picking_tree_ready" type="object">
|
||||
<span t-if="record.code.raw_value == 'incoming'"><t t-esc="record.count_picking_ready.value"/> To Process</span>
|
||||
<span t-elif="record.code.raw_value == 'outgoing'"><t t-esc="record.count_picking_ready.value"/> To Process</span>
|
||||
<span t-elif="record.code.raw_value == 'internal'"><t t-esc="record.count_picking_ready.value"/> To Process</span>
|
||||
<span><t t-esc="record.count_picking_ready.value"/> To Process</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-6 o_kanban_primary_right">
|
||||
|
||||
@@ -50,3 +50,10 @@ class StockPickingType(models.Model):
|
||||
super()._compute_warehouse_id()
|
||||
if self.default_location_src_id.usage == 'supplier' and self.default_location_dest_id.usage == 'customer':
|
||||
self.warehouse_id = False
|
||||
|
||||
@api.depends('code')
|
||||
def _compute_show_picking_type(self):
|
||||
super()._compute_show_picking_type()
|
||||
for record in self:
|
||||
if record.code == "dropship":
|
||||
record.show_picking_type = True
|
||||
|
||||
Reference in New Issue
Block a user