Search code examples
dnstreeviewodoo-10formview

Odoo 10 Limiting records in a tree view embedded into a Form View


arlight, so here's my code.

<page name="employment_locations" string="Locations">
        <field name="location_ids">
          <tree editable="bottom">

              <field name="location_id" string="Location" domain="[('parent_id', '!=', False)]"/>
              <field name="location_address_id" string="Address"/>
              <field name="location_phone_number" string="Phone #"/>
              <field name="location_parent_id" string='Zone'/>

          </tree>
        </field>
      </page>

I have a working domain on the location_id to limit someones ability to select parent locations, but since I have the parents being added for a different view (in employment.locations) I want to limit this tree view to just the children. This is an extension of the employee form view.

I have tried adding a domain to both the initial tree tag and the field-Location_ids tag. I even tried using a t-if = "record.parent_id != false" enclosing the fields in the tree.

Any help or ideas would be helpful


Solution

  • I also asked this question on the Odoo forums and the response I got was to put the domain on the field in python instead of xml, and that works.