[FIX] stock: log activity with SO without line

Use case to reproduce:
- Install sale_stock
- Create a SO
- Cancel it
Traceback

It happens because _log_activity_get_documents need at least
one entry in the dict orig_obj_changes.
This commit is contained in:
Arnold Moyaux
2018-02-19 10:18:00 +01:00
parent aa8745f1a8
commit e242ee5f74
+1 -1
View File
@@ -87,7 +87,7 @@ class SaleOrder(models.Model):
def action_cancel(self):
documents = None
for sale_order in self:
if sale_order.state == 'sale':
if sale_order.state == 'sale' and sale_order.order_line:
sale_order_lines_quantities = {order_line: (order_line.product_uom_qty, 0) for order_line in sale_order.order_line}
documents = self.env['stock.picking']._log_activity_get_documents(sale_order_lines_quantities, 'move_ids', 'UP')
self.mapped('picking_ids').action_cancel()