Skip to Content
Menu
This question has been flagged
2 Replies
431 Views

I create a model named "mypurchase", and in this model I add button to the view page to go to another model "mystock", pass the purchased items and their qty to "mystock".

in the scripts I make the action dict, I double checked it, make sure it's the full same as official "action" keys, without no errors.

but when I clicked the button, the page change to "mystock" successfully, but all cells are blank ----- no data values were passed to the "mystock" view page, 

pls help me, I don't know why this, thanks advanced.


my action dict as below:

{'id': 431, 
'name': 'mystock', 
'type': 'ir.actions.act_window', 
'xml_id': 'mystock.mystock_act_window', 
'help': False, 
'binding_model_id': False, 
'binding_type': 'action', 
'binding_view_types': 'list,form', 
'display_name': 'mystock', 
'view_id': 1149, 
'domain': '[]', 
'context': {'billno': 'ABCDE', 'mystockid': [[0, 'virtual_24', {'item': 2, 'qty': 12, 'location': 'RAW'}], [0, 'virtual_26', {'item': 3, 'qty': 22, 'location': 'FG'}]]},
'res_id': 0, 
'res_model': 'mystock', 
'target': 'current', 
'view_mode': 'tree,form', 
'views': [(1149, 'form'), (False, 'tree')], 
'limit': 80, 
'groups_id': [], 
'search_view_id': False, 'filter': False, 'search_view': '{\'arch\': \'\', \'id\': False, \'model\': \'mystock\', \'models\': {\'mystock\': (\'billno\', \'mystockid\', \'id\', \'__last_update\', \'display_name\', \'create_uid\', \'create_date\', \'write_uid\', \'write_date\')}}'}



Avatar
Discard
Best Answer

Try to add 'default_' prefix to your fields in context.
For example:
'context': {'default_billno': 'ABCDE'}

Avatar
Discard
Author Best Answer

great, it works now, thanks.

Avatar
Discard