mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
stock_measuring_device: Retrieve product when device is already assigned
This commit is contained in:
committed by
Hai Lang
parent
1e1236776e
commit
a0ffc17f18
@@ -89,6 +89,7 @@ class MeasuringWizard(models.TransientModel):
|
||||
"barcode": pack.barcode,
|
||||
"packaging_id": pack.id,
|
||||
"packaging_type_id": pack_type.id,
|
||||
"scan_requested": bool(pack.measuring_device_id),
|
||||
}
|
||||
)
|
||||
vals_list.append(vals)
|
||||
@@ -160,6 +161,15 @@ class MeasuringWizard(models.TransientModel):
|
||||
"flags": {"headless": False, "clear_breadcrumbs": True},
|
||||
}
|
||||
|
||||
def retrieve_product(self):
|
||||
"""Assigns product that locks the device if a scan is already requested."""
|
||||
if self.device_id._is_being_used():
|
||||
pack = self.env["product.packaging"]._measuring_device_find_assigned(
|
||||
self.device_id
|
||||
)
|
||||
self.product_id = pack.product_id
|
||||
self.onchange_product_id()
|
||||
|
||||
def reload(self):
|
||||
return {
|
||||
"type": "ir.actions.act_view_reload",
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
string="Refresh"
|
||||
icon="fa-refresh"
|
||||
/>
|
||||
<button
|
||||
name="retrieve_product"
|
||||
type="object"
|
||||
string="Retrieve Product"
|
||||
icon="fa-search"
|
||||
/>
|
||||
</group>
|
||||
<group name="col2" />
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user