From 89e7700d21796d4be8bec6b522d2db7bfbde4fe3 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 13 Dec 2013 17:25:10 +0100 Subject: [PATCH] [add] tests for account_statement_base_completion: customer invoice --- .../__openerp__.py | 5 ++- .../test/TODO.txt | 3 ++ .../test/completion_test.yml | 31 ++++++++++++++++++ .../test/invoice.yml | 32 +++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 account_statement_base_completion/test/TODO.txt create mode 100644 account_statement_base_completion/test/completion_test.yml create mode 100644 account_statement_base_completion/test/invoice.yml diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py index d868a314..3147822f 100644 --- a/account_statement_base_completion/__openerp__.py +++ b/account_statement_base_completion/__openerp__.py @@ -66,7 +66,10 @@ 'security/ir.model.access.csv', ], 'demo_xml': [], - 'test': [], + 'test': [ + 'test/invoice.yml', + 'test/completion_test.yml' + ], 'installable': True, 'images': [], 'auto_install': False, diff --git a/account_statement_base_completion/test/TODO.txt b/account_statement_base_completion/test/TODO.txt new file mode 100644 index 00000000..42bd3f37 --- /dev/null +++ b/account_statement_base_completion/test/TODO.txt @@ -0,0 +1,3 @@ +* statement default company, or company required? +* on_change +* statment doesn't have a company, why? \ No newline at end of file diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml new file mode 100644 index 00000000..4936094f --- /dev/null +++ b/account_statement_base_completion/test/completion_test.yml @@ -0,0 +1,31 @@ +- + In order to test the banking framework, I first need to create a profile +- + !record {model: account.statement.profile, id: profile_test1}: + name: Bank EUR Profile + journal_id: account.bank_journal + commission_account_id: account.a_expense + company_id: base.main_company + balance_check: True + rule_ids: + - bank_statement_completion_rule_4 + - bank_statement_completion_rule_5 + - bank_statement_completion_rule_2 + - bank_statement_completion_rule_3 +- + Now I create a statement +- + !record {model: account.bank.statement, id: statement_test1}: + name: Statement 2 + profile_id: profile_test1 + company_id: base.main_company + line_ids: + - name: Test autocompletion based on Invoice Number + ref: CI0001 + date: '2013-12-13' + amount: 2100.0 +- + I run the auto complete +- + !python {model: account.bank.statement}: | + result = self.button_auto_completion(cr, uid, [ref("statement_test1")]) diff --git a/account_statement_base_completion/test/invoice.yml b/account_statement_base_completion/test/invoice.yml new file mode 100644 index 00000000..5b6845f5 --- /dev/null +++ b/account_statement_base_completion/test/invoice.yml @@ -0,0 +1,32 @@ +- + I create a customer Invoice to be found by the completion. +- + !record {model: account.invoice, id: invoice_for_completion_1}: + account_id: account.a_recv + company_id: base.main_company + currency_id: base.EUR + internal_number: CI0001 + invoice_line: + - account_id: account.a_sale + name: '[PCSC234] PC Assemble SC234' + price_unit: 450.0 + quantity: 1.0 + product_id: product.product_product_3 + uos_id: product.product_uom_unit + journal_id: account.bank_journal + partner_id: base.res_partner_12 + reference_type: none +- + I confirm the Invoice +- + !workflow {model: account.invoice, action: invoice_open, ref: invoice_for_completion_1} +- + I check that the invoice state is "Open" +- + !assert {model: account.invoice, id: invoice_for_completion_1}: + - state == 'open' +- + I check that it is given the number "CI0001" +- + !assert {model: account.invoice, id: invoice_for_completion_1, string: Check CI number}: + - number == 'CI0001'