Update Reference fields from 0 to -1

review119001
This commit is contained in:
Cédric Krier committed 2011-09-21 12:26:23 +02:00
1 parent 9cfdb6481e
commit 6af2c22cd6
2 files changed
+12 -3

No files matched your search

+10 -1
View File
@@ -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,
+2 -2
View File
@@ -178,7 +178,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.keyword" id="create_purchase_keyword">
<field name="keyword">form_action</field>
<field name="model">purchase.request,0</field>
<field name="model">purchase.request,-1</field>
<field name="action" ref="wizard_create_purchase"/>
</record>
@@ -200,7 +200,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.keyword"
id="act_open_purchase_keyword1">
<field name="keyword">form_relate</field>
<field name="model">purchase.request,0</field>
<field name="model">purchase.request,-1</field>
<field name="action" ref="act_purchase_form"/>
</record>