From 82bfb280272436a14b07ecd140c31734f2c21922 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 14:19:34 +0530 Subject: [PATCH] [IMP]account_payment: added a new file for draft2valid bank statement with import payment line bzr revid: mma@tinyerp.com-20111115084934-tdacwbjcc13ng56g --- addons/account_payment/__openerp__.py | 1 + .../process/draft2valid_bank_statement.yml | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 addons/account_payment/test/process/draft2valid_bank_statement.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 1105a540d0d..0efeb90769d 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -53,6 +53,7 @@ This module provides : 'test': [ 'test/process/draft2cancel_payment_order.yml', 'test/process/draft2done_payment_order.yml', + 'test/process/draft2valid_bank_statement.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/process/draft2valid_bank_statement.yml b/addons/account_payment/test/process/draft2valid_bank_statement.yml new file mode 100644 index 00000000000..dc2470cf6f8 --- /dev/null +++ b/addons/account_payment/test/process/draft2valid_bank_statement.yml @@ -0,0 +1,68 @@ +- + 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("account_payment.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], {"lang": "en_US", "tz": False, "statement_id": ref("account_bank_statement_1"), "active_model": "account.bank.statement", "journal_type": "cash", "active_ids": [ref("account_bank_statement_1")], "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 perform action to 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 "Closed" +- + !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" +- + I check that the payment is created with proper data in supplier invoice +- + !python {model: account.invoice}: | + invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) + payment_line = invoice.payment_ids[0] + + assert invoice.state == 'paid', "invoice state is not paid" + assert invoice.reconciled == True, "invoice reconcile is not True" + assert invoice.residual == 0.0, "invoice residua amount is not filly paid" + assert payment_line, "payment line not created for paid invoice" + assert payment_line.debit == invoice.amount_total and payment_line.credit == 0.0, "proper amount is not debit to payment account " + assert payment_line.reconcile_id, "reconcile is not created for paid invoice" + \ No newline at end of file