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

display a custom field many2one

By
Chacha
on 4/7/15, 7:07 AM 711 views

I created two custom models using Odoo the graphical interface. In one of them i created a field many2one which pointed on the other model. So, i created a tree view on formar (first) model. I want to  know how to define which fields of the   many2one field model   that will finally be  displayed. Thanks in advance.



0
Chacha
On 4/8/15, 2:28 PM

Thanks for your answer, Though i dont get too well along with ur code sequence. Please is there a way to though this through Odoo graphical interface ?


0
Demirel yakito
On 4/7/15, 7:48 AM

from openerp import models, fields, api, _

from datetime import datetime

import time

class manytoonecheck(models.Model):

_name="many.one"

_description="checking"

_table="many_one"

nameparent=fields.Many2one("many.onec",string="Manytoone:")

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

<?xml version="1.0" encoding="UTF-8"?>

<openerp>

<data>

<record model="ir.ui.view" id="p1234">

<field name="name">parent</field>

<field name="model">many.one</field>

<field name="arch" type="xml">

<form string="abcd" version="7.0">

<sheet>

<group>

<field name="nameparent"></field>

</group>

</sheet>

</form>

</field>

</record>

<record model="ir.actions.act_window" id="many1234">

<field name = "name">Manytoone</field>

<field name = "res_model">many.one</field>

<field name = "view_mode">tree,form</field>

</record>

<menuitem name="Parent" id="checking_idp" parent="manytooneid" action="many1234">

</menuitem>

</data>

</openerp>

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

from openerp import models, fields, api, _

from datetime import datetime

import time

class manytoonecheckc(models.Model):

_name="many.onec"

_description="checking"

_table="many_onec"

_rec_name="names"

names=fields.Char(string="Names")

age=fields.Char()

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

<?xml version="1.0" encoding="UTF-8"?>

<openerp>

<data>

<record model="ir.ui.view" id="c1234">

<field name="name">parent</field>

<field name="model">many.onec</field>

<field name="arch" type="xml">

<form string="abcd" version="7.0">

<sheet>

<group>

<field name="names"></field>

<field name="age"></field>

</group>

</sheet>

</form>

</field>

</record>

<record model="ir.actions.act_window" id="many12345">

<field name = "name">Manytoone</field>

<field name = "res_model">many.onec</field>

<field name = "view_mode">tree,form</field>

</record>

<menuitem name="Child" id="checking_idc" parent="manytooneid" action="many12345">

</menuitem>

</data>

</openerp>

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

check this eg.

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: 4/7/15, 7:07 AM
Seen: 711 times
Last updated: 4/8/15, 2:32 PM