title: Odoo hide field by state in xml
body: <pre><code>class myModel(models.Model):
  
      _name = 'my.model'
  
      state = fields.Selection(selection=_STATES, string='Status', index=True, track_visibility='onchange',required=True, copy=False, default='draft')
      my_model_line = fields.One2many('my.model.line', 'model_id')
  </code></pre>
  
  <p>another model:</p>
  
  <pre><code>class MyModelLine(models.Model):
  
      _name = 'my.model.line'
  
      name = fields.Char(string='Name')
      quantity = fields.Integer(string='Quantity', required=True, default=1)
      remarks = fields.Text(string='Description')
      my_model_id = fields.Many2one('my.model', 'My Model')
  </code></pre>
  
  <p>my_model.xml</p>
  
  <pre><code>                &lt;field name="my_model_line" attrs="{'readonly': [('state','not in', ('draft'))]}"&gt;
                      &lt;tree string="My model Lines" editable="bottom"&gt;
                          &lt;field name="name"/&gt;
                          &lt;field name="quantity"/&gt;
                          &lt;field name="remarks"/&gt;
                          &lt;button name="open_new_view" type="object" string="Add" class="oe_highlight"/&gt;
                          &lt;button icon="terp-face-plain" name="test" type="object" string="Add" class="oe_highlight"/&gt;
                      &lt;/tree&gt;
                   &lt;/field&gt;
  </code></pre>
  
  <p>I want to hide <strong>my.model.line</strong> moel <strong>remarks field</strong> and <strong>Add button field</strong> depend on <strong>my.model status</strong>.
  For example hide fields if is my model status is approved.</p>
  
  <p>As I understand, I can't use invisible attribute with domain in my my_model.xml because my.model.line do not have state field. Maybe there are any solutions to do that?</p>
  
  <p>I was thinking to create status field in my.model.line object ant change it status depend on my.model status.</p>
  
  <p>Also I was trying like this:                               </p>
  
  <pre><code>&lt;field name="remarks" attrs="{'invisible': "[('my_model_id .state', '=', 'approved')]"}"/&gt;
  </code></pre>
  
  <p>But then I got an error: "Unknown field my_model_id.state in domain"</p>