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.

1

How open an edit form with a button ?

By
Conaclos
on 4/6/13, 1:39 PM 2,943 views

Hello !

I would like edit a sepcific object after a click on a button "B".

My model has a workflow. The activity "A" lauch the action "change ()". The button "B" move to "A" and then call "change ()".

I would like than "cgange ()" open a new edit form to edit a specific object.

I wrote that :

def change (self, cr, uid, ids)
    ... # create a new object attached to new_id
    return {
        "type": "ir.actions.act_window",
        "name": "edit",
        "res_model": "my_model",
        "res_id": new_id,
        "view_type": "form",
        "view_mode": "form",
        "view_id": self.pool.get('ir.model.data').get_object_reference(cr, uid, 'module', 'view_id')[1]
    }

I have an error :

ValueError: No such external ID currently defined in the system: my_model

Thanks.

You need to include the whole function, your error could be coming from in the stuff you left out.

AJ Schrafel Paper Corp
on 4/6/13, 2:29 PM
0
Conaclos
On 4/6/13, 3:31 PM

I found the solution. I had two mistake: - use "view_id" instead of "views" and write id="view_id" instead of id="module.view_id" in xml record.

Thanks.

def change (self, cr, uid, ids)
    ... # create a new object attached to new_id
    return {
        "type": "ir.actions.act_window",
        "name": "edit",
        "res_model": "my_model",
        "res_id": new_id,
        "view_type": "form",
        "view_mode": "form",
        "views": [(self.pool.get('ir.model.data').get_object_reference(cr, uid, 'module', 'view_id')[1]
    }

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

0 follower(s)

Stats

Asked: 4/6/13, 1:39 PM
Seen: 2943 times
Last updated: 7/8/15, 1:37 PM