mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
stock_vertical_lift: make pkg compute more solid (#16)
* stock_vertical_lift: make pkg compute more solid Somehow sometimes you can get a move line without product while computing product packaging in inventory. Make it more defensive and skip packaging rendering if no product is there.
This commit is contained in:
@@ -229,6 +229,8 @@ class VerticalLiftOperationBase(models.AbstractModel):
|
||||
self.next_step()
|
||||
|
||||
def _render_product_packagings(self, product):
|
||||
if not product:
|
||||
return ""
|
||||
return self.env["ir.qweb"].render(
|
||||
"stock_vertical_lift.packagings",
|
||||
self._prepare_values_for_product_packaging(product),
|
||||
@@ -343,10 +345,10 @@ class VerticalLiftOperationTransfer(models.AbstractModel):
|
||||
@api.depends("current_move_line_id.product_id.packaging_ids")
|
||||
def _compute_product_packagings(self):
|
||||
for record in self:
|
||||
if not record.current_move_line_id:
|
||||
product = record.current_move_line_id.product_id
|
||||
if not product:
|
||||
record.product_packagings = ""
|
||||
continue
|
||||
product = record.current_move_line_id.product_id
|
||||
content = self._render_product_packagings(product)
|
||||
record.product_packagings = content
|
||||
|
||||
|
||||
@@ -143,10 +143,10 @@ class VerticalLiftOperationInventory(models.Model):
|
||||
@api.depends("current_inventory_line_id.product_id.packaging_ids")
|
||||
def _compute_product_packagings(self):
|
||||
for record in self:
|
||||
if not record.current_inventory_line_id:
|
||||
product = record.current_inventory_line_id.product_id
|
||||
if not product:
|
||||
record.product_packagings = ""
|
||||
continue
|
||||
product = record.current_inventory_line_id.product_id
|
||||
content = self._render_product_packagings(product)
|
||||
record.product_packagings = content
|
||||
|
||||
|
||||
Reference in New Issue
Block a user