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

Create a new form by clicking custom button

By
Mohammed Roshan
on 3/10/15, 5:02 AM 503 views

Hi

i have a model preliminary.details, and created a new button create new file in its form view.

What i want is when i click on the button create new file, i want to create and view a new record in the model complete.details(i have already made a model complete.details)

How can it made possible?

Thanks in advance..

3

Vasanth

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

Hi Mohammed,

try this method for your button object:

  def button_function(self, cr, uid, ids, context):
        mod_obj = self.pool.get('ir.model.data')
        res = mod_obj.get_object_reference(cr, uid, 'complete_details (your module name)', 'complete_details_form_view (your_form_view_id)')
        res_id = res and res[1] or False
        return{
            'name':'Complete Details',
            'res_model':'complete.details',
            'type': 'ir.actions.act_window',
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': [res_id],
            'context':{},
            'target':'new'
             }

hi Vasanth Thamks for your reply But i got this error File "/home/amz05/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 924, in xmlid_lookup raise ValueError('External ID not found in the system: %s' % (xmlid)) ValueError: External ID not found in the system: ip_local.view_file_details_form

Mohammed Roshan
on 3/10/15, 7:26 AM

please check the "id" which you gave in the code is occurs in the module's view or not?.

Vasanth
on 3/10/15, 7:54 AM

Thanks Vasnath your answer was right. i was providing wrong models

Mohammed Roshan
on 3/10/15, 8:14 AM

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/10/15, 5:02 AM
Seen: 503 times
Last updated: 3/16/15, 8:10 AM