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 do you assign a field of a transient model with context's active_id using new api?

By
E.M.
on 2/12/16, 7:50 AM 837 views

I have a transient model defined.

I want one of its fields defined using active_id from context.

I want to use new API.

Does anyone know how to do it? Thanks

0

Jignesh Mehta

--Jignesh Mehta--
2087
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 2/13/16, 6:32 AM

Hello EM,


@api.model

 def default_get(self, fields):

    rec = super(TransientModelClass, self).default_get(fields)

    class_obj = self.env['class.name'].browse(self._context.get('active_id'))

    for variable in class_obj:

        rec['wizard_field'] = variable.class_field


Hope this will helps you.

Thanks,


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: 2/12/16, 7:50 AM
Seen: 837 times
Last updated: 2/13/16, 6:32 AM