From 6af2c22cd624dca8e3edf9a967e078d2f5454790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 21 Sep 2011 12:26:23 +0200 Subject: [PATCH] Update Reference fields from 0 to -1 review119001 --- purchase_request.py | 11 ++++++++++- purchase_request.xml | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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