Use get_id of ir.model.data

This commit is contained in:
Cédric Krier committed 2010-01-21 12:10:01 +01:00
1 parent 010ed7e49d
commit 8a26b11dd9
3 files changed
+9 -26

No files matched your search

+3 -9
View File
@@ -376,15 +376,9 @@ class OpenProduct(Wizard):
def _action_open_product(self, cursor, user, data, context=None):
model_data_obj = self.pool.get('ir.model.data')
act_window_obj = self.pool.get('ir.action.act_window')
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_product_by_location'),
('module', '=', 'stock'),
('inherit', '=', False),
], limit=1, context=context)
model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
context=context)
res = act_window_obj.read(cursor, user, model_data.db_id, context=context)
act_window_id = model_data_obj.get_id(cursor, user, 'stock',
'act_product_by_location', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
ctx = {}
ctx['locations'] = data['ids']
+3 -9
View File
@@ -570,15 +570,9 @@ class OpenLocation(Wizard):
def _action_open_location(self, cursor, user, data, context=None):
model_data_obj = self.pool.get('ir.model.data')
act_window_obj = self.pool.get('ir.action.act_window')
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_location_quantity_tree'),
('module', '=', 'stock'),
('inherit', '=', False),
], limit=1, context=context)
model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
context=context)
res = act_window_obj.read(cursor, user, model_data.db_id, context=context)
act_window_id = model_data_obj.get_id(cursor, user, 'stock',
'act_location_quantity_tree', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
ctx = {}
ctx['product'] = data['id']
+3 -8
View File
@@ -1724,14 +1724,9 @@ class CreateShipmentOutReturn(Wizard):
context=context)
)
model_data_ids = model_data_obj.search(cursor, user, [
('fs_id', '=', 'act_shipment_out_return_form'),
('module', '=', 'stock'),
('inherit', '=', False),
], limit=1, context=context)
model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
context=context)
res = act_window_obj.read(cursor, user, model_data.db_id, context=context)
act_window_id = model_data_obj.get_id(cursor, user, 'stock',
'act_shipment_out_return_form', context=context)
res = act_window_obj.read(cursor, user, act_window_id, context=context)
res['res_id'] = shipment_out_return_ids
if len(shipment_out_return_ids) == 1:
res['views'].reverse()