-
  Create an invoice for the partner Seagate with amount 450.0
-
  !record {model: account.invoice, id: account_invoice_0}:
    account_id: account.a_recv
    address_contact_id: base.res_partner_address_7
    address_invoice_id: base.res_partner_address_7
    company_id: base.main_company
    currency_id: base.EUR
    invoice_line:
      - account_id: account.a_sale
        name: '[PC1] Basic PC'
        price_unit: 450.0
        quantity: 1.0
        product_id: product.product_product_pc1
        uos_id: product.product_uom_unit
    journal_id: account.sales_journal
    partner_id: base.res_partner_seagate

-
  I check that the customer invoice is in draft state
-
  !assert {model: account.invoice, id: account_invoice_0}:
    - state == 'draft'

-
  I make the invoice in Open state
-
  !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}

-
  I check that a payment entry gets created in the account.move.line
-
  !python {model: account.invoice}: |
    acc_id=self.browse(cr, uid, ref("account_invoice_0"))
    assert(acc_id.move_id)

-
  I will create and post an account voucher of amount 450.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_seagate"), journal_id, 0.0, 1, ttype='receipt', date=False)
    vals = {
        'account_id': ref('account.cash'),
        'amount': 450.0,
        'company_id': ref('base.main_company'),
        'currency_id': ref('base.EUR'),
        'journal_id': ref('account.bank_journal'),
        'partner_id': ref('base.res_partner_seagate'),
        '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'] = 450.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)

-
  Finally i will Confirm the state of the invoice is paid
-
  !assert {model: account.invoice, id: account_invoice_0}:
    - state == 'paid'
