Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am trying to generate a "Create" button in the standard form of partners (res.partner). But I want that if click it, create a object from other model. Let's suppose that I have created a new model called my.model. I want to generate a button in the standard form of partners which opens a standard form to create an object from the model my.model. How can I do this?
Assuming you already created my.model, and defined views for that model,
since your button is visible on form res.partner , you need to define a method in res.partner class
in that method you will first call create on my.model like:
mymodel = self.pool.get('my.model')
created_id = mymodel.create(cr, uid, vals )
#vals is some values that will appear on created record
and after that you can return the desired view like:
view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'your_module', 'view_external_id')
view_id = view_ref and view_ref or False
'name': 'Some name',
hope it helps..
may the source be with you!
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/17/14, 12:22 PM|
|Seen: 908 times|
|Last updated: 3/16/15, 8:10 AM|