title: Odoo 12 Confirmation form (confirm/ discard) from Wizard
body: <p>I created a wizard in account.invoice form who is displayed when user click on "confirm bill". 
  This wizard contain two buttons: discard and confirm.
  When user click on confirm button the bill is created.
  How to save fields of the "account.invoice" view from the confirm button of the wizard? 
  I hope you can help me.</p>
  
  <p>this is the confirm function of the wizard: </p>
  
  <pre><code> @api.multi
      def action_invoice_validation(self):
          invoice = self.env['account.invoice'].search([('id', '=', self._context['parent_obj'])])
          to_open_invoices = self.filtered(lambda inv: invoice.state != 'open')
          to_open_invoices.action_move_creation()
          return to_open_invoices.invoice_validation()
  </code></pre>
  
  <p>Below the two functions called in my principal function 
  action_move_creation function: </p>
  
  <pre><code>@api.multi
      def action_move_creation(self):
              """ Creates invoice related analytics and financial move lines """
              account_move = self.env['account.move'].search([('id', '=', self._context['parent_obj'])])
  
              for inv in self:
                  if not inv.date_invoice:
                      inv.write({'date_invoice': fields.Date.context_today(self)})
                  if not inv.date_due:
                      inv.write({'date_due': inv.date_invoice})
                  company_currency = inv.company_id.currency_id
  
                  # create move lines (one per invoice line + eventual taxes and analytic lines)
                  iml = inv.invoice_line_move_line_get()
                  iml += inv.tax_line_move_line_get()
  
                  diff_currency = inv.currency_id != company_currency
                  # create one move line for the total and possibly adjust the other lines amount
                  total, total_currency, iml = inv.compute_invoice_totals(company_currency, iml)
  
                  name = inv.name or ''
                  if inv.payment_term_id:
                      totlines = \
                      inv.payment_term_id.with_context(currency_id=company_currency.id).compute(total, inv.date_invoice)[
                          0]
                      res_amount_currency = total_currency
                      for i, t in enumerate(totlines):
                          if inv.currency_id != company_currency:
                              amount_currency = company_currency._convert(t[1], inv.currency_id, inv.company_id,
                                                                          inv._get_currency_rate_date() or fields.Date.today())
                          else:
                              amount_currency = False
  
                          # last line: add the diff
                          res_amount_currency -= amount_currency or 0
                          if i + 1 == len(totlines):
                              amount_currency += res_amount_currency
  
                          iml.append({
                              'type': 'dest',
                              'name': name,
                              'price': t[1],
                              'account_id': inv.account_id.id,
                              'date_maturity': t[0],
                              'amount_currency': diff_currency and amount_currency,
                              'currency_id': diff_currency and inv.currency_id.id,
                              'invoice_id': inv.id
                          })
                  else:
                      iml.append({
                          'type': 'dest',
                          'name': name,
                          'price': total,
                          'account_id': inv.account_id.id,
                          'date_maturity': inv.date_due,
                          'amount_currency': diff_currency and total_currency,
                          'currency_id': diff_currency and inv.currency_id.id,
                          'invoice_id': inv.id
                      })
                  part = self.env['res.partner']._find_accounting_partner(inv.partner_id)
                  line = [(0, 0, self.line_get_convert(l, part.id)) for l in iml]
                  line = inv.group_lines(iml, line)
  
                  line = inv.finalize_invoice_move_lines(line)
  
                  date = inv.date or inv.date_invoice
                  move_vals = {
                      'ref': inv.reference,
                      'line_ids': line,
                      'journal_id': inv.journal_id.id,
                      'date': date,
                      'narration': inv.comment,
                  }
                  move = account_move.create(move_vals)
                  # Pass invoice in method post: used if you want to get the same
                  # account move reference when creating the same invoice after a cancelled one:
                  move.post(invoice=inv)
                  # make the invoice point to that move
                  vals = {
                      'move_id': move.id,
                      'date': date,
                      'move_name': move.name,
                  }
                  inv.write(vals)
              return True
  </code></pre>
  
  <p>my invoice_validation function: </p>
  
  <pre><code>  @api.multi
      def invoice_validation(self):
              invoice = self.env['account.invoice'].search([('id', '=', self._context['parent_obj'])])
              for invoice in self.filtered(lambda p: invoice.partner_id not in invoice.message_partner_ids):
                  invoice.message_subscribe([invoice.partner_id.id])
  
                  # Auto-compute reference, if not already existing and if configured on company
                  if not create_uidinvoice.reference and invoice.type == 'out_invoice':
                      invoice.reference = invoice._get_computed_reference()
  
                  # DO NOT FORWARD-PORT.
                  # The reference is copied after the move creation because we need the move to get the invoice number but
                  # we need the invoice number to get the reference.
                  invoice.move_id.ref = invoice.reference
              self._check_duplicate_supplier_reference()
  
              return self.write({'state': 'open'})
  </code></pre>