2
In order to test the banking framework, I first need to create a profile
4
!record {model: account.statement.profile, id: statement_profile_invoice_transactionid}:
5
name: Bank EUR Profile (invoice transaction ID)
6
journal_id: account.bank_journal
7
commission_account_id: account.a_expense
8
company_id: base.main_company
11
- bank_statement_completion_rule_trans_id_invoice
13
Now I create a statement. I create statment lines separately because I need
14
to find each one by XML id
16
!record {model: account.bank.statement, id: statement_invoice_transactionid_test1}:
17
name: Statement with transaction ID
18
profile_id: statement_profile_invoice_transactionid
19
company_id: base.main_company
21
I create a statement line for an invoice with transaction ID
23
!record {model: account.bank.statement.line, id: statement_line_invoice_transactionid}:
24
name: Test autocompletion based on invoice with transaction ID
25
statement_id: statement_invoice_transactionid_test1
26
transaction_id: XXX77Z
28
date: !eval time.strftime('%Y-%m-%d')
31
I run the auto complete
33
!python {model: account.bank.statement}: |
34
result = self.button_auto_completion(cr, uid, [ref("statement_invoice_transactionid_test1")])
36
Now I can check that all is nice and shiny, line 1. I expect the invoice has been
37
recognised from the transaction ID.
39
!assert {model: account.bank.statement.line, id: statement_line_invoice_transactionid, string: Check completion by Invoice transaction ID}:
40
- partner_id.name == u'Agrolait'
42
I verify if the reference of the move has been copied to the statement line
44
!python {model: account.bank.statement.line}: |
45
statement_line = self.browse(cr, uid, ref('statement_line_invoice_transactionid'))
46
invoice_obj = self.pool['account.invoice']
47
invoice = invoice_obj.browse(cr, uid, ref('invoice_with_transaction_id'))
48
reference = invoice.move_id.ref
49
assert statement_line.ref == reference