Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to open form view by python?

By
Mohammed Khamis
on 3/2/15, 9:43 AM 1,524 views

please I want to open Return lines by python ? my code is 

res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_stock_return_picking_form')
             #raise osv.except_osv((res),())
             picking_id = self.browse(cr, uid, ids[0], context=context).picking_id.id
             #assert len(ids) == 1, 'This option should only be used for a single id at a time'
             return {
                'name': _('Return lines'),
                'view_type': 'form',
                'view_mode': 'form',
                'view_id': res and res[1] or False,
                'res_model': 'stock.return.picking',
                'src_model': "stock.picking",
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'target': 'current',
                'key2':"client_action_multi",
                'res_id': picking_id,
             }

but not open please help me for this issue thank you so much?

2

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 3/2/15, 10:03 AM

hi,

try this:

res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_stock_return_picking_form')
res_id = res and res[1] or False
#raise osv.except_osv((res),())
picking_id = self.browse(cr, uid, ids[0], context=context).picking_id.id
#assert len(ids) == 1, 'This option should only be used for a single id at a time'
return {
        'name': _('Return lines'),
        'view_type': 'form',
        'view_mode': 'form',
        'view_id': [res_id],
        'res_model': 'stock.return.picking',
        'type': 'ir.actions.act_window',
        'target': 'current',
                'context':context
        }

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/2/15, 9:43 AM
Seen: 1524 times
Last updated: 3/16/15, 8:10 AM