[IMP] added unit test for partner fix in completion

This commit is contained in:
Matthieu Dietrich
2014-09-05 15:34:22 +02:00
parent 4871fc66f7
commit 1d24f28d56
3 changed files with 106 additions and 55 deletions

View File

@@ -19,68 +19,61 @@
#
##############################################################################
{
'name': "Bank statement base completion",
'version': '1.0.3',
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'Finance',
'complexity': 'normal',
'depends': ['account_statement_ext',
'account_report_company'],
'description': """
The goal of this module is to improve the basic bank statement, help dealing
with huge volume of reconciliation by providing basic rules to identify the
partner of a bank statement line.
Each bank statement profile can have its own rules to be applied according to a
sequence order.
{'name': "Bank statement base completion",
'version': '1.0.3',
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'Finance',
'complexity': 'normal',
'depends': ['account_statement_ext',
'account_report_company'],
'description': """
The goal of this module is to improve the basic bank statement, help dealing with huge volume of
reconciliation by providing basic rules to identify the partner of a bank statement line.
Each bank statement profile can have its own rules to be applied according to a sequence order.
Some basic rules are provided in this module:
1) Match from statement line label (based on partner field 'Bank Statement
Label')
1) Match from statement line label (based on partner field 'Bank Statement Label')
2) Match from statement line label (based on partner name)
3) Match from statement line reference (based on Invoice number)
You can easily override this module and add your own rules in your own one. The
basic rules only fill in the partner, but you can use them to fill in any
value of the line (in the future, we will add a rule to automatically match and
reconcile the line).
You can easily override this module and add your own rules in your own one. The basic rules only
fill in the partner, but you can use them to fill in any value of the line (in the future, we will
add a rule to automatically match and reconcile the line).
It adds as well a label on the bank statement line (on which the pre-define
rules can match) and a char field on the partner called 'Bank Statement Label'.
Using the pre-define rules, you will be able to match various labels for a
partner.
It adds as well a label on the bank statement line (on which the pre-define rules can match) and
a char field on the partner called 'Bank Statement Label'. Using the pre-define rules, you will be
able to match various labels for a partner.
The reference of the line is always used by the reconciliation process. We're
supposed to copy there (or write manually) the matching string. This can be:
the order Number or an invoice number, or anything that will be found in the
invoice accounting entry part to make the match.
The reference of the line is always used by the reconciliation process. We're supposed to copy
there (or write manually) the matching string. This can be: the order Number or an invoice number,
or anything that will be found in the invoice accounting entry part to make the match.
You can use it with our account_advanced_reconcile module to automatize the
reconciliation process.
You can use it with our account_advanced_reconcile module to automatize the reconciliation process.
TODO: The rules that look for invoices to find out the partner should take back
the payable / receivable account from there directly instead of retrieving it
from partner properties !
""",
'website': 'http://www.camptocamp.com',
'data': [
'statement_view.xml',
'partner_view.xml',
'data.xml',
'security/ir.model.access.csv',
],
'demo': [],
'test': [
'test/partner.yml',
'test/invoice.yml',
'test/supplier_invoice.yml',
'test/completion_test.yml'
],
'installable': True,
'images': [],
'auto_install': False,
'license': 'AGPL-3',
TODO: The rules that look for invoices to find out the partner should take back the payable / receivable
account from there directly instead of retrieving it from partner properties !
""",
'website': 'http://www.camptocamp.com',
'data': [
'statement_view.xml',
'partner_view.xml',
'data.xml',
'security/ir.model.access.csv',
],
'demo': [],
'test': [
'test/partner.yml',
'test/invoice.yml',
'test/supplier_invoice.yml',
'test/refund.yml',
'test/completion_test.yml'
],
'installable': True,
'images': [],
'auto_install': False,
'license': 'AGPL-3',
}

View File

@@ -38,6 +38,15 @@
ref: T2S12345
date: '2013-12-19'
amount: -65.0
-
I create a statement line for a CR
-
!record {model: account.bank.statement.line, id: statement_line_cr}:
name: Test autocompletion based on Customer Refund Number
statement_id: statement_test1
ref: CR0001
date: '2013-12-19'
amount: -210.0
-
I create a statement line for the Partner Name
-
@@ -76,12 +85,18 @@
!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.
Line 3. I expect the Customer refund number to be recognised. It should be
the commercial partner, and not the regular partner.
-
!assert {model: account.bank.statement.line, id: statement_line_cr, string: Check completion by CR number and commercial partner}:
- partner_id.id == _ref("base.res_partner_12")
-
Line 4. 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.
Line 5. 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")

View File

@@ -0,0 +1,43 @@
-
I create a "child" partner, to use in the invoice
(and have a different commercial_partner_id than itself)
-
!record {model: res.partner, id: res_partner_12_child}:
name: Child Partner
supplier: False
customer: True
is_company: False
parent_id: base.res_partner_12
-
I create a customer refund to be found by the completion.
-
!record {model: account.invoice, id: refund_for_completion_1}:
account_id: account.a_pay
company_id: base.main_company
currency_id: base.EUR
internal_number: CR0001
invoice_line:
- account_id: account.a_expense
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.expenses_journal
partner_id: res_partner_12_child
type: 'out_refund'
reference_type: none
-
I confirm the refund
-
!workflow {model: account.invoice, action: invoice_open, ref: refund_for_completion_1}
-
I check that the refund state is "Open"
-
!assert {model: account.invoice, id: refund_for_completion_1}:
- state == 'open'
-
I check that it is given the number "CR0001"
-
!assert {model: account.invoice, id: refund_for_completion_1, string: Check CI number}:
- number == 'CR0001'