8.0 'sale stock' (onesteinbv)

Port 'sale_stock' modification realized by OneStein BV. (branch onesteinbv:8.0-os)

Always use variable substitution from the cursor itself (unless substituting table names).

But could this method not be written as a single query?

UPDATE sale_order so
SET warehouse_id = sh.warehouse_id
FROM sale_shop sh
WHERE so.shop_id = sh.id;