title: Odoo - How to set field value from parent_id?
body: <p>I am making a module that is adding additional field to partner form. As the value is the same for the partner companies it would have to be the same for all employees of the company.
  <a href="https://i.stack.imgur.com/mfLYE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mfLYE.png" alt="enter image description here"></a></p>
  
  <p>Succeded to write the code to copy to child_usrs:
  <a href="https://i.stack.imgur.com/Tobqo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tobqo.png" alt="enter image description here"></a></p>
  
  <p>The problem is I cannot edit the field anymore...</p>
  
  <p>My code:</p>
  
  <pre><code>class SpgMovField(models.Model):
  _name = 'res.partner'
  _inherit = 'res.partner'
  
  spg_mov = fields.Char(string='MOV', compute='_compute_mov_from_parent', help='Minimum Order Value')
  @api.one
  @api.depends('parent_id', 'parent_id.spg_mov')
  def _compute_mov_from_parent(self):
      if self.parent_id:
  
          self.spg_mov = self.parent_id.spg_mov
  
      elif type(self.id) is not models.NewId:
          query = """
          SELECT
              spg_mov
          FROM res_partner
          WHERE id=%s"""
          self.env.cr.execute(query, [self.id])
          result = self.env.cr.dictfetchone()
  
          self.spg_mov = result['spg_mov']
  
  
  
  @api.one
  def _inverse_persist_fields(self):
      query = """
      UPDATE res_partner
      SET
          spg_mov=%s
      WHERE id=%s"""
  
      params = [SpgMovField._optional(self.spg_mov)]
      self.env.cr.execute(query, params)
      self.env.invalidate_all()
  
  @api.model
  @api.onchange('parent_id')
  def onchange_parent_id_new_mov(self):
      old_res = super(SpgMovField, self).onchange_parent_id(self.parent_id.id)
      _LOGGER.info(repr(old_res))
      if type(old_res) is dict and 'value' in old_res:
          for field, value in old_res.get('value').items():
              if hasattr(self, field):
                  setattr(self, field, value)
  
      if self.parent_id:
          fields_to_copy = ['spg_mov']
  
          for key in fields_to_copy:
              self[key] = self.parent_id[key]
  
  @staticmethod
  def _optional(condition, value = None, defaultValue = None):
      if value is None:
          value = condition
      return value if condition != False else defaultValue
  </code></pre>