diff --git a/purchase_request.py b/purchase_request.py
index d4fb301bac..9c714f0ffa 100644
--- a/purchase_request.py
+++ b/purchase_request.py
@@ -53,6 +53,15 @@ class PurchaseRequest(ModelSQL, ModelView):
'create_request': 'Purchase requests are only created by the system.',
})
+ def init(self, module_name):
+ cursor = Transaction().cursor
+ super(PurchaseRequest, self).init(module_name)
+
+ # Migration from 2.0: empty order point origin is -1 instead of 0
+ cursor.execute('UPDATE "%s" '
+ 'SET origin = %%s WHERE origin = %%s' % self._table,
+ ('stock.order_point,-1', 'stock.order_point,0'))
+
def get_rec_name(self, ids, name):
if isinstance(ids, (int, long)):
ids = [ids]
@@ -333,7 +342,7 @@ class PurchaseRequest(ModelSQL, ModelView):
if order_point:
origin = 'stock.order_point,%s'%order_point.id
else:
- origin = 'stock.order_point,0'
+ origin = 'stock.order_point,-1'
return {'product': product,
'party': supplier and supplier or None,
'quantity': quantity,
diff --git a/purchase_request.xml b/purchase_request.xml
index 16ff11c71a..b904bcb233 100644
--- a/purchase_request.xml
+++ b/purchase_request.xml
@@ -178,7 +178,7 @@ this repository contains the full copyright notices and license terms. -->
form_action
- purchase.request,0
+ purchase.request,-1
@@ -200,7 +200,7 @@ this repository contains the full copyright notices and license terms. -->
form_relate
- purchase.request,0
+ purchase.request,-1