mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MRG][ADD] In account_statement_base_completion, account_statement_transactionid_completion provide YAML tests
This commit is contained in:
@@ -57,15 +57,19 @@
|
||||
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'data': [
|
||||
'statement_view.xml',
|
||||
'partner_view.xml',
|
||||
'data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': [],
|
||||
'demo': [],
|
||||
'test': [
|
||||
'test/partner.yml',
|
||||
'test/invoice.yml',
|
||||
'test/supplier_invoice.yml',
|
||||
'test/completion_test.yml'
|
||||
],
|
||||
'installable': True,
|
||||
'images': [],
|
||||
'auto_install': False,
|
||||
|
||||
87
account_statement_base_completion/test/completion_test.yml
Normal file
87
account_statement_base_completion/test/completion_test.yml
Normal file
@@ -0,0 +1,87 @@
|
||||
-
|
||||
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. I create statment lines separately because I need
|
||||
to find each one by XML id
|
||||
-
|
||||
!record {model: account.bank.statement, id: statement_test1}:
|
||||
name: Statement 2
|
||||
profile_id: profile_test1
|
||||
company_id: base.main_company
|
||||
-
|
||||
I create a statement line for a CI
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_ci}:
|
||||
name: Test autocompletion based on Customer Invoice Number
|
||||
statement_id: statement_test1
|
||||
ref: CI0001
|
||||
date: '2013-12-20'
|
||||
amount: 210.0
|
||||
-
|
||||
I create a statement line for a SI
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_si}:
|
||||
name: Test autocompletion based on Supplier Invoice Number
|
||||
statement_id: statement_test1
|
||||
ref: T2S12345
|
||||
date: '2013-12-19'
|
||||
amount: -65.0
|
||||
-
|
||||
I create a statement line for the Partner Name
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_partner_name}:
|
||||
name: Test autocompletion based on Partner Name Vauxoo
|
||||
statement_id: statement_test1
|
||||
ref: /
|
||||
date: '2013-12-17'
|
||||
amount: 600.0
|
||||
-
|
||||
I create a statement line for the Partner Label
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_partner_label}:
|
||||
name: test autocompletion based on text (XXX66Z) matching with partner form information (note that Ref does not exist)
|
||||
statement_id: statement_test1
|
||||
ref: ZU788
|
||||
date: '2013-12-24'
|
||||
amount: -932.4
|
||||
-
|
||||
I run the auto complete
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
result = self.button_auto_completion(cr, uid, [ref("statement_test1")])
|
||||
-
|
||||
Now I can check that all is nice and shiny, line 1. I expect the Customer
|
||||
Invoice Number to be recognised.
|
||||
I Use _ref, because ref conflicts with the field ref of the statement line
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_ci, string: Check completion by CI number}:
|
||||
- partner_id.id == _ref("base.res_partner_12")
|
||||
-
|
||||
Line 2. I expect the Supplier invoice number to be recognised. The supplier
|
||||
invoice was created by the account module demo data, and we confirmed it
|
||||
here.
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_si, string: Check completion by SI number}:
|
||||
- partner_id.id == _ref("base.res_partner_17")
|
||||
-
|
||||
Line 3. I check that the partner name has been recognised.
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_partner_name, string: Check completion by partner name}:
|
||||
- partner_id.name == 'Vauxoo'
|
||||
-
|
||||
Line 4. I check that the partner special label has been recognised.
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_partner_label, string: Check completion by partner label}:
|
||||
- partner_id.id == _ref("base.res_partner_6")
|
||||
32
account_statement_base_completion/test/invoice.yml
Normal file
32
account_statement_base_completion/test/invoice.yml
Normal file
@@ -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: 210.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'
|
||||
5
account_statement_base_completion/test/partner.yml
Normal file
5
account_statement_base_completion/test/partner.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
-
|
||||
I fill in the field Bank Statement Label in a Partner
|
||||
-
|
||||
!record {model: res.partner, id: base.res_partner_6}:
|
||||
bank_statement_label: XXX66Z
|
||||
31
account_statement_base_completion/test/supplier_invoice.yml
Normal file
31
account_statement_base_completion/test/supplier_invoice.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
-
|
||||
I check that my invoice is a supplier invoice
|
||||
-
|
||||
!assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type}:
|
||||
- type == 'in_invoice'
|
||||
-
|
||||
I add a reference to an existing supplier invoce
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
self.write(cr, uid, ref('account.demo_invoice_0'), {
|
||||
'supplier_invoice_number': 'T2S12345'
|
||||
})
|
||||
-
|
||||
I check a second time that my invoice is still a supplier invoice
|
||||
-
|
||||
!assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type 2}:
|
||||
- type == 'in_invoice'
|
||||
-
|
||||
Now I confirm it
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0}
|
||||
-
|
||||
I check that the supplier number is there
|
||||
-
|
||||
!assert {model: account.invoice, id: account.demo_invoice_0, string: Check supplier number}:
|
||||
- supplier_invoice_number == 'T2S12345'
|
||||
-
|
||||
I check a third time that my invoice is still a supplier invoice
|
||||
-
|
||||
!assert {model: account.invoice, id: account.demo_invoice_0, string: Check invoice type 3}:
|
||||
- type == 'in_invoice'
|
||||
@@ -48,7 +48,10 @@
|
||||
"data.xml",
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': [],
|
||||
'test': [
|
||||
'test/sale.yml',
|
||||
'test/completion_transactionid_test.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'images': [],
|
||||
'auto_install': True,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
-
|
||||
In order to test the banking framework, I first need to create a profile
|
||||
-
|
||||
!record {model: account.statement.profile, id: statement_profile_transactionid}:
|
||||
name: Bank EUR Profile (transaction ID)
|
||||
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
|
||||
- account_statement_base_completion.bank_statement_completion_rule_4
|
||||
- account_statement_base_completion.bank_statement_completion_rule_5
|
||||
- account_statement_base_completion.bank_statement_completion_rule_2
|
||||
- account_statement_base_completion.bank_statement_completion_rule_3
|
||||
-
|
||||
Now I create a statement. I create statment lines separately because I need
|
||||
to find each one by XML id
|
||||
-
|
||||
!record {model: account.bank.statement, id: statement_transactionid_test1}:
|
||||
name: Statement with transaction ID
|
||||
profile_id: statement_profile_transactionid
|
||||
company_id: base.main_company
|
||||
-
|
||||
I create a statement line for a SO with transaction ID
|
||||
-
|
||||
!record {model: account.bank.statement.line, id: statement_line_transactionid}:
|
||||
name: Test autocompletion based on SO with transaction ID
|
||||
statement_id: statement_transactionid_test1
|
||||
transaction_id: XXX66Z
|
||||
ref: 6
|
||||
date: '2014-01-06'
|
||||
amount: 118.4
|
||||
-
|
||||
I run the auto complete
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
result = self.button_auto_completion(cr, uid, [ref("statement_profile_transactionid")])
|
||||
-
|
||||
Now I can check that all is nice and shiny, line 1. I expect the SO has been
|
||||
recognised from the transaction ID.
|
||||
-
|
||||
!assert {model: account.bank.statement.line, id: statement_line_transactionid, string: Check completion by SO transaction ID}:
|
||||
- partner_id.name == u'Agrolait'
|
||||
11
account_statement_transactionid_completion/test/sale.yml
Normal file
11
account_statement_transactionid_completion/test/sale.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
-
|
||||
I create a new Sale Order with transaction ID
|
||||
-
|
||||
!record {model: sale.order, id: so_with_transaction_id}:
|
||||
partner_id: base.res_partner_2
|
||||
note: Invoice after delivery
|
||||
payment_term: account.account_payment_term
|
||||
transaction_id: XXX66Z
|
||||
order_line:
|
||||
- product_id: product.product_product_7
|
||||
product_uom_qty: 8
|
||||
Reference in New Issue
Block a user