title: auto create record of another model while creating a record in one form - Odoo 10
body: <p>I have two model in my orm i.e. _service &amp; _apple. What I want is I want to create record of _apple with some fields written automatically. As an example, from sale order we can create invoice and when invoice is created, some of the fields of invoice are automatically generated written in record as same as in sale order.</p>
  
  <p>What I have done is:</p>
  
  <p>My service Model</p>
  
  <pre><code>class _service(models.Model):
  _name = 'se.service'
  _rec_name = "service_name"
  
  name = fields.Char(
      'Reference', copy=False, readonly=True, default=lambda x: _('New'))
  service_name = fields.Char("Service Name", required=True)
  service_department = fields.Many2one('hr.department', "Department Name", required=True, help="Department Name of employee")
  service_description = fields.Text("Description", required=True)
  service_remarks = fields.Text("Remarks")
  service_methodology = fields.Html(string="Methodology")
  service_id = fields.One2many('se.objective', 'service_id', string="Objectives", required=True)
  
  @api.model
  def create(self, valuees):
      if valuees.get('name', _('New')) == _('New'):
          valuees['name'] = self.env['ir.sequence'].next_by_code('se.service') or _('New')
      return super(_service, self).create(valuees)
  
  def _create_apple(self):
      inv_obj = self.env['se.apple']
      self.ensure_one()
      se = _service
      invoice = inv_obj.create({
          'apple_name': se.service_name,
          'apple_description': se.service_description,
          'apple_remarks': se.service_remarks
      })
      return invoice
  
  
  def create_apple(self):
      self._create_apple()
  </code></pre>
  
  <p>My _apple Model</p>
  
  <pre><code>class _apple(models.Model):
      _name = 'se.apple'
  
      apple_name = fields.Char("Apple Name")
      apple_description = fields.Text("Remarks Apple")
      apple_remarks = fields.Text("Remarks Apple")
  </code></pre>
  
  <p>My se.service form:</p>
  
  <pre><code>&lt;header&gt;
      &lt;button name="create_apple" string="Create Apple" type="object" class="btn-primary"/&gt;
  &lt;/header&gt;
  </code></pre>
  
  <p>If I do as below:
  1. I create a form in se.service.
  2. I save the form.
  3. I click create_apple button.</p>
  
  <p>I expect:
  1. A record automatically created in se.apple
  2. Record will have apple_name, apple_description &amp; apple_remarks automatically generated as I have filled in se.service.</p>