[IMP] Improved YML test case of account_payment module.
bzr revid: tpa@tinyerp.com-20111220120924-01l9t6eq69y7lqb8
This commit is contained in:
parent
7e29d8f5e4
commit
b9e329b8bc
|
@ -54,8 +54,6 @@ This module provides :
|
|||
'test/account_payment_demo.yml',
|
||||
'test/draft2cancel_payment_order.yml',
|
||||
'test/draft2done_payment_order.yml',
|
||||
'test/account_payment_order_wiz.yml',
|
||||
'test/draft2valid_bank_statement.yml',
|
||||
'test/account_payment_report.yml'
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
-
|
||||
In order to test the Select invoice to pay wizard
|
||||
-
|
||||
I create a record for payment order.
|
||||
-
|
||||
!record {model: payment.order.create, id: payment_order_create_0}:
|
||||
duedate: !eval time.strftime('%Y-%m-%d')
|
||||
-
|
||||
I perform a action to search the entries for create a payment line
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
self.search_entries(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1"), })
|
||||
-
|
||||
In order to make entries in payment line, I create a entries.
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
move_line = invoice.move_id.line_id[0]
|
||||
self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]})
|
||||
self.create_payment(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1")})
|
||||
-
|
||||
I check a payment line is created with proper data.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
payment = self.browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
|
||||
assert payment_line.move_line_id, "move line is not created in payment line."
|
||||
assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created."
|
||||
assert invoice.partner_id == payment_line.partner_id, "partner is not same created."
|
||||
assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created."
|
||||
assert invoice.amount_total == payment_line.amount, "payment amount is not same created."
|
|
@ -27,6 +27,41 @@
|
|||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}:
|
||||
- state == 'open'
|
||||
-
|
||||
I create a record for payment order create.
|
||||
-
|
||||
!record {model: payment.order.create, id: payment_order_create_0}:
|
||||
duedate: !eval time.strftime('%Y-%m-%d')
|
||||
-
|
||||
I perform a action to search the entries for create a payment line
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
self.search_entries(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1"), })
|
||||
-
|
||||
In order to make entries in payment line, I create a entries.
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
move_line = invoice.move_id.line_id[0]
|
||||
self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]})
|
||||
self.create_payment(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1")})
|
||||
-
|
||||
I check a payment line is created with proper data.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
payment = self.browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
|
||||
assert payment_line.move_line_id, "move line is not created in payment line."
|
||||
assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created."
|
||||
assert invoice.partner_id == payment_line.partner_id, "partner is not same created."
|
||||
assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created."
|
||||
assert invoice.amount_total == payment_line.amount, "payment amount is not same created."
|
||||
-
|
||||
I change the state of payment order to "done".
|
||||
-
|
||||
|
@ -42,4 +77,24 @@
|
|||
-
|
||||
!python {model: payment.order}: |
|
||||
payment = self.browse(cr, uid, ref("payment_order_1"))
|
||||
assert payment.date_done, "date is not created after done payment order"
|
||||
assert payment.date_done, "date is not created after done payment order"
|
||||
-
|
||||
I create a record for bank statement.
|
||||
-
|
||||
!record {model: account.bank.statement, id: account_bank_statement_1}:
|
||||
balance_end_real: 0.0
|
||||
balance_start: 0.0
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
journal_id: account.bank_journal
|
||||
name: /
|
||||
period_id: account.period_10
|
||||
-
|
||||
In order to make entries in bank statement line, I import payment order lines.
|
||||
-
|
||||
!python {model: account.payment.populate.statement}: |
|
||||
payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]})
|
||||
self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"),
|
||||
"active_model": "account.bank.statement", "journal_type": "cash",
|
||||
"active_id": ref("account_bank_statement_1")})
|
|
@ -1,52 +0,0 @@
|
|||
-
|
||||
In order to test the process of bank statement
|
||||
-
|
||||
I create a record for bank statement
|
||||
-
|
||||
!record {model: account.bank.statement, id: account_bank_statement_1}:
|
||||
balance_end_real: 0.0
|
||||
balance_start: 0.0
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
journal_id: account.bank_journal
|
||||
name: /
|
||||
period_id: account.period_10
|
||||
-
|
||||
In order to make entries in bank statement line, I import payment order lines.
|
||||
-
|
||||
!python {model: account.payment.populate.statement}: |
|
||||
payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]})
|
||||
self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"),
|
||||
"active_model": "account.bank.statement", "journal_type": "cash",
|
||||
"active_id": ref("account_bank_statement_1")})
|
||||
-
|
||||
I check that payment line is import successfully in bank statement line.
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
bank = self.browse(cr, uid, ref("account_bank_statement_1"))
|
||||
assert bank.line_ids, "bank statement line is not created."
|
||||
-
|
||||
I modify the bank statement and set the Closing Balance.
|
||||
-
|
||||
!record {model: account.bank.statement, id: account_bank_statement_1}:
|
||||
balance_end_real: -14.0
|
||||
-
|
||||
I confirm the bank statement.
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
self.button_confirm_bank(cr, uid, [ref("account_bank_statement_1")])
|
||||
-
|
||||
I check that bank statement state is now "Confirm"
|
||||
-
|
||||
!assert {model: account.bank.statement, id: account_bank_statement_1}:
|
||||
- state == 'confirm'
|
||||
-
|
||||
I check that move lines created for bank statement.
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
bank = self.browse(cr, uid, ref("account_bank_statement_1"))
|
||||
move_line = bank.move_line_ids[0]
|
||||
|
||||
assert bank.move_line_ids, "Move lines not created for bank statement."
|
||||
assert move_line.state == 'valid', "Move state is not valid."
|
Loading…
Reference in New Issue