mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_vertical_lift: increase coverage
This commit is contained in:
@@ -423,9 +423,7 @@ class VerticalLiftOperationTransfer(models.AbstractModel):
|
|||||||
def _compute_product_packagings(self):
|
def _compute_product_packagings(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
product = record.current_move_line_id.product_id
|
product = record.current_move_line_id.product_id
|
||||||
if not product:
|
# Empty product is taken care in _render_product_packagings
|
||||||
record.product_packagings = ""
|
|
||||||
continue
|
|
||||||
content = self._render_product_packagings(product)
|
content = self._render_product_packagings(product)
|
||||||
record.product_packagings = content
|
record.product_packagings = content
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import _
|
from odoo import _
|
||||||
|
from odoo.tests.common import Form
|
||||||
|
|
||||||
from .common import VerticalLiftCase
|
from .common import VerticalLiftCase
|
||||||
|
|
||||||
@@ -40,6 +41,31 @@ class TestInventory(VerticalLiftCase):
|
|||||||
self.assertEqual(action["res_model"], "vertical.lift.shuttle.manual.barcode")
|
self.assertEqual(action["res_model"], "vertical.lift.shuttle.manual.barcode")
|
||||||
self.assertEqual(action["name"], "Barcode")
|
self.assertEqual(action["name"], "Barcode")
|
||||||
|
|
||||||
|
operation = self._open_screen("put")
|
||||||
|
self.assertEqual(operation._name, "vertical.lift.operation.put")
|
||||||
|
self.assertEqual(operation.state, "scan_source")
|
||||||
|
VerticalLiftShuttleManualBarcode = self.env[action["res_model"]]
|
||||||
|
|
||||||
|
ClassWithContextOnlyModel = VerticalLiftShuttleManualBarcode.with_context(
|
||||||
|
active_model=operation._name,
|
||||||
|
)
|
||||||
|
vls_manual_form = Form(ClassWithContextOnlyModel)
|
||||||
|
rec_id = vls_manual_form._values.get("id")
|
||||||
|
vls_manual = ClassWithContextOnlyModel.browse(rec_id)
|
||||||
|
vls_manual.button_save()
|
||||||
|
|
||||||
|
ClassWithContext = VerticalLiftShuttleManualBarcode.with_context(
|
||||||
|
active_ids=operation.ids,
|
||||||
|
active_id=operation.ids[0],
|
||||||
|
active_model=operation._name,
|
||||||
|
)
|
||||||
|
vls_manual_form = Form(ClassWithContext)
|
||||||
|
vls_manual_form.barcode = self.product_socks.barcode
|
||||||
|
vls_manual_form.save()
|
||||||
|
rec_id = vls_manual_form._values.get("id")
|
||||||
|
vls_manual = ClassWithContext.browse(rec_id)
|
||||||
|
vls_manual.button_save()
|
||||||
|
|
||||||
def test_inventory_count_ops(self):
|
def test_inventory_count_ops(self):
|
||||||
self._update_qty_in_location(self.location_1a_x1y1, self.product_socks, 10)
|
self._update_qty_in_location(self.location_1a_x1y1, self.product_socks, 10)
|
||||||
self._update_qty_in_location(self.location_1a_x2y1, self.product_recovery, 10)
|
self._update_qty_in_location(self.location_1a_x2y1, self.product_recovery, 10)
|
||||||
|
|||||||
@@ -258,3 +258,11 @@ class TestPick(VerticalLiftCase):
|
|||||||
self.assertEqual(operation.tray_qty, 50)
|
self.assertEqual(operation.tray_qty, 50)
|
||||||
self._update_quantity_in_cell(cell, self.out_move_line.product_id, -20)
|
self._update_quantity_in_cell(cell, self.out_move_line.product_id, -20)
|
||||||
self.assertEqual(operation.tray_qty, 30)
|
self.assertEqual(operation.tray_qty, 30)
|
||||||
|
self.assertTrue(operation.product_packagings)
|
||||||
|
|
||||||
|
def test_product_packagings(self):
|
||||||
|
operation = self.shuttle._operation_for_mode()
|
||||||
|
ml = operation.current_move_line_id
|
||||||
|
ml.move_id.state = "draft"
|
||||||
|
ml.product_id = False
|
||||||
|
self.assertFalse(operation.product_packagings)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class VerticalLiftShuttleManualBarcode(models.TransientModel):
|
|||||||
def button_save(self):
|
def button_save(self):
|
||||||
active_id = self.env.context.get("active_id")
|
active_id = self.env.context.get("active_id")
|
||||||
model = self.env.context.get("active_model")
|
model = self.env.context.get("active_model")
|
||||||
|
assert model
|
||||||
record = self.env[model].browse(active_id).exists()
|
record = self.env[model].browse(active_id).exists()
|
||||||
if not record:
|
if not record:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user