I am writing a new "answer" because I need to refer both @subbarao and @sehrish.
Thank you guys.
I have tried as you said but unfortunately I could not get the complete workflow as desired.
Using the "<tree editable ="bottom"> (or top), now I am able to edit the record on the same form without the "pop-up" window... but...
I am still unable to "choose the record from a list of existing records" and cannot see the (Create and Edit option).
@subbarao says that I should add this "editable = "bottom" to the tree view of my "one2many" field.
Do you mean add it to the "model" where I have the relation to the Many2one field?
These are my classes:
class mymodule_director(models.Model):
_name = 'mymodule.director'
name = fields.Char('Name', size=50, required=True)
phone = fields.Char('Phone', size=17, default="00244 ")
email = fields.Char('Email')
location_id = fields.Many2one('mymodule.locations','Location', required=True)
customer_ids = fields.Many2one('mymodule.customers','director_ids')
class mymodule.customers(models.Model):
_name='mymodule.customers'
name=fields.Char('Name', required=True)
address = fields.Char('Address')
city = fields.Char('City')
province=fields.Char('Province')
email=fields.Char('Email')
director_ids = fields.One2many('mymodule.director','customer_ids', string="Director")
Tree view:
- mymodule.director model
<record id="mymodule_director_tree_view" model="ir.ui.view">
<field name="name">Director List View</field>
<field name="model">mymodule.director</field>
<field name="arch" type="xml">
<tree editable="bottom"> ------->>>>> ADDED AS PER INSTRUCTIONS
<field name="name"/>
<field name="phone"/>
<field name="email"/>
<field name="location_id"/>
<field name="customer_ids" string="Customer"/>
</tree>
</field>
</record>
- mymodule.customers model FORM view (where the relation should appear on form view)
<record id="mymodule_customers_form_view" model="ir.ui.view">
<field name="name">mymodule.customers.form.view</field>
<field name="model">mymodule.customers</field>
<field name="type">form</field>
<field name="arch" type="xml">
<sheet>
<form>
<group>
<field name="name"/>
<field name="address"/>
<field name="city"/>
<field name="province"/>
<field name="email"/>
</group>
<notebook> ----------------->>>>>> TRIED TO ADD "editable = "bottom" FROM THIS POINT WITH NO SUCESS
<page string="Directors">
<field name="director_ids"/>
</page>
</notebook>
</form>
</sheet>
</field>
</record>
Adding it to the "tree view" above, I can get "almost" what I want. The problem is that existing records are not shown on the form...
Thank you once again