تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
6234 أدوات العرض

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.



الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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 ?


الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال