[ADD] account_voucher: added case4_cad_chf.yml

bzr revid: qdp-launchpad@openerp.com-20111017092216-b8oe1ncesury89dm
This commit is contained in:
Quentin (OpenERP)
2011-10-17 11:22:16 +02:00
parent 7bef183b51
commit 8f6acc742f
3 changed files with 21 additions and 31 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ Account Voucher module includes all the basic requirements of Voucher Entries fo
"test/case2_usd_eur_debtor_in_eur.yml",
"test/case2_usd_eur_debtor_in_usd.yml",
"test/case3_eur_eur.yml",
#"test/case4_cad_chf.yml",
"test/case4_cad_chf.yml",
],
'certificate': '0037580727101',
"active": False,
@@ -155,7 +155,6 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
print "<<<<<<<<<<<<<<<<<"
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_EUR'), 200.0, 2, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
+20 -29
View File
@@ -28,7 +28,7 @@
!record {model: res.currency.rate, id: mar_chf}:
currency_id: base.CHF
name: !eval "'%s-03-01' %(datetime.now().year)"
rate: 1.250000
rate: 1.25000
-
I create a bank journal with CHF as currency
-
@@ -43,12 +43,6 @@
currency: base.CHF
company_id: base.main_company
view_id: account.account_journal_bank_view
-
I set up some accounts for currency rate expense/income in my company
-
!record {model: res.company, id: base.main_company}:
property_expense_currency_exchange: account.o_expense
property_income_currency_exchange: account.o_income
-
I create a new partner John Armani.
-
@@ -98,15 +92,15 @@
assert (move_line.debit - move_line.credit == 149.39), "Invoice move is incorrect for debtors account"
-
I create the first voucher of payment
<create with values 300 CHF, journal CHF, and fill amounts 200 for the invoice of 200 CAD>
<create with values 200 CHF, journal CHF, and completly pat the invoice of 200 CAD>
-
!python {model: account.voucher}: |
import netsvc, time
vals = {}
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 300.00, 2, ttype='receipt', date=False)
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 200.00, 2, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 300.00,
'amount': 200.00,
'company_id': ref('base.main_company'),
'currency_id': ref('base.CHF'),
'journal_id': ref('bank_journal_CHF'),
@@ -116,33 +110,26 @@
'date': time.strftime("%Y-03-01"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'exchange_acc_id': ref('account.o_expense'),
'comment': 'Write Off',
'name': 'First payment',
}
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
if item['amount_unreconciled'] == 200.00:
item['amount'] = 200.00
if item['amount_unreconciled'] == 186.74:
item['amount'] = 186.74
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
id = self.create(cr, uid, vals)
voucher_id = self.browse(cr, uid, id)
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
-
I check that writeoff amount computed is 175.0
I check that writeoff amount computed is 13.26
-
!python {model: account.voucher}: |
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
voucher_id = self.browse(cr, uid, voucher[0])
assert (voucher_id.writeoff_amount == 175.0), "Writeoff amount is not 175.0"
-
I check that currency rate difference is 49.39
-
!python {model: account.voucher}: |
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
voucher_id = self.browse(cr, uid, voucher[0])
curr_diff = float(str(voucher_id.currency_rate_difference))
assert (curr_diff == 49.39), "Currency rate difference is not 49.39"
assert (round(voucher_id.writeoff_amount,2) == 13.26), "Writeoff amount is not 13.26 CHF"
-
I confirm the voucher
-
@@ -165,11 +152,11 @@
-
I check that my debtor account is correct
-
I check that the debtor account has 1 new line with -200 as amount_currency columns and 149.39 of credit and currency is CAD($).
I check that the debtor account has 1 new line with -186.74 as amount_currency columns and 149.39 of credit and currency is CHF.
-
I check that my currency rate difference is correct. 49.39 in debit with no amount_currency
I check that my currency rate difference is correct. 0 in debit with no amount_currency
-
I check that my writeoff is correct. 140 credit and -175 amount_currency
I check that my writeoff is correct. 11.05 credit and 13.26 amount_currency
-
!python {model: account.voucher}: |
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
@@ -177,12 +164,16 @@
move_line_obj = self.pool.get('account.move.line')
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
for move_line in move_line_obj.browse(cr, uid, move_lines):
if move_line.amount_currency == -200:
if move_line.amount_currency == 200:
assert move_line.debit == 160.00, "Bank account has wrong entry."
elif move_line.amount_currency == -186.74:
assert move_line.credit == 149.39, "Debtor account has wrong entry."
elif move_line.debit == 49.39:
elif move_line.debit == 0.00 and move_line.credit == 0.00:
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
elif move_line.credit == 140.00:
assert move_line.amount_currency == -175.00, "Writeoff amount is wrong."
elif move_line.credit == 10.61:
assert move_line.amount_currency == 13.26, "Writeoff amount is wrong."
else:
assert False, "Wrong entry"
-
I check the residual amount of Invoice1, should be 0 in residual currency and 0 in amount_residual and paid
-