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

Is it possible to have 4 different models form on a page

By
ahmed khakwani
on 8/2/16, 8:02 AM 234 views

Consider 4 models which are

Model1.model1
Model2.model2
Model3.model3
Model4.model4

I need to show there form view on a same page like that 

----------------------------------  ---------------------------------
-       Model1.model1    -  -       Model2.model2    -
----------------------------------  ---------------------------------

----------------------------------  ---------------------------------

-       Model3.model3    -  -       Model4.model4    -

----------------------------------  ---------------------------------  


Any idea how can i do that in odoo ? i really need that type of view.

0
shameem@axon
On 8/2/16, 10:52 PM

Try this method

1) Write your menu like this 

<!--ACTION-->
<record id="action_display" model="ir.actions.act_url">
     <field name="name">Menu Name</field>
     <field name="url">/display_models</field>
     <field name="target">self</field>
 </record>
<!--MENU -->

<record id="menu_action" model="ir.ui.menu">

    <field name="name">Menu Name</field> 

    <field name="sequence" eval="10"/>

    <field name="action" ref="action_display"/>

</record>


2) Write Python code

from openerp import http 
from openerp.http import request

class YourClass(http.Controller):
    @http.route('/display_models', type='http', website=True)
    def index_grid(self, **kw):
             .....
        return request.render('your_module.your_template_id', {
                'model1':model1,'model2':model2,'model3':model3,'model4':model4})

3) Write Template

 <template id="your_module.your_template_id">
     <t t-call="web.menu"/><!--For menu bar-->
     <table>
        <tr>
            <td><t t-esc="model1.name"/><t t-esc="model1.partner_id"/> etc....</td>
            <td><t t-esc="model2.name"/><t t-esc="model2.partner_id"/> etc....</td>
        </tr>
        <tr><td><t t-esc="model3.name"/><t t-esc="model3.partner_id"/> etc....</td>
            <td><t t-esc="model4.name"/><t t-esc="model4.partner_id"/> etc....</td>
        </tr>
     </table>

    
</template>



But how can i display those model fields in that route, i am using that code for display, but it not showing an thing

<div t-field="jewleryset.customer_id" t-field-options='{"widget": "relative"}'/>

ahmed khakwani
on 8/3/16, 7:49 AM
0

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 8/2/16, 11:34 PM

You could do it by creating a model0 with a many2one field for every model and related fields to all the fields of the models using the model name as a suffix for the related fields and the corresponding field path using the model many2one. That will cause you to have the model0 writing to the 4 other models fields but you could manage all like one into a single view form that you could divide into four areas as you like

Sorry am not clear with your idea, could you plz explain it using code

ahmed khakwani
on 8/3/16, 8:27 AM

still waiting on this, I have time to provide an example if still is needed

Axel Mendoza
on 10/11/16, 3:23 PM
0
Tuan
On 8/2/16, 12:13 PM

yep, you can create one more model is `model0` then create 4 one2many fields to each your model

- one2many f1 to model1

- one2many f2 to model2

- one2many f3 to model3

- one2many f4 to model4


then design the form view for `model0` as you want

No, i want those model all fields (includind one2many and many2one) onthat page. Like i need to show whole four forms on single page

ahmed khakwani
on 8/2/16, 3:25 PM

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: 8/2/16, 8:02 AM
Seen: 234 times
Last updated: 8/8/16, 12:06 AM