mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Merge pull request #35 from mdietrichc2c/statement_import_correction
Corrects issue with customer refunds and partner lookup for imported lines and add account_report_company as account_statement_base_completion dependency
This commit is contained in:
@@ -3,6 +3,7 @@ include =
|
||||
*/bank-statement-reconcile/*
|
||||
|
||||
omit =
|
||||
*/test/*
|
||||
*/tests/*
|
||||
*__init__.py
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
'maintainer': 'Camptocamp',
|
||||
'category': 'Finance',
|
||||
'complexity': 'normal',
|
||||
'depends': ['account_statement_ext'],
|
||||
'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
|
||||
@@ -76,6 +77,7 @@
|
||||
'test/partner.yml',
|
||||
'test/invoice.yml',
|
||||
'test/supplier_invoice.yml',
|
||||
'test/refund.yml',
|
||||
'test/completion_test.yml'
|
||||
],
|
||||
'installable': True,
|
||||
|
||||
@@ -191,13 +191,7 @@ class AccountStatementCompletionRule(orm.Model):
|
||||
res = {}
|
||||
inv = self._find_invoice(cr, uid, line, inv_type, context=context)
|
||||
if inv:
|
||||
# FIXME use only commercial_partner_id of invoice in 7.1
|
||||
# this is for backward compatibility in 7.0 before
|
||||
# the refactoring of res.partner
|
||||
if hasattr(inv, 'commercial_partner_id'):
|
||||
partner_id = inv.commercial_partner_id.id
|
||||
else:
|
||||
partner_id = inv.partner_id.id
|
||||
partner_id = inv.commercial_partner_id.id
|
||||
res = {'partner_id': partner_id,
|
||||
'account_id': inv.account_id.id,
|
||||
'type': inv_type}
|
||||
|
||||
@@ -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")
|
||||
|
||||
43
account_statement_base_completion/test/refund.yml
Normal file
43
account_statement_base_completion/test/refund.yml
Normal 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'
|
||||
@@ -110,7 +110,7 @@ class AccountStatementCompletionRule(Model):
|
||||
elif len(invoice_id) == 1:
|
||||
invoice = invoice_obj.browse(cr, uid, invoice_id[0],
|
||||
context=context)
|
||||
res['partner_id'] = invoice.partner_id.id
|
||||
res['partner_id'] = invoice.commercial_partner_id.id
|
||||
# we want the move to have the same ref than the found
|
||||
# invoice's move, thus it will be easier to link them for the
|
||||
# accountants
|
||||
|
||||
Reference in New Issue
Block a user