Q:

Pass data to many2one widget

I have a custom module with the following simple data structure:
class Site(models.Model):
    _name = 'sites.site'

    site_name = fields.Char(string="Site Name")
     contact_in_site_role_ids = fields.One2many(comodel_name="sites.contact_in_site_role", inverse_name="site_id", string="Site Contacts", required=False, )

class SiteRole(models.Model):
    _name = "sites.site_role"
    role_name = fields.Char(string="Role Name")

class ContactInSiteRole(models.Model):
    _name = "sites.contact_in_site_role"

    site_id = fields.Many2one("sites.site",string="Site")
    contact_id = fields.Many2one("res.partner",string="Contact")
    role_id = fields.Many2one("sites.site_role",string="Site Role")
    role_detail = fields.Char(string="Role details")

This is currently managed by the following form:
      <record model="ir.ui.view" id="site_form_view">
            <field name="name">site.form</field>
            <field name="model">sites.site</field>
            <field name="arch" type="xml">
                <form string="Site Form">
                    <sheet>
                        <group>
                            <field name="site_name"/>
                        </group>
                        <notebook>
                            <page string="Site Contacts">
                                <field name="contact_in_site_role_ids" widget="one2many_list">
                                        <tree>
                                            <field name="contact_id"/>
                                            <field name="role_id"/>
                                            <field name="role_detail"/>
                                        </tree>
                                </field>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>

This works well, apart from when clicking to add a contact on the Many2One widget on the "Edit Site Form", it prompts again for the site.  How do I remove the "Site" option from this popup form, and have the relevant site passed from the parent form:

A:

Try to pass like below and see
<field name="contact_in_site_role_ids" widget="one2many_list" context="{'default_site_id':parent.id}"/>

The concept here is we can initialize the child element values by passing them in the context like:
{default_child_field: value}

