-
  In order to test account invoice I create a new customer invoice
-
  !record {model: account.invoice, id: account_invoice_customer0}:
    account_id: account.a_recv
    address_contact_id: base.res_partner_address_zen
    address_invoice_id: base.res_partner_address_zen
    company_id: base.main_company
    currency_id: base.EUR
    date_invoice: !eval time.strftime('%Y-%m-%d')
    invoice_line:
      - account_id: account.a_sale
        name: '[PC3] Medium PC'
        price_unit: 900.0
        quantity: 10.0
        product_id: product.product_product_pc3
        uos_id: product.product_uom_unit
    journal_id: account.sales_journal
    partner_id: base.res_partner_3
    reference_type: none
-
  I check that Initially customer invoice is in the "Draft" state
-
  !assert {model: account.invoice, id: account_invoice_customer0}:
    - state == 'draft'
-
  I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
-
  !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
-
  I check that the invoice state is now "Proforma2"
-
  !assert {model: account.invoice, id: account_invoice_customer0}:
    - state == 'proforma2'
-
  I check that there is no move attached to the invoice
-
  !python {model: account.invoice}: |
    acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
    assert (not acc_id.move_id), "Move falsely created at pro-forma"
-
  I create invoice by clicking on Create button
-
  !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
-
  I check that the invoice state is "Open"
-
  !assert {model: account.invoice, id: account_invoice_customer0}:
    - state == 'open'

-
  I check that now there is a move attached to the invoice
-
  !python {model: account.invoice}: |
    acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
    assert acc_id.move_id, "Move not created for open invoice"
-
  I refund the invoice Using Refund Button
-
  !record {model: account.invoice.refund, id: account_invoice_refund_0}:
    description: Refund To China Export
    period: account.period_5
    filter_refund: refund
-
  I clicked on refund button
-
  !python {model: account.invoice.refund}: |
    self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account.account_invoice_customer0"), })
-
  I checked that a new entry with state "Draft" created in account move line


