- 
  Creating a Voucher Receipt for partner Seagate with amount 30000.0
- 
  !record {model: account.voucher, id: account_voucher_seagate_0, view: view_sale_receipt_form}:
    account_id: account.a_recv
    amount: 30000.0
    company_id: base.main_company
    journal_id: account.sales_journal
    line_cr_ids:
      - account_id: account.a_sale
        amount: 30000.0
        type: cr
    partner_id: base.res_partner_19
    period_id: account.period_9
    type: sale
    
-
  I check that the voucher state is Draft
-
  !assert {model: account.voucher, id: account_voucher_seagate_0}:
    - state == 'draft'

-
  I click on post button to post the voucher
-
  !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}

-
  Check that the voucher state is Posted
-
  !assert {model: account.voucher, id: account_voucher_seagate_0}:
    - state == 'posted'
    
-
  I check that move lines are validated but not reconciled
-
  !python {model: account.voucher}: |
    reconciled = False
    for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids: 
       if l.reconcile_id:
         reconciled = True
         break
    assert (not reconciled), "Found reconciled move lines, should not be"
-
  I create and post a voucher payment of amount 30000.0 for the partner Seagate
-
  !python {model: account.voucher}: |
    import netsvc
    vals = {}
    journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
    res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
    vals = {
        'account_id': ref('account.cash'),
        'amount': 30000.0,
        'company_id': ref('base.main_company'),
        'journal_id': ref('account.bank_journal'),
        'partner_id': ref('base.res_partner_19'),
        'period_id': ref('account.period_8'),
        'type': 'receipt',
    }
    if not res['value']['line_cr_ids']:
      res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
    res['value']['line_cr_ids'][0]['amount'] = 30000.0
    vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
    id = self.create(cr, uid, vals)
    voucher_id = self.browse(cr, uid, id)
    assert (voucher_id.state=='draft'), "Voucher is not in draft state"
    wf_service = netsvc.LocalService("workflow")
    wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
-
  I check that move lines are reconciled meaning voucher is paid
-
  !python {model: account.voucher}: |
    reconciled = False
    for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids: 
       if l.reconcile_id:
         reconciled = True
         break
    assert reconciled, "Found unreconciled move lines/unpaid voucher"
