Merge lp:~openerp-dev/openobject-addons/trunk-americanization_account_config-ssh into lp:openobject-addons

Proposed by Sunil Sharma(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-americanization_account_config-ssh
Merge into: lp:openobject-addons
Diff against target: 2034 lines (+425/-418)
29 files modified
account/account_unit_test.xml (+2/-2)
account/data/configurable_account_chart.xml (+1/-1)
account/demo/account_invoice_demo.xml (+1/-1)
account/demo/account_minimal.xml (+10/-9)
account/res_config.py (+11/-2)
account/test/account_change_currency.yml (+1/-1)
account/test/account_customer_invoice.yml (+2/-2)
account/test/account_invoice_state.yml (+1/-1)
account/test/account_report.yml (+1/-1)
account/test/account_sequence_test.yml (+1/-1)
account/test/account_supplier_invoice.yml (+1/-1)
account/test/test_edi_invoice.yml (+1/-1)
account_voucher/__openerp__.py (+6/-6)
account_voucher/test/case1_eur_eur.yml (+64/-64)
account_voucher/test/case1_eur_eur_payment_rate.yml (+47/-47)
account_voucher/test/case2_eur_usd_debtor_in_eur.yml (+65/-65)
account_voucher/test/case2_eur_usd_debtor_in_usd.yml (+63/-63)
account_voucher/test/case2_suppl_eur_usd.yml (+1/-1)
account_voucher/test/case3_usd_usd.yml (+18/-18)
account_voucher/test/case4_cad_chf.yml (+22/-22)
account_voucher/test/case5_suppl_usd_usd.yml (+49/-49)
account_voucher/test/case_usd_eur.yml (+34/-34)
account_voucher/test/sales_payment.yml (+2/-2)
multi_company/multi_company_demo.xml (+4/-4)
purchase/test/fifo_price.yml (+5/-5)
purchase/test/process/edi_purchase_order.yml (+5/-7)
report_intrastat/test/report_intrastat_report.yml (+1/-1)
sale/test/edi_sale_order.yml (+4/-5)
sale_crm/sale_crm_demo.xml (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-americanization_account_config-ssh
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Needs Fixing
Turkesh Patel (openERP) Pending
Review via email: mp+197330@code.launchpad.net

Description of the change

Hello,

Improve demo record and yml tests case for account,account_voucher.

Thanks
Sunil Sharma

To post a comment you must log in.
9002. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

9003. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9004. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9005. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9006. By Chirag Dodiya(OpenERP)

[MRG]Merge with lp:openobject-addons

9007. By Sunil Sharma(OpenERP)

[mrg]:openobject-addons

9008. By Sunil Sharma(OpenERP)

[MRG]:openobject-addons

9009. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9010. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9011. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addns

9012. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9013. By Sunil Sharma(OpenERP)

[MRG]:lp:openobject-addons

9014. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

9015. By Sunil Sharma(OpenERP)

[imp]:base currency used USD

9016. By Sunil Sharma(OpenERP)

[imp]:remove secondry currency

9017. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

9018. By Sunil Sharma(OpenERP)

[imp]:improve EUR Bank account -(test) demo

9019. By Sunil Sharma(OpenERP)

[imp]:improve currency for multicompany

9020. By Sunil Sharma(OpenERP)

lp:openobject-addons

9021. By Sunil Sharma(OpenERP)

[imp]:improve usd currency rate

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

- context should be pass to _get_company method.
- get_default_currency and set_default_currency should use get_company_currency.
- yml file should be rename.
- EDI purchase pricelist (EUR) .. why we are taking ref of eur ?

review: Needs Fixing
9022. By Sunil Sharma(OpenERP)

[imp]:improve get_default and set_default method

9023. By Sunil Sharma(OpenERP)

[rename]:rename test case convince

9024. By Sunil Sharma(OpenERP)

[rename]:rename test case convince

9025. By Sunil Sharma(OpenERP)

[imp]:base currency USD

9026. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

Revision history for this message
Sunil Sharma(OpenERP) (sunil.sharma-openerp) wrote :

Hello Sir,

 I have done following changes as per suggestion.

 1. context should be pass to _get_company method.
 2. get_default_currency and set_default_currency should use get_company_currency.
 3. yml file should be rename.
 4. EDI purchase pricelist "Default Purchase Pricelist".

Thanks
Sunil Sharma (SSH)

9027. By Sunil Sharma(OpenERP)

[imp]:improve set_default_currency method

9028. By Sunil Sharma(OpenERP)

[mrg]:lp:openobejct-addons

9029. By Sunil Sharma(OpenERP)

[imp]:improve yml currency rate

9030. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9031. By Sunil Sharma(OpenERP)

[imp]:improve yml currency rate

9032. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9033. By Sunil Sharma(OpenERP)

[imp]:improve valid msg

9034. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9035. By Sunil Sharma(OpenERP)

improve yml

Unmerged revisions

9035. By Sunil Sharma(OpenERP)

improve yml

9034. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9033. By Sunil Sharma(OpenERP)

[imp]:improve valid msg

9032. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9031. By Sunil Sharma(OpenERP)

[imp]:improve yml currency rate

9030. By Sunil Sharma(OpenERP)

[imp]:improve rate for near to EUR rate

9029. By Sunil Sharma(OpenERP)

[imp]:improve yml currency rate

9028. By Sunil Sharma(OpenERP)

[mrg]:lp:openobejct-addons

9027. By Sunil Sharma(OpenERP)

[imp]:improve set_default_currency method

9026. By Sunil Sharma(OpenERP)

[mrg]:lp:openobject-addons

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/account_unit_test.xml'
--- account/account_unit_test.xml 2013-11-13 13:01:07 +0000
+++ account/account_unit_test.xml 2014-05-14 12:25:54 +0000
@@ -3,7 +3,7 @@
3 <data>3 <data>
4 <!-- This file must be loaded _after_ account_demo.xml ! -->4 <!-- This file must be loaded _after_ account_demo.xml ! -->
5 <record id="test_invoice_1" model="account.invoice">5 <record id="test_invoice_1" model="account.invoice">
6 <field name="currency_id" ref="base.EUR"/>6 <field name="currency_id" ref="base.USD"/>
7 <field name="company_id" ref="base.main_company"/>7 <field name="company_id" ref="base.main_company"/>
8 <field name="partner_id" ref="base.res_partner_1"/>8 <field name="partner_id" ref="base.res_partner_1"/>
9 <field name="journal_id" ref="account.sales_journal"/>9 <field name="journal_id" ref="account.sales_journal"/>
@@ -35,7 +35,7 @@
35 </record>35 </record>
3636
37 <assert id="test_invoice_1" model="account.invoice" string="The currency unit of Test invoice 1 is EUR">37 <assert id="test_invoice_1" model="account.invoice" string="The currency unit of Test invoice 1 is EUR">
38 <test expr="currency_id.symbol">€</test>38 <test expr="currency_id.symbol">$</test>
39 </assert>39 </assert>
4040
41 <assert id="test_invoice_1" model="account.invoice" severity="error" string="The amount of Test invoice 1 is correct">41 <assert id="test_invoice_1" model="account.invoice" severity="error" string="The amount of Test invoice 1 is correct">
4242
=== modified file 'account/data/configurable_account_chart.xml'
--- account/data/configurable_account_chart.xml 2012-11-29 22:26:45 +0000
+++ account/data/configurable_account_chart.xml 2014-05-14 12:25:54 +0000
@@ -371,7 +371,7 @@
371 </record>371 </record>
372372
373 <record id="configurable_chart_template" model="account.chart.template">373 <record id="configurable_chart_template" model="account.chart.template">
374 <field name="name">Configurable Account Chart Template</field>374 <field name="name">Configurable Chart of Accounts Template</field>
375 <field name="account_root_id" ref="conf_chart0"/>375 <field name="account_root_id" ref="conf_chart0"/>
376 <field name="tax_code_root_id" ref="tax_code_chart_root"/>376 <field name="tax_code_root_id" ref="tax_code_chart_root"/>
377 <field name="bank_account_view_id" ref="conf_bnk"/>377 <field name="bank_account_view_id" ref="conf_bnk"/>
378378
=== modified file 'account/demo/account_invoice_demo.xml'
--- account/demo/account_invoice_demo.xml 2012-11-29 22:26:45 +0000
+++ account/demo/account_invoice_demo.xml 2014-05-14 12:25:54 +0000
@@ -5,7 +5,7 @@
5 <field name="date_due" eval="time.strftime('%Y')+'-01-30'"/>5 <field name="date_due" eval="time.strftime('%Y')+'-01-30'"/>
6 <field name="payment_term" ref="account.account_payment_term"/>6 <field name="payment_term" ref="account.account_payment_term"/>
7 <field name="journal_id" ref="account.expenses_journal"/>7 <field name="journal_id" ref="account.expenses_journal"/>
8 <field name="currency_id" ref="base.EUR"/>8 <field name="currency_id" ref="base.USD"/>
9 <field name="user_id" ref="base.user_demo"/>9 <field name="user_id" ref="base.user_demo"/>
10 <field name="reference_type">none</field>10 <field name="reference_type">none</field>
11 <field name="company_id" ref="base.main_company"/>11 <field name="company_id" ref="base.main_company"/>
1212
=== modified file 'account/demo/account_minimal.xml'
--- account/demo/account_minimal.xml 2013-10-27 12:31:04 +0000
+++ account/demo/account_minimal.xml 2014-05-14 12:25:54 +0000
@@ -122,13 +122,13 @@
122 <field name="type">other</field>122 <field name="type">other</field>
123 <field name="user_type" ref="data_account_type_income"/>123 <field name="user_type" ref="data_account_type_income"/>
124 </record>124 </record>
125 <record id="usd_bnk" model="account.account">125 <record id="eur_bnk" model="account.account">
126 <field name="code">X11007</field>126 <field name="code">X11007</field>
127 <field name="name">USD Bank Account - (test)</field>127 <field name="name">EUR Bank Account - (test)</field>
128 <field ref="cas" name="parent_id"/>128 <field ref="cas" name="parent_id"/>
129 <field name="type">liquidity</field>129 <field name="type">liquidity</field>
130 <field name="user_type" ref="data_account_type_asset"/>130 <field name="user_type" ref="data_account_type_asset"/>
131 <field name="currency_id" ref="base.USD"/>131 <field name="currency_id" ref="base.EUR"/>
132 </record>132 </record>
133133
134 <record model="account.account" id="liabilities_view">134 <record model="account.account" id="liabilities_view">
@@ -409,14 +409,15 @@
409 <field name="user_id" ref="base.user_root"/>409 <field name="user_id" ref="base.user_root"/>
410 </record>410 </record>
411411
412 <record id="bank_journal_usd" model="account.journal">412 <record id="bank_journal_eur" model="account.journal">
413 <field name="name">USD Bank Journal - (test)</field>413 <field name="name">EUR Bank Journal - (test)</field>
414 <field name="code">TUBK</field>414 <field name="code">TEBK</field>
415 <field name="type">bank</field>415 <field name="type">bank</field>
416 <field name="default_debit_account_id" ref="usd_bnk"/>416 <field name="default_debit_account_id" ref="eur_bnk"/>
417 <field name="default_credit_account_id" ref="usd_bnk"/>417 <field name="default_credit_account_id" ref="eur_bnk"/>
418 <field name="currency" ref="base.USD"/>418 <field name="currency" ref="base.EUR"/>
419 </record>419 </record>
420
420 <!--421 <!--
421 Product income and expense accounts, default parameters422 Product income and expense accounts, default parameters
422 -->423 -->
423424
=== modified file 'account/res_config.py'
--- account/res_config.py 2014-04-23 11:40:53 +0000
+++ account/res_config.py 2014-05-14 12:25:54 +0000
@@ -39,8 +39,7 @@
39 'expects_chart_of_accounts': fields.related('company_id', 'expects_chart_of_accounts', type='boolean',39 'expects_chart_of_accounts': fields.related('company_id', 'expects_chart_of_accounts', type='boolean',
40 string='This company has its own chart of accounts',40 string='This company has its own chart of accounts',
41 help="""Check this box if this company is a legal entity."""),41 help="""Check this box if this company is a legal entity."""),
42 'currency_id': fields.related('company_id', 'currency_id', type='many2one', relation='res.currency', required=True,42 'currency_id': fields.many2one('res.currency', required=True, string='Default company currency', help="Main currency of the company."),
43 string='Default company currency', help="Main currency of the company."),
44 'paypal_account': fields.related('company_id', 'paypal_account', type='char', size=128,43 'paypal_account': fields.related('company_id', 'paypal_account', type='char', size=128,
45 string='Paypal account', help="Paypal account (email) for receiving online payments (credit card, etc.) If you set a paypal account, the customer will be able to pay your invoices or quotations with a button \"Pay with Paypal\" in automated emails or through the OpenERP portal."),44 string='Paypal account', help="Paypal account (email) for receiving online payments (credit card, etc.) If you set a paypal account, the customer will be able to pay your invoices or quotations with a button \"Pay with Paypal\" in automated emails or through the OpenERP portal."),
46 'company_footer': fields.related('company_id', 'rml_footer', type='text', readonly=True,45 'company_footer': fields.related('company_id', 'rml_footer', type='text', readonly=True,
@@ -127,6 +126,16 @@
127 implied_group="account.group_supplier_inv_check_total"),126 implied_group="account.group_supplier_inv_check_total"),
128 }127 }
129128
129 def set_default_currency(self, cr, uid, ids, context=None):
130 config_data = self.browse(cr, uid, ids, context=context)[0]
131 company_id = config_data.company_id.id
132 currency_id = config_data.currency_id.id
133 return self.pool.get('res.company').write(cr, uid, [company_id], {'currency_id': currency_id}, context=context)
134
135 def get_default_currency(self, cr, uid, fields, context=None):
136 currency_id = self.pool.get('res.company')._get_company_currency(cr, uid, uid, context)
137 return {'currency_id': currency_id}
138
130 def _default_company(self, cr, uid, context=None):139 def _default_company(self, cr, uid, context=None):
131 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)140 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
132 return user.company_id.id141 return user.company_id.id
133142
=== modified file 'account/test/account_change_currency.yml'
--- account/test/account_change_currency.yml 2012-11-29 22:26:45 +0000
+++ account/test/account_change_currency.yml 2014-05-14 12:25:54 +0000
@@ -4,7 +4,7 @@
4 !record {model: account.invoice, id: account_invoice_currency}:4 !record {model: account.invoice, id: account_invoice_currency}:
5 account_id: account.a_recv5 account_id: account.a_recv
6 company_id: base.main_company6 company_id: base.main_company
7 currency_id: base.EUR7 currency_id: base.USD
8 invoice_line:8 invoice_line:
9 - account_id: account.a_sale9 - account_id: account.a_sale
10 name: '[PCSC234] PC Assemble SC234'10 name: '[PCSC234] PC Assemble SC234'
1111
=== modified file 'account/test/account_customer_invoice.yml'
--- account/test/account_customer_invoice.yml 2013-10-27 12:31:04 +0000
+++ account/test/account_customer_invoice.yml 2014-05-14 12:25:54 +0000
@@ -36,8 +36,8 @@
36 I manually assign tax on invoice36 I manually assign tax on invoice
37-37-
38 !python {model: account.invoice.tax}: |38 !python {model: account.invoice.tax}: |
39 amt = self.amount_change(cr, uid, [], 50.0, ref('base.EUR'), ref('base.main_company'), False)39 amt = self.amount_change(cr, uid, [], 50.0, ref('base.USD'), ref('base.main_company'), False)
40 base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.EUR'), ref('base.main_company'), False)40 base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.USD'), ref('base.main_company'), False)
41 invoice_tax_line = {41 invoice_tax_line = {
42 'name': 'Test Tax for Customer Invoice',42 'name': 'Test Tax for Customer Invoice',
43 'manual': 1,43 'manual': 1,
4444
=== modified file 'account/test/account_invoice_state.yml'
--- account/test/account_invoice_state.yml 2013-10-27 12:31:04 +0000
+++ account/test/account_invoice_state.yml 2014-05-14 12:25:54 +0000
@@ -9,7 +9,7 @@
9 !record {model: account.invoice, id: account_invoice_state}:9 !record {model: account.invoice, id: account_invoice_state}:
10 account_id: account.a_recv10 account_id: account.a_recv
11 company_id: base.main_company11 company_id: base.main_company
12 currency_id: base.EUR12 currency_id: base.USD
13 invoice_line:13 invoice_line:
14 - account_id: account.a_sale14 - account_id: account.a_sale
15 name: '[PCSC234] PC Assemble SC234'15 name: '[PCSC234] PC Assemble SC234'
1616
=== modified file 'account/test/account_report.yml'
--- account/test/account_report.yml 2014-04-02 16:40:53 +0000
+++ account/test/account_report.yml 2014-05-14 12:25:54 +0000
@@ -2,7 +2,7 @@
2 In order to test the PDF reports defined on an invoice, we will create a Invoice Record2 In order to test the PDF reports defined on an invoice, we will create a Invoice Record
3-3-
4 !record {model: account.invoice, id: test_invoice_1}:4 !record {model: account.invoice, id: test_invoice_1}:
5 currency_id: base.EUR5 currency_id: base.USD
6 company_id: base.main_company6 company_id: base.main_company
7 partner_id: base.res_partner_17 partner_id: base.res_partner_1
8 state: draft8 state: draft
99
=== modified file 'account/test/account_sequence_test.yml'
--- account/test/account_sequence_test.yml 2012-11-29 22:26:45 +0000
+++ account/test/account_sequence_test.yml 2014-05-14 12:25:54 +0000
@@ -17,7 +17,7 @@
17- !record {model: account.invoice, id: invoice_seq_test}:17- !record {model: account.invoice, id: invoice_seq_test}:
18 account_id: account.a_recv18 account_id: account.a_recv
19 company_id: base.main_company19 company_id: base.main_company
20 currency_id: base.EUR20 currency_id: base.USD
21 invoice_line:21 invoice_line:
22 - account_id: account.a_sale22 - account_id: account.a_sale
23 name: '[PC-DEM] PC on Demand'23 name: '[PC-DEM] PC on Demand'
2424
=== modified file 'account/test/account_supplier_invoice.yml'
--- account/test/account_supplier_invoice.yml 2013-10-27 12:31:04 +0000
+++ account/test/account_supplier_invoice.yml 2014-05-14 12:25:54 +0000
@@ -30,7 +30,7 @@
30 account_id: account.a_pay30 account_id: account.a_pay
31 check_total: 3000.031 check_total: 3000.0
32 company_id: base.main_company32 company_id: base.main_company
33 currency_id: base.EUR33 currency_id: base.USD
34 invoice_line:34 invoice_line:
35 - account_id: account.a_expense35 - account_id: account.a_expense
36 name: '[PCSC234] PC Assemble SC234'36 name: '[PCSC234] PC Assemble SC234'
3737
=== modified file 'account/test/test_edi_invoice.yml'
--- account/test/test_edi_invoice.yml 2012-11-29 22:26:45 +0000
+++ account/test/test_edi_invoice.yml 2014-05-14 12:25:54 +0000
@@ -6,7 +6,7 @@
6 !record {model: account.invoice, id: invoice_edi_1}:6 !record {model: account.invoice, id: invoice_edi_1}:
7 journal_id: 17 journal_id: 1
8 partner_id: base.res_partner_28 partner_id: base.res_partner_2
9 currency_id: base.EUR9 currency_id: base.USD
10 company_id: 110 company_id: 1
11 account_id: account.a_pay11 account_id: account.a_pay
12 date_invoice: !eval "'%s' % (time.strftime('%Y-%m-%d'))"12 date_invoice: !eval "'%s' % (time.strftime('%Y-%m-%d'))"
1313
=== modified file 'account_voucher/__openerp__.py'
--- account_voucher/__openerp__.py 2014-04-02 16:40:53 +0000
+++ account_voucher/__openerp__.py 2014-05-14 12:25:54 +0000
@@ -65,13 +65,13 @@
65 'test/account_voucher.yml',65 'test/account_voucher.yml',
66 'test/sales_receipt.yml',66 'test/sales_receipt.yml',
67 'test/sales_payment.yml',67 'test/sales_payment.yml',
68 'test/case1_usd_usd.yml',68 'test/case1_eur_eur.yml',
69 'test/case1_usd_usd_payment_rate.yml',69 'test/case1_eur_eur_payment_rate.yml',
70 'test/case2_usd_eur_debtor_in_eur.yml',70 'test/case2_eur_usd_debtor_in_usd.yml',
71 'test/case2_usd_eur_debtor_in_usd.yml',71 'test/case2_eur_usd_debtor_in_eur.yml',
72 'test/case3_eur_eur.yml',72 'test/case3_usd_usd.yml',
73 'test/case4_cad_chf.yml',73 'test/case4_cad_chf.yml',
74 'test/case_eur_usd.yml',74 'test/case_usd_eur.yml',
75 ],75 ],
76 'auto_install': False,76 'auto_install': False,
77 'application': True,77 'application': True,
7878
=== renamed file 'account_voucher/test/case1_usd_usd.yml' => 'account_voucher/test/case1_eur_eur.yml'
--- account_voucher/test/case1_usd_usd.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case1_eur_eur.yml 2014-05-14 12:25:54 +0000
@@ -1,6 +1,6 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create 2 Invoices in USD and make 2 Payments in USD based on the currency rating on that particular date3 I create 2 Invoices in EUR and make 2 Payments in EUR based on the currency rating on that particular date
4-4-
5 I set the income and expense currency accounts on the main company5 I set the income and expense currency accounts on the main company
6-6-
@@ -11,69 +11,69 @@
11 'expense_currency_exchange_account_id': ref('account.o_expense')}11 'expense_currency_exchange_account_id': ref('account.o_expense')}
12 self.write(cr, uid, ref('base.main_company'), vals)12 self.write(cr, uid, ref('base.main_company'), vals)
13-13-
14 I create currency USD in OpenERP for January of 1.333333 Rate14 I create currency EUR in OpenERP for January of 0.800000 Rate
15-15-
16 !python {model: res.currency.rate}: |16 !python {model: res.currency.rate}: |
17 from datetime import datetime17 from datetime import datetime
18 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])[0]18 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'EUR')])[0]
19 date = '%s-01-01' %(datetime.now().year)19 date = '%s-01-01' %(datetime.now().year)
20 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])20 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])
21 self.write(cr, uid, ids, {'rate': 1.333333})21 self.write(cr, uid, ids, {'rate': 0.800000})
22-22-
23 I create currency USD in OpenERP for February of 1.250000 Rate23 I create currency EUR in OpenERP for February of 0.700000 Rate
24-24-
25 !record {model: res.currency.rate, id: feb_usd}:25 !record {model: res.currency.rate, id: feb_eur}:
26 currency_id: base.USD26 currency_id: base.EUR
27 name: !eval "'%s-02-01' %(datetime.now().year)"27 name: !eval "'%s-02-01' %(datetime.now().year)"
28 rate: 1.25000028 rate: 0.700000
2929
30-30-
31 I create currency USD in OpenERP for March of 1.111111 Rate31 I create currency EUR in OpenERP for March of 0.600000 Rate
32-32-
33 !record {model: res.currency.rate, id: mar_usd}:33 !record {model: res.currency.rate, id: mar_eur}:
34 currency_id: base.USD34 currency_id: base.EUR
35 name: !eval "'%s-03-01' %(datetime.now().year)"35 name: !eval "'%s-03-01' %(datetime.now().year)"
36 rate: 1.11111136 rate: 0.600000
3737
38-38-
39 I create currency USD in OpenERP for April of 1.052632 Rate39 I create currency EUR in OpenERP for April of 0.500000 Rate
40-40-
41 !record {model: res.currency.rate, id: apr_usd}:41 !record {model: res.currency.rate, id: apr_eur}:
42 currency_id: base.USD42 currency_id: base.EUR
43 name: !eval "'%s-04-01' %(datetime.now().year)"43 name: !eval "'%s-04-01' %(datetime.now().year)"
44 rate: 1.05263244 rate: 0.500000
4545
46-46-
47 I create a cash account with currency USD47 I create a cash account with currency EUR
48-48-
49 !record {model: account.account, id: account_cash_usd_id}:49 !record {model: account.account, id: account_cash_eur_id}:
50 currency_id: base.USD50 currency_id: base.EUR
51 name: "cash account in usd"51 name: "cash account in EUR"
52 code: "Xcash usd"52 code: "Xcash EUR"
53 type: 'liquidity'53 type: 'liquidity'
54 user_type: "account.data_account_type_cash"54 user_type: "account.data_account_type_cash"
5555
56-56-
57 I create a bank journal with USD as currency57 I create a bank journal with EUR as currency
58-58-
59 !record {model: account.journal, id: bank_journal_USD}:59 !record {model: account.journal, id: bank_journal_EUR}:
60 name: Bank Journal(USD)60 name: Bank Journal(EUR)
61 code: BUSD61 code: BEUR
62 type: bank62 type: bank
63 analytic_journal_id: account.sit63 analytic_journal_id: account.sit
64 sequence_id: account.sequence_bank_journal64 sequence_id: account.sequence_bank_journal
65 default_debit_account_id: account_cash_usd_id65 default_debit_account_id: account_cash_eur_id
66 default_credit_account_id: account_cash_usd_id66 default_credit_account_id: account_cash_eur_id
67 currency: base.USD67 currency: base.EUR
68 company_id: base.main_company68 company_id: base.main_company
6969
70-70-
71 I create the first invoice on 1st January for 200 USD71 I create the first invoice on 1st January for 200 EUR
72-72-
73 !record {model: account.invoice, id: account_invoice_jan}:73 !record {model: account.invoice, id: account_invoice_jan}:
74 account_id: account.a_recv74 account_id: account.a_recv
75 company_id: base.main_company75 company_id: base.main_company
76 currency_id: base.USD76 currency_id: base.EUR
77 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"77 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
78 period_id: account.period_178 period_id: account.period_1
79 invoice_line:79 invoice_line:
@@ -91,7 +91,7 @@
91-91-
92 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan}92 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan}
93-93-
94 I check that first invoice move is correct for debtor account (debit - credit == 150.0)94 I check that first invoice move is correct for debtor account (debit - credit == 250.0)
95-95-
96 !python {model: account.invoice}: |96 !python {model: account.invoice}: |
97 invoice_id = self.browse(cr, uid, ref("account_invoice_jan"))97 invoice_id = self.browse(cr, uid, ref("account_invoice_jan"))
@@ -99,14 +99,14 @@
99 move_line_obj = self.pool.get('account.move.line')99 move_line_obj = self.pool.get('account.move.line')
100 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])100 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
101 move_line = move_line_obj.browse(cr, uid, move_lines[0])101 move_line = move_line_obj.browse(cr, uid, move_lines[0])
102 assert (move_line.debit - move_line.credit == 150.0), "Invoice move is not correct for debtors account"102 assert (move_line.debit - move_line.credit == 250.0), "Invoice move is not correct for debtors account"
103-103-
104 I create the second invoice on 1st February for 100 USD104 I create the second invoice on 1st February for 100 EUR
105-105-
106 !record {model: account.invoice, id: account_invoice_feb}:106 !record {model: account.invoice, id: account_invoice_feb}:
107 account_id: account.a_recv107 account_id: account.a_recv
108 company_id: base.main_company108 company_id: base.main_company
109 currency_id: base.USD109 currency_id: base.EUR
110 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"110 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
111 period_id: account.period_2111 period_id: account.period_2
112 invoice_line:112 invoice_line:
@@ -124,7 +124,7 @@
124-124-
125 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb}125 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb}
126-126-
127 I check that second invoice move is correct for debtor account (debit - credit == 80)127 I check that second invoice move is correct for debtor account (debit - credit == 142.86)
128-128-
129 !python {model: account.invoice}: |129 !python {model: account.invoice}: |
130 invoice_id = self.browse(cr, uid, ref("account_invoice_feb"))130 invoice_id = self.browse(cr, uid, ref("account_invoice_feb"))
@@ -132,7 +132,7 @@
132 move_line_obj = self.pool.get('account.move.line')132 move_line_obj = self.pool.get('account.move.line')
133 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])133 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
134 move_line = move_line_obj.browse(cr, uid, move_lines[0])134 move_line = move_line_obj.browse(cr, uid, move_lines[0])
135 assert (move_line.debit - move_line.credit == 80), "Invoice move is not correct for debtors account"135 assert (move_line.debit - move_line.credit == 142.86), "Invoice move is not correct for debtors account"
136136
137-137-
138 I set the context that will be used for the encoding of all the vouchers of this file138 I set the context that will be used for the encoding of all the vouchers of this file
@@ -140,14 +140,14 @@
140 !context140 !context
141 'type': 'receipt'141 'type': 'receipt'
142-142-
143 On the first March, I create the first voucher of payment with values 240 USD, journal USD, 143 On the first March, I create the first voucher of payment with values 240 EUR, journal EUR,
144-144-
145 !record {model: account.voucher, id: account_voucher_1_case1, view: view_vendor_receipt_form}:145 !record {model: account.voucher, id: account_voucher_1_case1, view: view_vendor_receipt_form}:
146 account_id: account.cash146 account_id: account.cash
147 amount: 240.0147 amount: 240.0
148 company_id: base.main_company148 company_id: base.main_company
149 journal_id: bank_journal_USD149 journal_id: bank_journal_EUR
150 name: 'First payment: Case 1 USD/USD'150 name: 'First payment: Case 1 EUR/EUR'
151 partner_id: base.res_partner_19151 partner_id: base.res_partner_19
152 period_id: account.period_3152 period_id: account.period_3
153 date: !eval time.strftime("%Y-03-01")153 date: !eval time.strftime("%Y-03-01")
@@ -174,20 +174,20 @@
174 I check that writeoff amount computed is -10.0174 I check that writeoff amount computed is -10.0
175-175-
176 !python {model: account.voucher}: |176 !python {model: account.voucher}: |
177 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))])177 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 EUR/EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
178 voucher_id = self.browse(cr, uid, voucher[0])178 voucher_id = self.browse(cr, uid, voucher[0])
179 assert (voucher_id.writeoff_amount == -10.0), "Writeoff amount is not -10.0"179 assert (voucher_id.writeoff_amount == -10.0), "Writeoff amount is not -10.0"
180-180-
181 I confirm the voucher181 I confirm the voucher
182-182-
183 !python {model: account.voucher}: |183 !python {model: account.voucher}: |
184 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))])184 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 EUR/EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
185 self.signal_proforma_voucher(cr, uid, voucher)185 self.signal_proforma_voucher(cr, uid, voucher)
186-186-
187 I check that the move of my first voucher is valid187 I check that the move of my first voucher is valid
188-188-
189 !python {model: account.voucher}: |189 !python {model: account.voucher}: |
190 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))])190 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 EUR/EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
191 voucher_id = self.browse(cr, uid, voucher[0])191 voucher_id = self.browse(cr, uid, voucher[0])
192 move_line_obj = self.pool.get('account.move.line')192 move_line_obj = self.pool.get('account.move.line')
193 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])193 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
@@ -196,24 +196,24 @@
196-196-
197 I check that my debtor account is correct197 I check that my debtor account is correct
198-198-
199 I check that the debtor account has 2 new lines with -180 and -70 as amount_currency columns and that their credit columns are respectively 162 and 63199 I check that the debtor account has 2 new lines with -180 and -70 as amount_currency columns and that their credit columns are respectively 300 and 116.67
200-200-
201 I check that my write-off is correct. 9 debit and 10 amount_currency201 I check that my write-off is correct. 16.67 debit and 10 amount_currency
202-202-
203 !python {model: account.voucher}: |203 !python {model: account.voucher}: |
204 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))])204 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 EUR/EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
205 voucher_id = self.browse(cr, uid, voucher[0])205 voucher_id = self.browse(cr, uid, voucher[0])
206 move_line_obj = self.pool.get('account.move.line')206 move_line_obj = self.pool.get('account.move.line')
207 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])207 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
208 for move_line in move_line_obj.browse(cr, uid, move_lines):208 for move_line in move_line_obj.browse(cr, uid, move_lines):
209 if move_line.amount_currency == -180.00:209 if move_line.amount_currency == -180.00:
210 assert move_line.credit == 162.00, "Debtor account has wrong entry."210 assert move_line.credit == 300.0, "Debtor account has wrong entry."
211 elif move_line.amount_currency == -70.00:211 elif move_line.amount_currency == -70.00:
212 assert move_line.credit == 63.00, "Debtor account has wrong entry."212 assert move_line.credit == 116.67, "Debtor account has wrong entry."
213 elif move_line.amount_currency == 10.00:213 elif move_line.amount_currency == 10.00:
214 assert move_line.debit == 9.00, "Writeoff amount is wrong."214 assert move_line.debit == 16.67, "Writeoff amount is wrong."
215 elif move_line.amount_currency == 240.00:215 elif move_line.amount_currency == 240.00:
216 assert move_line.debit == 216.00, "Bank entry is wrong."216 assert move_line.debit == 400.00, "Bank entry is wrong."
217 else:217 else:
218 assert False, "Unrecognized journal entry"218 assert False, "Unrecognized journal entry"
219-219-
@@ -235,13 +235,13 @@
235 move_line = move_line_obj.browse(cr, uid, move_lines[0])235 move_line = move_line_obj.browse(cr, uid, move_lines[0])
236 assert (move_line.amount_residual_currency == 30.0) , "Residual amount is not correct for first Invoice"236 assert (move_line.amount_residual_currency == 30.0) , "Residual amount is not correct for first Invoice"
237-237-
238 On the first April, I create the second voucher of payment with values 45 USD, journal USD, 238 On the first April, I create the second voucher of payment with values 45 EUR, journal EUR,
239-239-
240 !record {model: account.voucher, id: account_voucher_2_case1, view: view_vendor_receipt_form}:240 !record {model: account.voucher, id: account_voucher_2_case1, view: view_vendor_receipt_form}:
241 account_id: account.cash241 account_id: account.cash
242 amount: 45.0242 amount: 45.0
243 company_id: base.main_company243 company_id: base.main_company
244 journal_id: bank_journal_USD244 journal_id: bank_journal_EUR
245 name: 'Second payment: Case 1'245 name: 'Second payment: Case 1'
246 partner_id: base.res_partner_19246 partner_id: base.res_partner_19
247 period_id: account.period_3247 period_id: account.period_3
@@ -290,13 +290,13 @@
290-290-
291 I check that my debtor account is correct291 I check that my debtor account is correct
292-292-
293 I check that the debtor account has 2 new lines with -20 and -30 as amount_currency columns and their credit columns are respectively 19 and 28.5293 I check that the debtor account has 2 new lines with -20 and -30 as amount_currency columns and their credit columns are respectively 40 and 60
294-294-
295 I check that my currency rate difference is correct. 8.5 in credit with no amount_currency295 I check that my currency rate difference is correct. 8.5 in credit with no amount_currency
296-296-
297 I check that the total reconcilation created entries as expected297 I check that the total reconcilation created entries as expected
298-298-
299 I check that my writeoff is correct. 4.75 debit and 5 amount_currency299 I check that my writeoff is correct. 10.0 debit and 5 amount_currency
300-300-
301 !python {model: account.voucher}: |301 !python {model: account.voucher}: |
302 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 1'), ('partner_id', '=', ref('base.res_partner_19'))])302 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 1'), ('partner_id', '=', ref('base.res_partner_19'))])
@@ -313,21 +313,21 @@
313 reconcile_a = move_line.reconcile_id.id313 reconcile_a = move_line.reconcile_id.id
314 for move_line in move_line_obj.browse(cr, uid, move_lines):314 for move_line in move_line_obj.browse(cr, uid, move_lines):
315 if move_line.amount_currency == -20.00:315 if move_line.amount_currency == -20.00:
316 assert move_line.credit == 19.00, "Debtor account has wrong entry."316 assert move_line.credit == 40.00, "Debtor account has wrong entry."
317 elif move_line.amount_currency == -30.00:317 elif move_line.amount_currency == -30.00:
318 assert move_line.credit == 28.50, "Debtor account has wrong entry."318 assert move_line.credit == 60.0, "Debtor account has wrong entry."
319 elif move_line.amount_currency == 5.00:319 elif move_line.amount_currency == 5.00:
320 assert move_line.debit == 4.75, "Writeoff amount is wrong."320 assert move_line.debit == 10.0, "Writeoff amount is wrong."
321 elif move_line.debit == 11.5 and move_line.account_id.reconcile:321 elif move_line.debit == 33.81 and move_line.account_id.reconcile:
322 assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_a, "Exchange difference entry for the invoice of 100$ is wrong"322 assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_a, "Exchange difference entry for the invoice of 100$ is wrong"
323 elif move_line.credit == 11.5:323 elif move_line.credit == 33.81:
324 assert move_line.amount_currency == 0.0324 assert move_line.amount_currency == 0.0
325 elif move_line.debit == 31.0 and move_line.account_id.reconcile:325 elif move_line.debit == 90.0 and move_line.account_id.reconcile:
326 assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_b, "Exchange difference entry for the invoice of 200$ is wrong"326 assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_b, "Exchange difference entry for the invoice of 200$ is wrong"
327 elif move_line.credit == 31.0:327 elif move_line.credit == 90.0:
328 assert move_line.amount_currency == 0.0328 assert move_line.amount_currency == 0.0
329 elif move_line.amount_currency == 45.00:329 elif move_line.amount_currency == 45.00:
330 assert move_line.debit == 42.75, "Bank entry is wrong."330 assert move_line.debit == 90.0, "Bank entry is wrong."
331 else:331 else:
332 assert False, "Unrecognized journal entry"332 assert False, "Unrecognized journal entry"
333-333-
334334
=== renamed file 'account_voucher/test/case1_usd_usd_payment_rate.yml' => 'account_voucher/test/case1_eur_eur_payment_rate.yml'
--- account_voucher/test/case1_usd_usd_payment_rate.yml 2013-05-14 12:03:41 +0000
+++ account_voucher/test/case1_eur_eur_payment_rate.yml 2014-05-14 12:25:54 +0000
@@ -1,6 +1,6 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create 2 Invoices in USD and make 1 Payment in USD based on the currency rating given by the bank which is slightly different that the one encoded in OpenERP3 I create 2 Invoices in EUR and make 1 Payment in EUR based on the currency rating given by the bank which is slightly different that the one encoded in OpenERP
4-4-
5 I set the income and expense currency accounts on the main company5 I set the income and expense currency accounts on the main company
6-6-
@@ -11,60 +11,60 @@
11 'expense_currency_exchange_account_id': ref('account.o_expense')}11 'expense_currency_exchange_account_id': ref('account.o_expense')}
12 self.write(cr, uid, ref('base.main_company'), vals)12 self.write(cr, uid, ref('base.main_company'), vals)
13-13-
14 I create currency USD in OpenERP for January of 1.333333 Rate14 I create currency EUR in OpenERP for January of 0.888888 Rate
15-15-
16 !python {model: res.currency.rate}: |16 !python {model: res.currency.rate}: |
17 from datetime import datetime17 from datetime import datetime
18 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])[0]18 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'EUR')])[0]
19 date = '%s-01-01' %(datetime.now().year)19 date = '%s-01-01' %(datetime.now().year)
20 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])20 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])
21 self.write(cr, uid, ids, {'rate': 1.333333})21 self.write(cr, uid, ids, {'rate': 0.888888})
22-22-
23 I create currency USD in OpenERP for February of 1.250000 Rate23 I create currency EUR in OpenERP for February of 0.999999 Rate
24-24-
25 !record {model: res.currency.rate, id: feb_usd}:25 !record {model: res.currency.rate, id: feb_eur}:
26 currency_id: base.USD26 currency_id: base.EUR
27 name: !eval "'%s-02-01' %(datetime.now().year)"27 name: !eval "'%s-02-01' %(datetime.now().year)"
28 rate: 1.25000028 rate: 0.999999
2929
30-30-
31 I create currency USD in OpenERP for March of 1.111111 Rate31 I create currency EUR in OpenERP for March of 0.777777 Rate
32-32-
33 !record {model: res.currency.rate, id: mar_usd}:33 !record {model: res.currency.rate, id: mar_eur}:
34 currency_id: base.USD34 currency_id: base.EUR
35 name: !eval "'%s-03-01' %(datetime.now().year)"35 name: !eval "'%s-03-01' %(datetime.now().year)"
36 rate: 1.11111136 rate: 0.777777
3737
38-38-
39 I create currency USD in OpenERP for April of 1.052632 Rate39 I create currency EUR in OpenERP for April of 0.666666 Rate
40-40-
41 !record {model: res.currency.rate, id: apr_usd}:41 !record {model: res.currency.rate, id: apr_eur}:
42 currency_id: base.USD42 currency_id: base.EUR
43 name: !eval "'%s-04-01' %(datetime.now().year)"43 name: !eval "'%s-04-01' %(datetime.now().year)"
44 rate: 1.05263244 rate: 0.666666
4545
46-46-
47 I create a cash account with currency USD47 I create a cash account with currency EUR
48-48-
49 !record {model: account.account, id: account_cash_usd_id}:49 !record {model: account.account, id: account_cash_eur_id}:
50 currency_id: base.USD50 currency_id: base.EUR
51 name: "cash account in usd"51 name: "cash account in EUR"
52 code: "Xcash usd"52 code: "Xcash eur"
53 type: 'liquidity'53 type: 'liquidity'
54 user_type: "account.data_account_type_cash"54 user_type: "account.data_account_type_cash"
5555
56-56-
57 I create a bank journal with USD as currency57 I create a bank journal with EUR as currency
58-58-
59 !record {model: account.journal, id: bank_journal_USD}:59 !record {model: account.journal, id: bank_journal_EUR}:
60 name: Bank Journal(USD)60 name: Bank Journal(EUR)
61 code: BUSD61 code: BEUR
62 type: bank62 type: bank
63 analytic_journal_id: account.sit63 analytic_journal_id: account.sit
64 sequence_id: account.sequence_bank_journal64 sequence_id: account.sequence_bank_journal
65 default_debit_account_id: account_cash_usd_id65 default_debit_account_id: account_cash_eur_id
66 default_credit_account_id: account_cash_usd_id66 default_credit_account_id: account_cash_eur_id
67 currency: base.USD67 currency: base.EUR
68 company_id: base.main_company68 company_id: base.main_company
6969
70-70-
@@ -75,12 +75,12 @@
75 property_account_receivable: account.a_recv75 property_account_receivable: account.a_recv
76 property_account_payable: account.a_pay76 property_account_payable: account.a_pay
77-77-
78 I create the first invoice on 1st January for 200 USD78 I create the first invoice on 1st January for 200 EUR
79-79-
80 !record {model: account.invoice, id: account_invoice_jan_payment_rate}:80 !record {model: account.invoice, id: account_invoice_jan_payment_rate}:
81 account_id: account.a_recv81 account_id: account.a_recv
82 company_id: base.main_company82 company_id: base.main_company
83 currency_id: base.USD83 currency_id: base.EUR
84 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"84 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
85 period_id: account.period_185 period_id: account.period_1
86 invoice_line:86 invoice_line:
@@ -98,7 +98,7 @@
98-98-
99 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan_payment_rate}99 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan_payment_rate}
100-100-
101 I check that first invoice move is correct for debtor account (debit - credit == 150.0)101 I check that first invoice move is correct for debtor account (debit - credit == 225.0)
102-102-
103 !python {model: account.invoice}: |103 !python {model: account.invoice}: |
104 invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate"))104 invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate"))
@@ -106,14 +106,14 @@
106 move_line_obj = self.pool.get('account.move.line')106 move_line_obj = self.pool.get('account.move.line')
107 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])107 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
108 move_line = move_line_obj.browse(cr, uid, move_lines[0])108 move_line = move_line_obj.browse(cr, uid, move_lines[0])
109 assert (move_line.debit - move_line.credit == 150.0), "Invoice move is not correct for debtors account"109 assert (move_line.debit - move_line.credit == 225.0), "Invoice move is not correct for debtors account"
110-110-
111 I create the second invoice on 1st February for 100 USD111 I create the second invoice on 1st February for 100 EUR
112-112-
113 !record {model: account.invoice, id: account_invoice_feb_payment_rate}:113 !record {model: account.invoice, id: account_invoice_feb_payment_rate}:
114 account_id: account.a_recv114 account_id: account.a_recv
115 company_id: base.main_company115 company_id: base.main_company
116 currency_id: base.USD116 currency_id: base.EUR
117 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"117 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
118 period_id: account.period_2118 period_id: account.period_2
119 invoice_line:119 invoice_line:
@@ -131,7 +131,7 @@
131-131-
132 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb_payment_rate}132 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb_payment_rate}
133-133-
134 I check that second invoice move is correct for debtor account (debit - credit == 80)134 I check that second invoice move is correct for debtor account (debit - credit == 100.0)
135-135-
136 !python {model: account.invoice}: |136 !python {model: account.invoice}: |
137 invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate"))137 invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate"))
@@ -139,7 +139,7 @@
139 move_line_obj = self.pool.get('account.move.line')139 move_line_obj = self.pool.get('account.move.line')
140 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])140 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
141 move_line = move_line_obj.browse(cr, uid, move_lines[0])141 move_line = move_line_obj.browse(cr, uid, move_lines[0])
142 assert (move_line.debit - move_line.credit == 80), "Invoice move is not correct for debtors account"142 assert (move_line.debit - move_line.credit == 100.0), "Invoice move is not correct for debtors account"
143143
144-144-
145 I set the context that will be used for the encoding of all the vouchers of this file145 I set the context that will be used for the encoding of all the vouchers of this file
@@ -147,14 +147,14 @@
147 !context147 !context
148 'type': 'receipt'148 'type': 'receipt'
149-149-
150 On the first March, I create the first voucher of payment with values 240 USD, journal USD, and specifying that $1 = 0.8€150 On the first March, I create the first voucher of payment with values 240 EUR, journal EUR, and specifying that $1 = 0.8€
151-151-
152 !record {model: account.voucher, id: account_voucher_1_case1_payment_rate, view: view_vendor_receipt_form}:152 !record {model: account.voucher, id: account_voucher_1_case1_payment_rate, view: view_vendor_receipt_form}:
153 account_id: account.cash153 account_id: account.cash
154 amount: 240.0154 amount: 240.0
155 company_id: base.main_company155 company_id: base.main_company
156 journal_id: bank_journal_USD156 journal_id: bank_journal_EUR
157 name: 'Payment: Case 1 USD/USD payment rate'157 name: 'Payment: Case 1 EUR/EUR payment rate'
158 partner_id: res_partner_mc_kay158 partner_id: res_partner_mc_kay
159 period_id: account.period_3159 period_id: account.period_3
160 date: !eval time.strftime("%Y-03-01")160 date: !eval time.strftime("%Y-03-01")
@@ -162,7 +162,7 @@
162 writeoff_acc_id: account.a_expense162 writeoff_acc_id: account.a_expense
163 comment: 'Write Off'163 comment: 'Write Off'
164 payment_rate: 0.8164 payment_rate: 0.8
165 payment_rate_currency_id: base.EUR165 payment_rate_currency_id: base.USD
166166
167-167-
168 I fill amounts 180 for the invoice of 200$ and 70 for the invoice of 100$>168 I fill amounts 180 for the invoice of 200$ and 70 for the invoice of 100$>
@@ -226,22 +226,22 @@
226 else:226 else:
227 assert False, "Unrecognized journal entry"227 assert False, "Unrecognized journal entry"
228-228-
229 I check the residual amount of Invoice1, should be 20 in amount_currency and 6 in amount_residual229 I check the residual amount of Invoice1, should be 20 in amount_currency and 81 in amount_residual
230-230-
231 !python {model: account.invoice}: |231 !python {model: account.invoice}: |
232 invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate"))232 invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate"))
233 move_line_obj = self.pool.get('account.move.line')233 move_line_obj = self.pool.get('account.move.line')
234 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])234 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
235 move_line = move_line_obj.browse(cr, uid, move_lines[0])235 move_line = move_line_obj.browse(cr, uid, move_lines[0])
236 assert (move_line.amount_residual == 6.0) , "Residual amount is not correct for first Invoice"236 assert (move_line.amount_residual == 81.0) , "Residual amount is not correct for first Invoice"
237 assert (move_line.amount_residual_currency == 20.0) , "Residual amount in currency is not correct for first Invoice"237 assert (move_line.amount_residual_currency == 20.0) , "Residual amount in currency is not correct for first Invoice"
238-238-
239 I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual239 I check the residual amuont of Invoice2, should be 30 in residual currency and 44 in amount_residual
240-240-
241 !python {model: account.invoice}: |241 !python {model: account.invoice}: |
242 invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate"))242 invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate"))
243 move_line_obj = self.pool.get('account.move.line')243 move_line_obj = self.pool.get('account.move.line')
244 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])244 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
245 move_line = move_line_obj.browse(cr, uid, move_lines[0])245 move_line = move_line_obj.browse(cr, uid, move_lines[0])
246 assert (move_line.amount_residual == 24.0) , "Residual amount is not correct for second Invoice"246 assert (move_line.amount_residual == 44.0) , "Residual amount is not correct for second Invoice"
247 assert (move_line.amount_residual_currency == 30.0) , "Residual amount in currency is not correct for second Invoice"247 assert (move_line.amount_residual_currency == 30.0) , "Residual amount in currency is not correct for second Invoice"
248248
=== renamed file 'account_voucher/test/case2_usd_eur_debtor_in_usd.yml' => 'account_voucher/test/case2_eur_usd_debtor_in_eur.yml'
--- account_voucher/test/case2_usd_eur_debtor_in_usd.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case2_eur_usd_debtor_in_eur.yml 2014-05-14 12:25:54 +0000
@@ -1,6 +1,6 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create 2 Invoices in USD and make 2 Payments one in USD and another in EUR, based on the currency rating on that particular date3 I create 2 Invoices in EUR and make 2 Payments one in EUR and another in USD, based on the currency rating on that particular date
4-4-
5 I set the income and expense currency accounts on the main company5 I set the income and expense currency accounts on the main company
6-6-
@@ -11,42 +11,54 @@
11 'expense_currency_exchange_account_id': ref('account.o_expense')}11 'expense_currency_exchange_account_id': ref('account.o_expense')}
12 self.write(cr, uid, ref('base.main_company'), vals)12 self.write(cr, uid, ref('base.main_company'), vals)
13-13-
14 I modify the debtor account in order to set the currency_id = USD14 I modify the debtor account in order to set the currency_id = EUR
15-15-
16 !python {model: account.account}: |16 !python {model: account.account}: |
17 from datetime import datetime17 from datetime import datetime
18 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])18 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])
19 self.write(cr, uid, ids, {'currency_id': ref('base.USD')})19 self.write(cr, uid, ids, {'currency_id': ref('base.EUR')})
20-20-
21 I create currency USD in OpenERP for January of 1.333333 Rate21 I create currency EUR in OpenERP for January of 0.800000 Rate
22-22-
23 !python {model: res.currency.rate}: |23 !python {model: res.currency.rate}: |
24 from datetime import datetime24 from datetime import datetime
25 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])[0]25 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'EUR')])[0]
26 date = '%s-01-01' %(datetime.now().year)26 date = '%s-01-01' %(datetime.now().year)
27 ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)])27 ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)])
28 self.write(cr, uid, ids, {'rate': 1.333333})28 self.write(cr, uid, ids, {'rate': 0.800000})
29-29-
30 I create currency USD in OpenERP for February of 1.250000 Rate30 I create currency EUR in OpenERP for February of 0.900000 Rate
31-31-
32 !record {model: res.currency.rate, id: feb_usd}:32 !record {model: res.currency.rate, id: feb_eur}:
33 currency_id: base.USD33 currency_id: base.EUR
34 name: !eval "'%s-02-01' %(datetime.now().year)"34 name: !eval "'%s-02-01' %(datetime.now().year)"
35 rate: 1.25000035 rate: 0.900000
36-36-
37 I create currency USD in OpenERP for March of 1.111111 Rate37 I create currency EUR in OpenERP for March of 0.600000 Rate
38-38-
39 !record {model: res.currency.rate, id: mar_usd}:39 !record {model: res.currency.rate, id: mar_eur}:
40 currency_id: base.USD40 currency_id: base.EUR
41 name: !eval "'%s-03-01' %(datetime.now().year)"41 name: !eval "'%s-03-01' %(datetime.now().year)"
42 rate: 1.11111142 rate: 0.600000
43-43-
44 I create currency USD in OpenERP for April of 1.052632 Rate44 I create currency EUR in OpenERP for April of 0.500000 Rate
45-45-
46 !record {model: res.currency.rate, id: apr_usd}:46 !record {model: res.currency.rate, id: apr_eur}:
47 currency_id: base.USD47 currency_id: base.EUR
48 name: !eval "'%s-04-01' %(datetime.now().year)"48 name: !eval "'%s-04-01' %(datetime.now().year)"
49 rate: 1.05263249 rate: 0.500000
50-
51 I create a bank journal with USD as currency
52-
53 !record {model: account.journal, id: bank_journal_USD}:
54 name: Bank Journal(USD)
55 code: BUSD
56 type: bank
57 analytic_journal_id: account.sit
58 sequence_id: account.sequence_bank_journal
59 default_debit_account_id: account.cash
60 default_credit_account_id: account.cash
61 company_id: base.main_company
50-62-
51 I create a bank journal with EUR as currency63 I create a bank journal with EUR as currency
52-64-
@@ -56,29 +68,17 @@
56 type: bank68 type: bank
57 analytic_journal_id: account.sit69 analytic_journal_id: account.sit
58 sequence_id: account.sequence_bank_journal70 sequence_id: account.sequence_bank_journal
59 default_debit_account_id: account.cash71 default_debit_account_id: account_cash_eur_id
60 default_credit_account_id: account.cash72 default_credit_account_id: account_cash_eur_id
61 company_id: base.main_company73 currency: base.EUR
62-74 company_id: base.main_company
63 I create a bank journal with USD as currency75-
64-76 I create the first invoice on 1st January for 200 EUR
65 !record {model: account.journal, id: bank_journal_USD}:
66 name: Bank Journal(USD)
67 code: BUSD
68 type: bank
69 analytic_journal_id: account.sit
70 sequence_id: account.sequence_bank_journal
71 default_debit_account_id: account_cash_usd_id
72 default_credit_account_id: account_cash_usd_id
73 currency: base.USD
74 company_id: base.main_company
75-
76 I create the first invoice on 1st January for 200 USD
77-77-
78 !record {model: account.invoice, id: account_first_invoice_jan_michal}:78 !record {model: account.invoice, id: account_first_invoice_jan_michal}:
79 account_id: account.a_recv79 account_id: account.a_recv
80 company_id: base.main_company80 company_id: base.main_company
81 currency_id: base.USD81 currency_id: base.EUR
82 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"82 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
83 period_id: account.period_183 period_id: account.period_1
84 invoice_line:84 invoice_line:
@@ -96,7 +96,7 @@
96-96-
97 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_michal}97 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_michal}
98-98-
99 I check that first invoice move is correct for debtor account(debit - credit == 150)99 I check that first invoice move is correct for debtor account(debit - credit == 250)
100-100-
101 !python {model: account.invoice}: |101 !python {model: account.invoice}: |
102 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_michal"))102 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_michal"))
@@ -104,14 +104,14 @@
104 move_line_obj = self.pool.get('account.move.line')104 move_line_obj = self.pool.get('account.move.line')
105 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])105 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
106 move_line = move_line_obj.browse(cr, uid, move_lines[0])106 move_line = move_line_obj.browse(cr, uid, move_lines[0])
107 assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"107 assert (move_line.debit - move_line.credit == 250.00), "Invoice move is incorrect for debtors account"
108-108-
109 I create the second invoice on 1st February for 100 USD109 I create the second invoice on 1st February for 100 EUR
110-110-
111 !record {model: account.invoice, id: account_second_invoice_feb_michal}:111 !record {model: account.invoice, id: account_second_invoice_feb_michal}:
112 account_id: account.a_recv112 account_id: account.a_recv
113 company_id: base.main_company113 company_id: base.main_company
114 currency_id: base.USD114 currency_id: base.EUR
115 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"115 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
116 period_id: account.period_2116 period_id: account.period_2
117 invoice_line:117 invoice_line:
@@ -129,7 +129,7 @@
129-129-
130 !workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb_michal}130 !workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb_michal}
131-131-
132 I check that second invoice move is correct for debtor account (debit - credit == 80)132 I check that second invoice move is correct for debtor account (debit - credit == 111.11)
133-133-
134 !python {model: account.invoice}: |134 !python {model: account.invoice}: |
135 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_michal"))135 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_michal"))
@@ -137,20 +137,20 @@
137 move_line_obj = self.pool.get('account.move.line')137 move_line_obj = self.pool.get('account.move.line')
138 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])138 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
139 move_line = move_line_obj.browse(cr, uid, move_lines[0])139 move_line = move_line_obj.browse(cr, uid, move_lines[0])
140 assert (move_line.debit - move_line.credit == 80), "Invoice move is incorrect for debtors account"140 assert (move_line.debit - move_line.credit == 111.11), "Invoice move is incorrect for debtors account"
141-141-
142 I set the context that will be used for the encoding of all the vouchers of this file142 I set the context that will be used for the encoding of all the vouchers of this file
143-143-
144 !context144 !context
145 'type': 'receipt'145 'type': 'receipt'
146-146-
147 I create the first voucher of payment with values 200 EUR, journal EUR147 I create the first voucher of payment with values 200 USD, journal USD
148-148-
149 !record {model: account.voucher, id: account_voucher_1_case2b, view: view_vendor_receipt_form}:149 !record {model: account.voucher, id: account_voucher_1_case2b, view: view_vendor_receipt_form}:
150 account_id: account.cash150 account_id: account.cash
151 amount: 200.0151 amount: 200.0
152 company_id: base.main_company152 company_id: base.main_company
153 journal_id: bank_journal_EUR153 journal_id: bank_journal_USD
154 partner_id: base.res_partner_19154 partner_id: base.res_partner_19
155 period_id: account.period_3155 period_id: account.period_3
156 date: !eval time.strftime("%Y-03-01")156 date: !eval time.strftime("%Y-03-01")
@@ -193,7 +193,7 @@
193-193-
194 I check that my debtor account is correct194 I check that my debtor account is correct
195-195-
196 I check that the debtor account has 2 new lines with 144.44 and 77.78 in amount_currency columns and their credit columns are 130 and 70196 I check that the debtor account has 2 new lines with 144.44 and 42.0 in amount_currency columns and their credit columns are 130 and 70
197-197-
198 !python {model: account.voucher}: |198 !python {model: account.voucher}: |
199 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))])199 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))])
@@ -202,35 +202,35 @@
202 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])202 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
203 for move_line in move_line_obj.browse(cr, uid, move_lines):203 for move_line in move_line_obj.browse(cr, uid, move_lines):
204 if move_line.credit == 70.0:204 if move_line.credit == 70.0:
205 assert move_line.amount_currency == -77.78, "Wrong debtor entry"205 assert move_line.amount_currency == -42.0, "Wrong debtor entry"
206 if move_line.credit == 130.0:206 if move_line.credit == 130.0:
207 assert move_line.amount_currency == -144.44, "Wrong debtor entry"207 assert move_line.amount_currency == -144.44, "Wrong debtor entry"
208-208-
209 I check the residual amount of Invoice1, should be 55.56 in residual currency and 20 in amount_residual209 I check the residual amount of Invoice1, should be 158.0 in residual currency and 180.0 in amount_residual
210-210-
211 !python {model: account.invoice}: |211 !python {model: account.invoice}: |
212 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_michal"))212 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_michal"))
213 move_line_obj = self.pool.get('account.move.line')213 move_line_obj = self.pool.get('account.move.line')
214 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])214 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
215 move_line = move_line_obj.browse(cr, uid, move_lines[0])215 move_line = move_line_obj.browse(cr, uid, move_lines[0])
216 assert (move_line.amount_residual_currency == 55.56 and move_line.amount_residual == 20) , "Residual amount is not correct for first Invoice"216 assert (move_line.amount_residual_currency == 158.0 and move_line.amount_residual == 180.0) , "Residual amount is not correct for first Invoice"
217-217-
218 I check the residual amount of Invoice2, should be 22.22 in residual currency and 10 in amount_residual218 I check the residual amount of Invoice2, should be 58.0 in residual currency and 41.11 in amount_residual
219-219-
220 !python {model: account.invoice}: |220 !python {model: account.invoice}: |
221 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_michal"))221 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_michal"))
222 move_line_obj = self.pool.get('account.move.line')222 move_line_obj = self.pool.get('account.move.line')
223 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])223 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
224 move_line = move_line_obj.browse(cr, uid, move_lines[0])224 move_line = move_line_obj.browse(cr, uid, move_lines[0])
225 assert (move_line.amount_residual_currency == 22.22 and move_line.amount_residual == 10) , "Residual amount is not correct for second Invoice"225 assert (move_line.amount_residual_currency == 58.0 and move_line.amount_residual == 41.11) , "Residual amount is not correct for second Invoice"
226-226-
227 I create the second voucher of payment with values 80 USD, journal USD227 I create the second voucher of payment with values 80 EUR, journal EUR
228-228-
229 !record {model: account.voucher, id: account_voucher_2_case2b, view: view_vendor_receipt_form}:229 !record {model: account.voucher, id: account_voucher_2_case2b, view: view_vendor_receipt_form}:
230 account_id: account.cash230 account_id: account.cash
231 amount: 80.0231 amount: 80.0
232 company_id: base.main_company232 company_id: base.main_company
233 journal_id: bank_journal_USD233 journal_id: bank_journal_EUR
234 partner_id: base.res_partner_19234 partner_id: base.res_partner_19
235 period_id: account.period_3235 period_id: account.period_3
236 date: !eval time.strftime("%Y-04-01")236 date: !eval time.strftime("%Y-04-01")
@@ -247,20 +247,20 @@
247 voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2b'))247 voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2b'))
248 data = []248 data = []
249 for item in voucher_id.line_cr_ids:249 for item in voucher_id.line_cr_ids:
250 if item.amount_unreconciled == 55.56:250 if item.amount_unreconciled == 158.0:
251 data += [(item.id, 55.56)]251 data += [(item.id, 158.0)]
252 else:252 else:
253 data += [(item.id, 22.22)]253 data += [(item.id, 58.0)]
254 for line_id, amount in data:254 for line_id, amount in data:
255 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})255 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})
256 assert (voucher_id.state=='draft'), "Voucher is not in draft state"256 assert (voucher_id.state=='draft'), "Voucher is not in draft state"
257-257-
258 I check that writeoff amount computed is 2.22258 I check that writeoff amount computed is -136.0
259-259-
260 !python {model: account.voucher}: |260 !python {model: account.voucher}: |
261 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))])261 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))])
262 voucher_id = self.browse(cr, uid, voucher[0])262 voucher_id = self.browse(cr, uid, voucher[0])
263 assert (round(voucher_id.writeoff_amount, 2) == 2.22), "Writeoff amount is not 2.22$"263 assert (round(voucher_id.writeoff_amount, 2) == -136.0), "Writeoff amount is not -136.0$"
264-264-
265 I confirm the voucher265 I confirm the voucher
266-266-
267267
=== renamed file 'account_voucher/test/case2_usd_eur_debtor_in_eur.yml' => 'account_voucher/test/case2_eur_usd_debtor_in_usd.yml'
--- account_voucher/test/case2_usd_eur_debtor_in_eur.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case2_eur_usd_debtor_in_usd.yml 2014-05-14 12:25:54 +0000
@@ -1,6 +1,6 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create 2 Invoices in USD and make 2 Payments one in USD and another in EUR, based on the currency rating on that particular date3 I create 2 Invoices in EUR and make 2 Payments one in EUR and another in USD, based on the currency rating on that particular date
4-4-
5 I set the income and expense currency accounts on the main company5 I set the income and expense currency accounts on the main company
6-6-
@@ -18,35 +18,47 @@
18 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])18 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])
19 self.write(cr, uid, ids, {'currency_id': False})19 self.write(cr, uid, ids, {'currency_id': False})
20-20-
21 I create currency USD in OpenERP for January of 1.333333 Rate21 I create currency EUR in OpenERP for January of 0.800000 Rate
22-22-
23 !python {model: res.currency.rate}: |23 !python {model: res.currency.rate}: |
24 from datetime import datetime24 from datetime import datetime
25 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])[0]25 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'EUR')])[0]
26 date = '%s-01-01' %(datetime.now().year)26 date = '%s-01-01' %(datetime.now().year)
27 ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)])27 ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)])
28 self.write(cr, uid, ids, {'rate': 1.333333})28 self.write(cr, uid, ids, {'rate': 0.800000})
29-29-
30 I create currency USD in OpenERP for February of 1.250000 Rate30 I create currency EUR in OpenERP for February of 0.900000 Rate
31-31-
32 !record {model: res.currency.rate, id: feb_usd}:32 !record {model: res.currency.rate, id: feb_eur}:
33 currency_id: base.USD33 currency_id: base.EUR
34 name: !eval "'%s-02-01' %(datetime.now().year)"34 name: !eval "'%s-02-01' %(datetime.now().year)"
35 rate: 1.25000035 rate: 0.900000
36-36-
37 I create currency USD in OpenERP for March of 1.111111 Rate37 I create currency EUR in OpenERP for March of 0.600000 Rate
38-38-
39 !record {model: res.currency.rate, id: mar_usd}:39 !record {model: res.currency.rate, id: mar_eur}:
40 currency_id: base.USD40 currency_id: base.EUR
41 name: !eval "'%s-03-01' %(datetime.now().year)"41 name: !eval "'%s-03-01' %(datetime.now().year)"
42 rate: 1.11111142 rate: 0.600000
43-43-
44 I create currency USD in OpenERP for April of 1.052632 Rate44 I create currency EUR in OpenERP for April of 0.500000 Rate
45-45-
46 !record {model: res.currency.rate, id: apr_usd}:46 !record {model: res.currency.rate, id: apr_eur}:
47 currency_id: base.USD47 currency_id: base.EUR
48 name: !eval "'%s-04-01' %(datetime.now().year)"48 name: !eval "'%s-04-01' %(datetime.now().year)"
49 rate: 1.05263249 rate: 0.500000
50-
51 I create a bank journal with USD as currency
52-
53 !record {model: account.journal, id: bank_journal_USD}:
54 name: Bank Journal(USD)
55 code: BUSD
56 type: bank
57 analytic_journal_id: account.sit
58 sequence_id: account.sequence_bank_journal
59 default_debit_account_id: account.cash
60 default_credit_account_id: account.cash
61 company_id: base.main_company
50-62-
51 I create a bank journal with EUR as currency63 I create a bank journal with EUR as currency
52-64-
@@ -56,29 +68,17 @@
56 type: bank68 type: bank
57 analytic_journal_id: account.sit69 analytic_journal_id: account.sit
58 sequence_id: account.sequence_bank_journal70 sequence_id: account.sequence_bank_journal
59 default_debit_account_id: account.cash71 default_debit_account_id: account_cash_eur_id
60 default_credit_account_id: account.cash72 default_credit_account_id: account_cash_eur_id
61 company_id: base.main_company73 currency: base.EUR
62-74 company_id: base.main_company
63 I create a bank journal with USD as currency75-
64-76 I create the first invoice on 1st January for 200 EUR
65 !record {model: account.journal, id: bank_journal_USD}:
66 name: Bank Journal(USD)
67 code: BUSD
68 type: bank
69 analytic_journal_id: account.sit
70 sequence_id: account.sequence_bank_journal
71 default_debit_account_id: account_cash_usd_id
72 default_credit_account_id: account_cash_usd_id
73 currency: base.USD
74 company_id: base.main_company
75-
76 I create the first invoice on 1st January for 200 USD
77-77-
78 !record {model: account.invoice, id: account_first_invoice_jan}:78 !record {model: account.invoice, id: account_first_invoice_jan}:
79 account_id: account.a_recv79 account_id: account.a_recv
80 company_id: base.main_company80 company_id: base.main_company
81 currency_id: base.USD81 currency_id: base.EUR
82 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"82 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
83 period_id: account.period_183 period_id: account.period_1
84 invoice_line:84 invoice_line:
@@ -96,7 +96,7 @@
96-96-
97 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan}97 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan}
98-98-
99 I check that first invoice move is correct for debtor account(debit - credit == 150)99 I check that first invoice move is correct for debtor account(debit - credit == 250)
100-100-
101 !python {model: account.invoice}: |101 !python {model: account.invoice}: |
102 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))102 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))
@@ -104,14 +104,14 @@
104 move_line_obj = self.pool.get('account.move.line')104 move_line_obj = self.pool.get('account.move.line')
105 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])105 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
106 move_line = move_line_obj.browse(cr, uid, move_lines[0])106 move_line = move_line_obj.browse(cr, uid, move_lines[0])
107 assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"107 assert (move_line.debit - move_line.credit == 250.00), "Invoice move is incorrect for debtors account"
108-108-
109 I create the second invoice on 1st February for 100 USD109 I create the second invoice on 1st February for 100 EUR
110-110-
111 !record {model: account.invoice, id: account_second_invoice_feb}:111 !record {model: account.invoice, id: account_second_invoice_feb}:
112 account_id: account.a_recv112 account_id: account.a_recv
113 company_id: base.main_company113 company_id: base.main_company
114 currency_id: base.USD114 currency_id: base.EUR
115 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"115 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
116 period_id: account.period_2116 period_id: account.period_2
117 invoice_line:117 invoice_line:
@@ -129,7 +129,7 @@
129-129-
130 !workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb}130 !workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb}
131-131-
132 I check that second invoice move is correct for debtor account (debit - credit == 80)132 I check that second invoice move is correct for debtor account (debit - credit == 111.11)
133-133-
134 !python {model: account.invoice}: |134 !python {model: account.invoice}: |
135 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))135 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))
@@ -137,7 +137,7 @@
137 move_line_obj = self.pool.get('account.move.line')137 move_line_obj = self.pool.get('account.move.line')
138 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])138 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
139 move_line = move_line_obj.browse(cr, uid, move_lines[0])139 move_line = move_line_obj.browse(cr, uid, move_lines[0])
140 assert (move_line.debit - move_line.credit == 80), "Invoice move is incorrect for debtors account"140 assert (move_line.debit - move_line.credit == 111.11), "Invoice move is incorrect for debtors account"
141-141-
142 I set the context that will be used for the encoding of all the vouchers of this file142 I set the context that will be used for the encoding of all the vouchers of this file
143-143-
@@ -150,7 +150,7 @@
150 account_id: account.cash150 account_id: account.cash
151 amount: 200.0151 amount: 200.0
152 company_id: base.main_company152 company_id: base.main_company
153 journal_id: bank_journal_EUR153 journal_id: bank_journal_USD
154 partner_id: base.res_partner_19154 partner_id: base.res_partner_19
155 period_id: account.period_3155 period_id: account.period_3
156 date: !eval time.strftime("%Y-03-01")156 date: !eval time.strftime("%Y-03-01")
@@ -194,31 +194,31 @@
194 for move_line in move_line_obj.browse(cr, uid, move_lines):194 for move_line in move_line_obj.browse(cr, uid, move_lines):
195 assert move_line.state == 'valid', "Voucher move is not valid"195 assert move_line.state == 'valid', "Voucher move is not valid"
196-196-
197 I check the residual amount of Invoice1, should be 55.56 in residual currency and 20 in amount_residual197 I check the residual amount of Invoice1, should be 158.0 in residual currency and 180 in amount_residual
198-198-
199 !python {model: account.invoice}: |199 !python {model: account.invoice}: |
200 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))200 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))
201 move_line_obj = self.pool.get('account.move.line')201 move_line_obj = self.pool.get('account.move.line')
202 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])202 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
203 move_line = move_line_obj.browse(cr, uid, move_lines[0])203 move_line = move_line_obj.browse(cr, uid, move_lines[0])
204 assert (move_line.amount_residual_currency == 55.56 and move_line.amount_residual == 20) , "Residual amount is not correct for first Invoice. Got %s USD (%s EUR)" %(move_line.amount_residual_currency, move_line.amount_residual)204 assert (move_line.amount_residual_currency == 158.0 and move_line.amount_residual == 180.0) , "Residual amount is not correct for first Invoice. Got %s USD (%s EUR)" %(move_line.amount_residual_currency, move_line.amount_residual)
205-205-
206 I check the residual amuont of Invoice2, should be 22.22 in residual currency and 10 in amount_residual206 I check the residual amuont of Invoice2, should be 58.0 in residual currency and 41.11 in amount_residual
207-207-
208 !python {model: account.invoice}: |208 !python {model: account.invoice}: |
209 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))209 invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))
210 move_line_obj = self.pool.get('account.move.line')210 move_line_obj = self.pool.get('account.move.line')
211 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])211 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
212 move_line = move_line_obj.browse(cr, uid, move_lines[0])212 move_line = move_line_obj.browse(cr, uid, move_lines[0])
213 assert (move_line.amount_residual_currency == 22.22 and move_line.amount_residual == 10) , "Residual amount is not correct for second Invoice"213 assert (move_line.amount_residual_currency == 58.0 and move_line.amount_residual == 41.11) , "Residual amount is not correct for second Invoice"
214-214-
215 I create the second voucher of payment with values 80 USD, journal USD215 I create the second voucher of payment with values 80 EUR, journal EUR
216-216-
217 !record {model: account.voucher, id: account_voucher_2_case2a, view: view_vendor_receipt_form}:217 !record {model: account.voucher, id: account_voucher_2_case2a, view: view_vendor_receipt_form}:
218 account_id: account.cash218 account_id: account.cash
219 amount: 80219 amount: 80
220 company_id: base.main_company220 company_id: base.main_company
221 journal_id: bank_journal_USD221 journal_id: bank_journal_EUR
222 partner_id: base.res_partner_19222 partner_id: base.res_partner_19
223 period_id: account.period_3223 period_id: account.period_3
224 date: !eval time.strftime("%Y-04-01")224 date: !eval time.strftime("%Y-04-01")
@@ -237,20 +237,20 @@
237 voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2a'))237 voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2a'))
238 data = []238 data = []
239 for item in voucher_id.line_cr_ids:239 for item in voucher_id.line_cr_ids:
240 if item.amount_unreconciled == 55.56:240 if item.amount_unreconciled == 158.0:
241 data += [(item.id, 55.56)]241 data += [(item.id, 158.0)]
242 else:242 else:
243 data += [(item.id, 22.22)]243 data += [(item.id, 58.0)]
244 for line_id, amount in data:244 for line_id, amount in data:
245 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})245 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})
246 assert (voucher_id.state=='draft'), "Voucher is not in draft state"246 assert (voucher_id.state=='draft'), "Voucher is not in draft state"
247-247-
248 I check that writeoff amount computed is 2.22248 I check that writeoff amount computed is -136.0
249-249-
250 !python {model: account.voucher}: |250 !python {model: account.voucher}: |
251 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))])251 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
252 voucher_id = self.browse(cr, uid, voucher[0])252 voucher_id = self.browse(cr, uid, voucher[0])
253 assert (round(voucher_id.writeoff_amount, 2) == 2.22), "Writeoff amount is not 2.22$"253 assert (round(voucher_id.writeoff_amount, 2) == -136.0), "Writeoff amount is not -136.0$"
254-254-
255 I confirm the voucher255 I confirm the voucher
256-256-
@@ -268,11 +268,11 @@
268-268-
269 I check that my debtor account is correct269 I check that my debtor account is correct
270-270-
271 I check that the debtor account has 2 new lines with -55.56 and -22.22 in amount_currency columns and their credit columns are respectively 52.78 and 21.11 and currency is USD($).271 I check that the debtor account has 2 new lines with -158.0 and -58.0 in amount_currency columns and their credit columns are respectively 52.78 and 21.11 and currency is USD($).
272-272-
273 I check that my currency rate difference is correct.273 I check that my currency rate difference is correct.
274-274-
275 I check that my writeoff is correct. 2.11 in credit and 2.22 in amount_currency275 I check that my writeoff is correct. 2.11 in credit and -136.0 in amount_currency
276-276-
277 !python {model: account.voucher}: |277 !python {model: account.voucher}: |
278 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))])278 voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))])
@@ -307,7 +307,7 @@
307 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])307 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
308 move_line = move_line_obj.browse(cr, uid, move_lines[0])308 move_line = move_line_obj.browse(cr, uid, move_lines[0])
309 assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"309 assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"
310- 310-
311 I check the residual amuont of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid311 I check the residual amuont of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid
312-312-
313 !python {model: account.invoice}: |313 !python {model: account.invoice}: |
314314
=== renamed file 'account_voucher/test/case2_suppl_usd_eur.yml' => 'account_voucher/test/case2_suppl_eur_usd.yml'
--- account_voucher/test/case2_suppl_usd_eur.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case2_suppl_eur_usd.yml 2014-05-14 12:25:54 +0000
@@ -21,7 +21,7 @@
21 sequence_id: account.sequence_bank_journal21 sequence_id: account.sequence_bank_journal
22 default_debit_account_id: account.cash22 default_debit_account_id: account.cash
23 default_credit_account_id: account.cash23 default_credit_account_id: account.cash
24 currency: base.EUR24 currency: base.USD
25 company_id: base.main_company25 company_id: base.main_company
26-26-
27 I create a bank journal with USD as currency27 I create a bank journal with USD as currency
2828
=== renamed file 'account_voucher/test/case3_eur_eur.yml' => 'account_voucher/test/case3_usd_usd.yml'
--- account_voucher/test/case3_eur_eur.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case3_usd_usd.yml 2014-05-14 12:25:54 +0000
@@ -1,11 +1,11 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create 2 Invoices in EUR and make 2 Payments in EUR based on the currency rating on that particular date.3 I create 2 Invoices in USD and make 2 Payments in USD based on the currency rating on that particular date.
4-4-
5 I create currency EUR in OpenERP for January of 1.000000 Rate5 I create currency USD in OpenERP for January of 1.000000 Rate
6-6-
7 !record {model: res.currency.rate, id: jan_eur}:7 !record {model: res.currency.rate, id: jan_USD}:
8 currency_id: base.EUR8 currency_id: base.USD
9 name: !eval "'%s-01-01' %(datetime.now().year)"9 name: !eval "'%s-01-01' %(datetime.now().year)"
10 rate: 1.00000010 rate: 1.000000
11-11-
@@ -16,11 +16,11 @@
16 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])16 ids = self.search(cr, uid, [('name', 'ilike', 'debtor')])
17 self.write(cr, uid, ids, {'currency_id': False})17 self.write(cr, uid, ids, {'currency_id': False})
18-18-
19 I create a bank journal with EUR as currency19 I create a bank journal with USD as currency
20-20-
21 !record {model: account.journal, id: bank_journal_EUR}:21 !record {model: account.journal, id: bank_journal_USD}:
22 name: Bank Journal(EUR)22 name: Bank Journal(USD)
23 code: BEUR23 code: BUSD
24 type: bank24 type: bank
25 analytic_journal_id: account.sit25 analytic_journal_id: account.sit
26 sequence_id: account.sequence_bank_journal26 sequence_id: account.sequence_bank_journal
@@ -28,12 +28,12 @@
28 default_credit_account_id: account.cash28 default_credit_account_id: account.cash
29 company_id: base.main_company29 company_id: base.main_company
30-30-
31 I create the first invoice on 1st January for 150 EUR31 I create the first invoice on 1st January for 150 USD
32-32-
33 !record {model: account.invoice, id: account_first_invoice_jan_eur}:33 !record {model: account.invoice, id: account_first_invoice_jan_eur}:
34 account_id: account.a_recv34 account_id: account.a_recv
35 company_id: base.main_company35 company_id: base.main_company
36 currency_id: base.EUR36 currency_id: base.USD
37 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"37 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
38 period_id: account.period_138 period_id: account.period_1
39 invoice_line:39 invoice_line:
@@ -61,12 +61,12 @@
61 move_line = move_line_obj.browse(cr, uid, move_lines[0])61 move_line = move_line_obj.browse(cr, uid, move_lines[0])
62 assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"62 assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"
63-63-
64 I create the second invoice on 1st February for 80 EUR64 I create the second invoice on 1st February for 80 USD
65-65-
66 !record {model: account.invoice, id: account_second_invoice_feb_eur}:66 !record {model: account.invoice, id: account_second_invoice_feb_eur}:
67 account_id: account.a_recv67 account_id: account.a_recv
68 company_id: base.main_company68 company_id: base.main_company
69 currency_id: base.EUR69 currency_id: base.USD
70 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"70 date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
71 period_id: account.period_171 period_id: account.period_1
72 invoice_line:72 invoice_line:
@@ -105,7 +105,7 @@
105 account_id: account.cash105 account_id: account.cash
106 amount: 120.0106 amount: 120.0
107 company_id: base.main_company107 company_id: base.main_company
108 journal_id: bank_journal_EUR108 journal_id: bank_journal_USD
109 partner_id: base.res_partner_19109 partner_id: base.res_partner_19
110 period_id: account.period_3110 period_id: account.period_3
111 date: !eval time.strftime("%Y-03-01")111 date: !eval time.strftime("%Y-03-01")
@@ -192,7 +192,7 @@
192 account_id: account.cash192 account_id: account.cash
193 amount: 120.0193 amount: 120.0
194 company_id: base.main_company194 company_id: base.main_company
195 journal_id: bank_journal_EUR195 journal_id: bank_journal_USD
196 partner_id: base.res_partner_19196 partner_id: base.res_partner_19
197 period_id: account.period_3197 period_id: account.period_3
198 date: !eval time.strftime("%Y-04-01")198 date: !eval time.strftime("%Y-04-01")
@@ -263,7 +263,7 @@
263 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])263 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
264 move_line = move_line_obj.browse(cr, uid, move_lines[0])264 move_line = move_line_obj.browse(cr, uid, move_lines[0])
265 assert (move_line.amount_residual_currency == 0 and move_line.amount_residual == 0) , "Residual amount is not correct for first Invoice"265 assert (move_line.amount_residual_currency == 0 and move_line.amount_residual == 0) , "Residual amount is not correct for first Invoice"
266- 266-
267 I check the residual amuont of Invoice2 is -10267 I check the residual amuont of Invoice2 is -10
268-268-
269 !python {model: account.invoice}: |269 !python {model: account.invoice}: |
270270
=== modified file 'account_voucher/test/case4_cad_chf.yml'
--- account_voucher/test/case4_cad_chf.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case4_cad_chf.yml 2014-05-14 12:25:54 +0000
@@ -11,33 +11,33 @@
11 'expense_currency_exchange_account_id': ref('account.o_expense')}11 'expense_currency_exchange_account_id': ref('account.o_expense')}
12 self.write(cr, uid, ref('base.main_company'), vals)12 self.write(cr, uid, ref('base.main_company'), vals)
13-13-
14 I create currency CAD in OpenERP for January of 1.338800 Rate14 I create currency CAD in OpenERP for January of 1.0431 Rate
15-15-
16 !record {model: res.currency.rate, id: jan_cad}:16 !record {model: res.currency.rate, id: jan_cad}:
17 currency_id: base.CAD17 currency_id: base.CAD
18 name: !eval "'%s-01-01' %(datetime.now().year)"18 name: !eval "'%s-01-01' %(datetime.now().year)"
19 rate: 1.33880019 rate: 1.0431
20-20-
21 I create currency CAD in OpenERP for March of 2.000000 Rate21 I create currency CAD in OpenERP for March of 1.7043 Rate
22-22-
23 !record {model: res.currency.rate, id: mar_cad}:23 !record {model: res.currency.rate, id: mar_cad}:
24 currency_id: base.CAD24 currency_id: base.CAD
25 name: !eval "'%s-03-01' %(datetime.now().year)"25 name: !eval "'%s-03-01' %(datetime.now().year)"
26 rate: 2.00000026 rate: 1.7043
27-27-
28 I create currency CHF in OpenERP for January of 1.308600 Rate28 I create currency CHF in OpenERP for January of 1.0196 Rate
29-29-
30 !record {model: res.currency.rate, id: jan_chf}:30 !record {model: res.currency.rate, id: jan_chf}:
31 currency_id: base.CHF31 currency_id: base.CHF
32 name: !eval "'%s-01-01' %(datetime.now().year)"32 name: !eval "'%s-01-01' %(datetime.now().year)"
33 rate: 1.30860033 rate: 1.0196
34-34-
35 I create currency CHF in OpenERP for March of 1.250000 Rate35 I create currency CHF in OpenERP for March of 0.961 Rate
36-36-
37 !record {model: res.currency.rate, id: mar_chf}:37 !record {model: res.currency.rate, id: mar_chf}:
38 currency_id: base.CHF38 currency_id: base.CHF
39 name: !eval "'%s-03-01' %(datetime.now().year)"39 name: !eval "'%s-03-01' %(datetime.now().year)"
40 rate: 1.2500040 rate: 0.961
41-41-
42 I create a cash account with currency CHF42 I create a cash account with currency CHF
43-43-
@@ -85,7 +85,7 @@
85-85-
86 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_cad}86 !workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_cad}
87-87-
88 I check that first invoice move is correct for debtor account (debit - credit == 149.39)88 I check that first invoice move is correct for debtor account (debit - credit == 191.74)
89-89-
90 !python {model: account.invoice}: |90 !python {model: account.invoice}: |
91 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_cad"))91 invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_cad"))
@@ -93,7 +93,7 @@
93 move_line_obj = self.pool.get('account.move.line')93 move_line_obj = self.pool.get('account.move.line')
94 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])94 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
95 move_line = move_line_obj.browse(cr, uid, move_lines[0])95 move_line = move_line_obj.browse(cr, uid, move_lines[0])
96 assert (move_line.debit - move_line.credit == 149.39), "Invoice move is incorrect for debtors account"96 assert (move_line.debit - move_line.credit == 191.74), "Invoice move is incorrect for debtors account"
97-97-
98 I set the context that will be used for the encoding of all the vouchers of this file98 I set the context that will be used for the encoding of all the vouchers of this file
99-99-
@@ -124,20 +124,20 @@
124 voucher_id = self.browse(cr, uid, ref('account_voucher_1_case4'))124 voucher_id = self.browse(cr, uid, ref('account_voucher_1_case4'))
125 data = []125 data = []
126 for item in voucher_id.line_cr_ids:126 for item in voucher_id.line_cr_ids:
127 if item.amount_unreconciled == 186.74:127 if item.amount_unreconciled == 184.26:
128 data += [(item.id, 186.74)]128 data += [(item.id, 184.26)]
129 else:129 else:
130 data += [(item.id, 0.0)]130 data += [(item.id, 0.0)]
131 for line_id, amount in data:131 for line_id, amount in data:
132 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})132 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})
133 assert (voucher_id.state=='draft'), "Voucher is not in draft state"133 assert (voucher_id.state=='draft'), "Voucher is not in draft state"
134-134-
135 I check that writeoff amount computed is 13.26135 I check that writeoff amount computed is 15.74
136-136-
137 !python {model: account.voucher}: |137 !python {model: account.voucher}: |
138 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))])138 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))])
139 voucher_id = self.browse(cr, uid, voucher[0])139 voucher_id = self.browse(cr, uid, voucher[0])
140 assert (round(voucher_id.writeoff_amount,2) == 13.26), "Writeoff amount is not 13.26 CHF"140 assert (round(voucher_id.writeoff_amount,2) == 15.74), "Writeoff amount is not 15.74 CHF"
141-141-
142 I confirm the voucher142 I confirm the voucher
143-143-
@@ -163,7 +163,7 @@
163-163-
164 I check that my currency rate difference is correct. 0 in debit with 98.78 CAD as amount_currency164 I check that my currency rate difference is correct. 0 in debit with 98.78 CAD as amount_currency
165-165-
166 I check that my writeoff is correct. 11.05 credit and -13.26 amount_currency166 I check that my writeoff is correct. 11.05 credit and -15.74 amount_currency
167-167-
168 !python {model: account.voucher}: |168 !python {model: account.voucher}: |
169 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))])169 voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))])
@@ -171,15 +171,15 @@
171 move_line_obj = self.pool.get('account.move.line')171 move_line_obj = self.pool.get('account.move.line')
172 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])172 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
173 for move_line in move_line_obj.browse(cr, uid, move_lines):173 for move_line in move_line_obj.browse(cr, uid, move_lines):
174 if move_line.amount_currency == 200:174 if move_line.amount_currency == 200.0:
175 assert move_line.debit == 160.00, "Bank account has wrong entry."175 assert move_line.debit == 208.12, "Bank account has wrong entry."
176 elif move_line.amount_currency == -298.78:176 elif move_line.amount_currency == -326.78:
177 assert move_line.credit == 149.39, "Debtor account has wrong entry."177 assert move_line.credit == 191.74, "Debtor account has wrong entry."
178 elif move_line.debit == 0.00 and move_line.credit == 0.00:178 elif move_line.debit == 0.00 and move_line.credit == 0.00:
179 assert move_line.amount_currency == 98.78, "Incorrect Currency Difference, got %s as amount_currency (expected 98.78)." % (move_line.amount_currency)179 assert move_line.amount_currency == 126.78, "Incorrect Currency Difference, got %s as amount_currency (expected 98.78)." % (move_line.amount_currency)
180 assert move_line.currency_id.id == ref('base.CAD'), "Incorrect Currency Difference, got %s (expected 'CAD')" % (move_line.currency_id.name)180 assert move_line.currency_id.id == ref('base.CAD'), "Incorrect Currency Difference, got %s (expected 'CAD')" % (move_line.currency_id.name)
181 elif move_line.credit == 10.61:181 elif move_line.credit == 16.38:
182 assert move_line.amount_currency == -13.26, "Writeoff amount is wrong."182 assert move_line.amount_currency == -15.74, "Writeoff amount is wrong."
183 else:183 else:
184 assert False, "Wrong entry"184 assert False, "Wrong entry"
185-185-
186186
=== modified file 'account_voucher/test/case5_suppl_usd_usd.yml'
--- account_voucher/test/case5_suppl_usd_usd.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case5_suppl_usd_usd.yml 2014-05-14 12:25:54 +0000
@@ -1,30 +1,30 @@
1-1-
2 In order to check the Account_voucher module with multi-currency in OpenERP, 2 In order to check the Account_voucher module with multi-currency in OpenERP,
3 I create a supplier invoices in USD and make the payment in USD but with another exchange rate and with a write-off3 I create a supplier invoices in EUR and make the payment in EUR but with another exchange rate and with a write-off
4-4-
5 I create a cash account with currency USD5 I create a cash account with currency USD
6-6-
7 !record {model: account.account, id: account_cash_usd_id2}:7 !record {model: account.account, id: account_cash_eur_id2}:
8 currency_id: base.USD8 currency_id: base.EUR
9 name: "cash account in usd"9 name: "cash account in eur"
10 code: "Xcash usd2"10 code: "Xcash eur2"
11 type: 'liquidity'11 type: 'liquidity'
12 user_type: "account.data_account_type_cash"12 user_type: "account.data_account_type_cash"
1313
14-14-
15 I create currency USD in OpenERP for November of 1.8 Rate15 I create currency EUR in OpenERP for November of 0.9 Rate
16-16-
17 !record {model: res.currency.rate, id: nov_usd}:17 !record {model: res.currency.rate, id: nov_eur}:
18 currency_id: base.USD18 currency_id: base.EUR
19 name: !eval "'%s-11-01' %(datetime.now().year)"19 name: !eval "'%s-11-01' %(datetime.now().year)"
20 rate: 1.820 rate: 0.9
21-21-
22 I create currency USD in OpenERP for December of 1.5 Rate22 I create currency EUR in OpenERP for December of 0.8 Rate
23-23-
24 !record {model: res.currency.rate, id: dec_usd}:24 !record {model: res.currency.rate, id: dec_eur}:
25 currency_id: base.USD25 currency_id: base.EUR
26 name: !eval "'%s-12-01' %(datetime.now().year)"26 name: !eval "'%s-12-01' %(datetime.now().year)"
27 rate: 1.527 rate: 0.8
28-28-
29 I set the income and expense currency accounts on the main company29 I set the income and expense currency accounts on the main company
30-30-
@@ -35,7 +35,19 @@
35 'expense_currency_exchange_account_id': ref('account.o_expense')}35 'expense_currency_exchange_account_id': ref('account.o_expense')}
36 self.write(cr, uid, ref('base.main_company'), vals)36 self.write(cr, uid, ref('base.main_company'), vals)
37-37-
38 I create a bank journal with EUR as currency38 I create a bank journal with USD as currency
39-
40 !record {model: account.journal, id: bank_journal_USD}:
41 name: Bank Journal(USD)
42 code: BUSD
43 type: bank
44 analytic_journal_id: account.sit
45 sequence_id: account.sequence_bank_journal
46 default_debit_account_id: account.cash
47 default_credit_account_id: account.cash
48 company_id: base.main_company
49-
50 I create a bank journal with USD as currency
39-51-
40 !record {model: account.journal, id: bank_journal_EUR}:52 !record {model: account.journal, id: bank_journal_EUR}:
41 name: Bank Journal(EUR)53 name: Bank Journal(EUR)
@@ -43,21 +55,9 @@
43 type: bank55 type: bank
44 analytic_journal_id: account.sit56 analytic_journal_id: account.sit
45 sequence_id: account.sequence_bank_journal57 sequence_id: account.sequence_bank_journal
46 default_debit_account_id: account.cash58 default_debit_account_id: account_cash_eur_id2
47 default_credit_account_id: account.cash59 default_credit_account_id: account_cash_eur_id2
48 company_id: base.main_company60 currency: base.EUR
49-
50 I create a bank journal with USD as currency
51-
52 !record {model: account.journal, id: bank_journal_USD}:
53 name: Bank Journal(USD)
54 code: BUSD
55 type: bank
56 analytic_journal_id: account.sit
57 sequence_id: account.sequence_bank_journal
58 default_debit_account_id: account_cash_usd_id2
59 default_credit_account_id: account_cash_usd_id2
60 currency: base.USD
61 company_id: base.main_company61 company_id: base.main_company
62-62-
63 I set the context as would do the action in supplier invoice menuitem63 I set the context as would do the action in supplier invoice menuitem
@@ -65,12 +65,12 @@
65 !context65 !context
66 'default_type': 'in_invoice'66 'default_type': 'in_invoice'
67-67-
68 I create the invoice on 1st november for 1000 USD68 I create the invoice on 1st november for 1000 EUR
69-69-
70 !record {model: account.invoice, id: account_supplier_invoice_november, view: account.invoice_supplier_form}:70 !record {model: account.invoice, id: account_supplier_invoice_november, view: account.invoice_supplier_form}:
71 account_id: account.a_pay71 account_id: account.a_pay
72 company_id: base.main_company72 company_id: base.main_company
73 currency_id: base.USD73 currency_id: base.EUR
74 date_invoice: !eval "'%s-11-01' %(datetime.now().year)"74 date_invoice: !eval "'%s-11-01' %(datetime.now().year)"
75 period_id: account.period_175 period_id: account.period_1
76 invoice_line:76 invoice_line:
@@ -89,7 +89,7 @@
89-89-
90 !workflow {model: account.invoice, action: invoice_open, ref: account_supplier_invoice_november}90 !workflow {model: account.invoice, action: invoice_open, ref: account_supplier_invoice_november}
91-91-
92 I check that first invoice move is correct for creditor account(debit - credit == -555.56)92 I check that first invoice move is correct for creditor account(debit - credit == -1111.11)
93-93-
94 !python {model: account.invoice}: |94 !python {model: account.invoice}: |
95 invoice_id = self.browse(cr, uid, ref("account_supplier_invoice_november"))95 invoice_id = self.browse(cr, uid, ref("account_supplier_invoice_november"))
@@ -97,7 +97,7 @@
97 move_line_obj = self.pool.get('account.move.line')97 move_line_obj = self.pool.get('account.move.line')
98 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])98 move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
99 move_line = move_line_obj.browse(cr, uid, move_lines[0])99 move_line = move_line_obj.browse(cr, uid, move_lines[0])
100 assert (move_line.debit - move_line.credit == -555.56), "Invoice move is incorrect for creditor account"100 assert (move_line.debit - move_line.credit == -1111.11), "Invoice move is incorrect for creditor account"
101 assert (move_line.amount_currency == -1000), "Amount currency is incorrect for creditor account"101 assert (move_line.amount_currency == -1000), "Amount currency is incorrect for creditor account"
102-102-
103 I set the context that will be used for the encoding of all the vouchers of this file103 I set the context that will be used for the encoding of all the vouchers of this file
@@ -105,13 +105,13 @@
105 !context105 !context
106 'type': 'payment'106 'type': 'payment'
107-107-
108 I create the voucher of payment with values $950, journal USD108 I create the voucher of payment with values $950, journal EUR
109-109-
110 !record {model: account.voucher, id: account_voucher_case_5_supplier_flow, view: view_vendor_payment_form}:110 !record {model: account.voucher, id: account_voucher_case_5_supplier_flow, view: view_vendor_payment_form}:
111 account_id: account.cash111 account_id: account.cash
112 amount: 950.0112 amount: 950.0
113 company_id: base.main_company113 company_id: base.main_company
114 journal_id: bank_journal_USD114 journal_id: bank_journal_EUR
115 name: 'Payment: Case Basic SUPPLIER USD/USD'115 name: 'Payment: Case Basic SUPPLIER USD/USD'
116 partner_id: base.res_partner_19116 partner_id: base.res_partner_19
117 period_id: account.period_12117 period_id: account.period_12
@@ -151,24 +151,24 @@
151-151-
152 I check that my creditor account is correct152 I check that my creditor account is correct
153-153-
154 I check that the bank entry is -$950 and 633.33€ as amount_currency and credit, respectively.154 I check that the bank entry is -$950 and 1187.5€ as amount_currency and credit, respectively.
155-155-
156 I check that the creditor account has 1 new line with $1000 and 666.67€ as amount_currency and debit, respectively.156 I check that the creditor account has 1 new line with $1000 and 1250.0€ as amount_currency and debit, respectively.
157-157-
158 I check that my currency rate difference is correct (111.11€ in debit/credit with no amount_currency)158 I check that my currency rate difference is correct (138.89€ in debit/credit with no amount_currency)
159-159-
160 I check that my writeoff is correct. 33.34€ in credit with -$50 as amount currency160 I check that my writeoff is correct. 62.5€ in credit with -$50 as amount currency
161-161-
162 !python {model: account.voucher}: |162 !python {model: account.voucher}: |
163 voucher_id = self.browse(cr, uid, ref('account_voucher_case_5_supplier_flow'))163 voucher_id = self.browse(cr, uid, ref('account_voucher_case_5_supplier_flow'))
164 for move_line in voucher_id.move_id.line_id:164 for move_line in voucher_id.move_id.line_id:
165 if move_line.amount_currency == -950.00:165 if move_line.amount_currency == -950.00:
166 assert move_line.credit == 633.33, "Wrong bank entry."166 assert move_line.credit == 1187.5, "Wrong bank entry."
167 elif move_line.credit == 111.11 or move_line.debit == 111.11:167 elif move_line.credit == 138.89 or move_line.debit == 138.89:
168 assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."168 assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
169 elif move_line.credit == 33.34:169 elif move_line.credit == 62.5:
170 assert move_line.amount_currency == -50.0, "Writeoff amount is wrong."170 assert move_line.amount_currency == -50.0, "Writeoff amount is wrong."
171 elif move_line.debit == 666.67:171 elif move_line.debit == 1250.0:
172 assert move_line.amount_currency == 1000.0, "Wrong supplier entry."172 assert move_line.amount_currency == 1000.0, "Wrong supplier entry."
173 else:173 else:
174 assert False, "Wrong entry. Unrecognized account move line"174 assert False, "Wrong entry. Unrecognized account move line"
175175
=== renamed file 'account_voucher/test/case_eur_usd.yml' => 'account_voucher/test/case_usd_eur.yml'
--- account_voucher/test/case_eur_usd.yml 2013-10-27 12:31:04 +0000
+++ account_voucher/test/case_usd_eur.yml 2014-05-14 12:25:54 +0000
@@ -5,45 +5,45 @@
5 !context5 !context
6 uid: 'res_users_account_voucher_manager'6 uid: 'res_users_account_voucher_manager'
7-7-
8 In order to check the payment with multi-currency in OpenERP, 8 In order to check the payment with multi-currency in OpenERP,
9 I create an invoice in EUR and make payment in USD based on the currency rating.9 I create an invoice in USD and make payment in EUR based on the currency rating.
10-10-
11 I update the Currency USD in OpenERP for January with rate 1.20000011 I update the Currency EUR in OpenERP for January with rate 1.400000
12-12-
13 !python {model: res.currency.rate}: |13 !python {model: res.currency.rate}: |
14 from datetime import datetime14 from datetime import datetime
15 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])[0]15 curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'EUR')])[0]
16 date = '%s-01-01' %(datetime.now().year)16 date = '%s-01-01' %(datetime.now().year)
17 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])17 ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])
18 self.write(cr, uid, ids, {'rate': 1.200000})18 self.write(cr, uid, ids, {'rate': 1.400000})
19-19-
20 I update the Currency USD in OpenERP for February with rate 1.40000020 I update the Currency EUR in OpenERP for February with rate 1.600000
21-21-
22 !record {model: res.currency.rate, id: feb_usd}:22 !record {model: res.currency.rate, id: feb_eur}:
23 currency_id: base.USD23 currency_id: base.EUR
24 name: !eval "'%s-02-01' %(datetime.now().year)"24 name: !eval "'%s-02-01' %(datetime.now().year)"
25 rate: 1.40000025 rate: 1.600000
26-26-
27 I create a bank account with USD as currency27 I create a bank account with EUR as currency
28-28-
29 !record {model: account.account, id: account_eur_usd_id}:29 !record {model: account.account, id: account_usd_eur_id}:
30 currency_id: base.USD30 currency_id: base.EUR
31 name: "Bank usd"31 name: "Bank eur"
32 code: "BUSD"32 code: "BEUR"
33 type: 'liquidity'33 type: 'liquidity'
34 user_type: account.data_account_type_asset34 user_type: account.data_account_type_asset
35-35-
36 I create a bank journal with USD as currency36 I create a bank journal with EUR as currency
37-37-
38 !record {model: account.journal, id: bank_journal_USD1}:38 !record {model: account.journal, id: bank_journal_EUR1}:
39 name: Bank Journal Test(USD)39 name: Bank Journal Test(EUR)
40 code: BEUSD40 code: BEEUR
41 type: bank41 type: bank
42 analytic_journal_id: account.sit42 analytic_journal_id: account.sit
43 sequence_id: account.sequence_bank_journal43 sequence_id: account.sequence_bank_journal
44 default_debit_account_id: account_eur_usd_id44 default_debit_account_id: account_usd_eur_id
45 default_credit_account_id: account_eur_usd_id45 default_credit_account_id: account_usd_eur_id
46 currency: base.USD46 currency: base.EUR
47 company_id: base.main_company47 company_id: base.main_company
48-48-
49 On the first of January, I create an invoice of 1000€49 On the first of January, I create an invoice of 1000€
@@ -51,7 +51,7 @@
51 !record {model: account.invoice, id: account_invoice_eur_usd}:51 !record {model: account.invoice, id: account_invoice_eur_usd}:
52 account_id: account.a_recv52 account_id: account.a_recv
53 company_id: base.main_company53 company_id: base.main_company
54 currency_id: base.EUR54 currency_id: base.USD
55 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"55 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
56 period_id: account.period_156 period_id: account.period_1
57 invoice_line:57 invoice_line:
@@ -90,7 +90,7 @@
90 account_id: account.cash90 account_id: account.cash
91 amount: 1350.091 amount: 1350.0
92 company_id: base.main_company92 company_id: base.main_company
93 journal_id: bank_journal_USD193 journal_id: bank_journal_EUR1
94 name: 'payment: Case EUR/USD'94 name: 'payment: Case EUR/USD'
95 partner_id: base.res_partner_1995 partner_id: base.res_partner_19
96 period_id: account.period_596 period_id: account.period_5
@@ -105,17 +105,17 @@
105 data = []105 data = []
106 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))106 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))
107 for item in voucher.line_cr_ids:107 for item in voucher.line_cr_ids:
108 if item.amount_unreconciled == 1400:108 if item.amount_unreconciled == 1600:
109 data += [(item.id, 1400)]109 data += [(item.id, 1600)]
110 for line_id, amount in data:110 for line_id, amount in data:
111 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})111 self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount})
112 assert (voucher.state=='draft'), "Voucher is not in draft state"112 assert (voucher.state=='draft'), "Voucher is not in draft state"
113-113-
114 I check that writeoff amount computed is -50.0114 I check that writeoff amount computed is -250.0
115-115-
116 !python {model: account.voucher}: |116 !python {model: account.voucher}: |
117 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))117 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))
118 assert (voucher.writeoff_amount == -50.0), "Writeoff amount is not -50.0"118 assert (voucher.writeoff_amount == -250.0), "Writeoff amount is not -250.0"
119-119-
120 I confirm the voucher120 I confirm the voucher
121-121-
@@ -150,9 +150,9 @@
150 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))150 voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case'))
151 for move_line in voucher.move_ids:151 for move_line in voucher.move_ids:
152 if move_line.amount_currency == 1350:152 if move_line.amount_currency == 1350:
153 assert move_line.debit == 964.29,"debtor account is not correct"153 assert move_line.debit == 843.75,"debtor account is not correct"
154 if move_line.amount_currency == 50:154 if move_line.amount_currency == 250.0:
155 assert move_line.debit == 35.71,"write off bank account is not correct"155 assert move_line.debit == 156.25,"write off bank account is not correct"
156 if move_line.amount_currency == 0.0:156 if move_line.amount_currency == 0.0:
157 assert move_line.credit == 1000,"total reconcile is not correct of invoice"157 assert move_line.credit == 1000,"total reconcile is not correct of invoice"
158-158-
159159
=== modified file 'account_voucher/test/sales_payment.yml'
--- account_voucher/test/sales_payment.yml 2014-04-24 12:35:38 +0000
+++ account_voucher/test/sales_payment.yml 2014-05-14 12:25:54 +0000
@@ -9,7 +9,7 @@
9 !record {model: account.invoice, id: account_invoice_0}:9 !record {model: account.invoice, id: account_invoice_0}:
10 account_id: account.a_recv10 account_id: account.a_recv
11 company_id: base.main_company11 company_id: base.main_company
12 currency_id: base.EUR12 currency_id: base.USD
13 invoice_line:13 invoice_line:
14 - account_id: account.a_sale14 - account_id: account.a_sale
15 name: '[PCSC234] PC Assemble SC234'15 name: '[PCSC234] PC Assemble SC234'
@@ -44,7 +44,7 @@
44 !python {model: account.voucher}: |44 !python {model: account.voucher}: |
45 vals = {}45 vals = {}
46 journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)46 journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
47 voucher = self.recompute_voucher_lines(cr, uid, [], ref("base.res_partner_19"), journal_id, 450.0, ref('base.EUR'), 'receipt', False)47 voucher = self.recompute_voucher_lines(cr, uid, [], ref("base.res_partner_19"), journal_id, 450.0, ref('base.USD'), 'receipt', False)
48 assert (voucher['value'].get('writeoff_amount') == 0.0), "Writeoff amount calculated by recompute_voucher_lines() is not 0.0"48 assert (voucher['value'].get('writeoff_amount') == 0.0), "Writeoff amount calculated by recompute_voucher_lines() is not 0.0"
49 res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)49 res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_19"), journal_id, 0.0, 1, ttype='receipt', date=False)
50 vals = {50 vals = {
5151
=== modified file 'multi_company/multi_company_demo.xml'
--- multi_company/multi_company_demo.xml 2014-05-07 18:29:17 +0000
+++ multi_company/multi_company_demo.xml 2014-05-14 12:25:54 +0000
@@ -53,7 +53,7 @@
53 <record id="res_company_oerp_editor" model="res.company">53 <record id="res_company_oerp_editor" model="res.company">
54 <field name="partner_id" ref="res_partner_oerp_editor"/>54 <field name="partner_id" ref="res_partner_oerp_editor"/>
55 <field name="parent_id" ref="base.main_company"/>55 <field name="parent_id" ref="base.main_company"/>
56 <field name="currency_id" ref="base.EUR"/>56 <field name="currency_id" ref="base.USD"/>
57 <field name="name">OpenERP Editor</field>57 <field name="name">OpenERP Editor</field>
58 </record>58 </record>
59 <record id="res_company_oerp_us" model="res.company">59 <record id="res_company_oerp_us" model="res.company">
@@ -71,13 +71,13 @@
71 <record id="res_company_oerp_in" model="res.company">71 <record id="res_company_oerp_in" model="res.company">
72 <field name="partner_id" ref="res_partner_oerp_in"/>72 <field name="partner_id" ref="res_partner_oerp_in"/>
73 <field name="parent_id" ref="res_company_oerp_editor"/>73 <field name="parent_id" ref="res_company_oerp_editor"/>
74 <field name="currency_id" ref="base.EUR"/>74 <field name="currency_id" ref="base.INR"/>
75 <field name="name">OpenERP IN</field>75 <field name="name">OpenERP IN</field>
76 </record>76 </record>
77 <record id="res_company_odoo" model="res.company">77 <record id="res_company_odoo" model="res.company">
78 <field name="partner_id" ref="res_partner_odoo"/>78 <field name="partner_id" ref="res_partner_odoo"/>
79 <field name="parent_id" ref="base.main_company"/>79 <field name="parent_id" ref="base.main_company"/>
80 <field name="currency_id" ref="base.EUR"/>80 <field name="currency_id" ref="base.USD"/>
81 <field name="name">Odoo</field>81 <field name="name">Odoo</field>
82 </record>82 </record>
8383
@@ -407,7 +407,7 @@
407 </record>407 </record>
408 <record id="project.project_project_5" model="project.project">408 <record id="project.project_project_5" model="project.project">
409 <field name="company_id" ref="res_company_oerp_in"/>409 <field name="company_id" ref="res_company_oerp_in"/>
410 <field name="currency_id" ref="base.EUR"/>410 <field name="currency_id" ref="base.INR"/>
411 </record>411 </record>
412412
413 <record id="project.project_task_19" model="project.task">413 <record id="project.project_task_19" model="project.task">
414414
=== modified file 'purchase/test/fifo_price.yml'
--- purchase/test/fifo_price.yml 2013-11-28 13:33:02 +0000
+++ purchase/test/fifo_price.yml 2014-05-14 12:25:54 +0000
@@ -144,7 +144,7 @@
144 We will temporarily change the currency rate on the sixth of June to have the same results all year144 We will temporarily change the currency rate on the sixth of June to have the same results all year
145- 145-
146 !record {model: res.currency.rate, id: base.rateUSDbis}:146 !record {model: res.currency.rate, id: base.rateUSDbis}:
147 rate: 1.2834147 rate: 1.0000
148 currency_id: base.USD148 currency_id: base.USD
149 name: !eval time.strftime('%Y-06-06')149 name: !eval time.strftime('%Y-06-06')
150- 150-
@@ -220,10 +220,10 @@
220 picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_cur"))220 picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_cur"))
221 picking_obj.do_transfer(context=context)221 picking_obj.do_transfer(context=context)
222- 222-
223 Check rounded price is 102 euro (because last outgoing shipment was made of 19.5kg at 80€ and 30kg at $150 (rate=1.2834)223 Check rounded price is 122.0 euro (because last outgoing shipment was made of 19.5kg at 80€ and 30kg at $150 (rate=1.0000)
224- 224-
225 !python {model: product.product}: |225 !python {model: product.product}: |
226 assert round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price) == 102, "Product price not updated accordingly. %s found instead of 102 (rounded values)" %(round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price),)226 assert round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price) == 122.0, "Product price not updated accordingly. %s found instead of 102 (rounded values)" %(round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price),)
227- 227-
228 Do a delivery of an extra 10 kg228 Do a delivery of an extra 10 kg
229- 229-
@@ -252,11 +252,11 @@
252 picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_ret"))252 picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_ret"))
253 picking_obj.do_transfer(context=context)253 picking_obj.do_transfer(context=context)
254- 254-
255 Check rounded price is 150.0 / 1.2834255 Check rounded price is 150.0 / 1.0000
256- 256-
257 !python {model: product.product}: |257 !python {model: product.product}: |
258 product = self.browse(cr, uid, ref("product_fifo_icecream"))258 product = self.browse(cr, uid, ref("product_fifo_icecream"))
259 assert round(product.standard_price) == round(150.0 / 1.2834), "Product price not updated accordingly. %s found instead of %s" %(product.standard_price, round(150.0/1.2834))259 assert round(product.standard_price) == round(150.0 / 1.0000), "Product price not updated accordingly. %s found instead of %s" %(product.standard_price, round(150.0/1.0000))
260 assert product.qty_available == 0.0, 'Wrong quantity in stock after first reception'260 assert product.qty_available == 0.0, 'Wrong quantity in stock after first reception'
261- 261-
262 Let us create some outs to get negative stock for a new product using the same config262 Let us create some outs to get negative stock for a new product using the same config
263263
=== modified file 'purchase/test/process/edi_purchase_order.yml'
--- purchase/test/process/edi_purchase_order.yml 2012-11-29 22:26:45 +0000
+++ purchase/test/process/edi_purchase_order.yml 2014-05-14 12:25:54 +0000
@@ -50,8 +50,8 @@
50 "__id": "base:724f9v70-dv70-1v70-8v70-701a04e25v70.EUR",50 "__id": "base:724f9v70-dv70-1v70-8v70-701a04e25v70.EUR",
51 "__module": "base",51 "__module": "base",
52 "__model": "res.currency",52 "__model": "res.currency",
53 "code": "EUR",53 "code": "USD",
54 "symbol": "€",54 "symbol": "$",
55 },55 },
56 "date_order": "2011-09-13", 56 "date_order": "2011-09-13",
57 "partner_id": ["sale:724f9v70-dv70-1v70-8v70-701a04e25v70.res_partner_test22", "Junjun wala"],57 "partner_id": ["sale:724f9v70-dv70-1v70-8v70-701a04e25v70.res_partner_test22", "Junjun wala"],
@@ -118,7 +118,6 @@
118 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"118 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"
119 bank_info = order_new.partner_id.bank_ids[0]119 bank_info = order_new.partner_id.bank_ids[0]
120 assert bank_info.acc_number == "Guys bank: 123477777-156113", 'Expected "Guys bank: 123477777-156113", got %s' % bank_info.acc_number120 assert bank_info.acc_number == "Guys bank: 123477777-156113", 'Expected "Guys bank: 123477777-156113", got %s' % bank_info.acc_number
121
122 assert order_new.pricelist_id.name == 'Default Purchase Pricelist' , "Default Purchase Pricelist was not automatically assigned"121 assert order_new.pricelist_id.name == 'Default Purchase Pricelist' , "Default Purchase Pricelist was not automatically assigned"
123 assert order_new.amount_total == 350, "Amount total is not same"122 assert order_new.amount_total == 350, "Amount total is not same"
124 assert order_new.amount_untaxed == 350, "untaxed amount is not same"123 assert order_new.amount_untaxed == 350, "untaxed amount is not same"
@@ -151,8 +150,8 @@
151 "__id": "base:724f93ec-ddd0-11e0-88ec-701a04e25543.EUR",150 "__id": "base:724f93ec-ddd0-11e0-88ec-701a04e25543.EUR",
152 "__module": "base",151 "__module": "base",
153 "__model": "res.currency",152 "__model": "res.currency",
154 "code": "EUR",153 "code": "USD",
155 "symbol": "€",154 "symbol": "$",
156 }, 155 },
157 "date_order": "2011-09-13",156 "date_order": "2011-09-13",
158 "partner_id": ["sale:724f93ec-ddd0-11e0-88ec-701a04e25543.res_partner_test22", "Junjun wala"],157 "partner_id": ["sale:724f93ec-ddd0-11e0-88ec-701a04e25543.res_partner_test22", "Junjun wala"],
@@ -219,7 +218,6 @@
219 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"218 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"
220 bank_info = order_new.partner_id.bank_ids[0]219 bank_info = order_new.partner_id.bank_ids[0]
221 assert bank_info.acc_number == "Another bank: 123477700-156113", 'Expected "Another bank: 123477700-156113", got %s' % bank_info.acc_number220 assert bank_info.acc_number == "Another bank: 123477700-156113", 'Expected "Another bank: 123477700-156113", got %s' % bank_info.acc_number
222
223 assert order_new.pricelist_id.name == 'Default Purchase Pricelist' , "Default Purchase Pricelist was not automatically assigned"221 assert order_new.pricelist_id.name == 'Default Purchase Pricelist' , "Default Purchase Pricelist was not automatically assigned"
224 assert order_new.amount_total == 350, "Amount total is not same"222 assert order_new.amount_total == 350, "Amount total is not same"
225 assert order_new.amount_untaxed == 350, "untaxed amount is not same"223 assert order_new.amount_untaxed == 350, "untaxed amount is not same"
@@ -234,4 +232,4 @@
234 assert purchase_line.price_unit == 20 , "unit price is not same, got %s, expected 20"%(purchase_line.price_unit,)232 assert purchase_line.price_unit == 20 , "unit price is not same, got %s, expected 20"%(purchase_line.price_unit,)
235 assert purchase_line.product_qty == 10 , "product qty is not same"233 assert purchase_line.product_qty == 10 , "product qty is not same"
236 else:234 else:
237 raise AssertionError('unknown order line: %s' % purchase_line)
238\ No newline at end of file235\ No newline at end of file
236 raise AssertionError('unknown order line: %s' % purchase_line)
239237
=== modified file 'report_intrastat/test/report_intrastat_report.yml'
--- report_intrastat/test/report_intrastat_report.yml 2014-04-02 16:40:53 +0000
+++ report_intrastat/test/report_intrastat_report.yml 2014-05-14 12:25:54 +0000
@@ -2,7 +2,7 @@
2 In order to test the PDF reports defined on an invoice, we will create a Invoice Record2 In order to test the PDF reports defined on an invoice, we will create a Invoice Record
3-3-
4 !record {model: account.invoice, id: test_invoice_1}:4 !record {model: account.invoice, id: test_invoice_1}:
5 currency_id: base.EUR5 currency_id: base.USD
6 company_id: base.main_company6 company_id: base.main_company
7 partner_id: base.res_partner_17 partner_id: base.res_partner_1
8 state: draft8 state: draft
99
=== modified file 'sale/test/edi_sale_order.yml'
--- sale/test/edi_sale_order.yml 2013-10-31 18:56:33 +0000
+++ sale/test/edi_sale_order.yml 2014-05-14 12:25:54 +0000
@@ -49,8 +49,8 @@
49 "__id": "base:5af12v70-dv70-1v70-bv70-701a04e25v70.EUR",49 "__id": "base:5af12v70-dv70-1v70-bv70-701a04e25v70.EUR",
50 "__module": "base",50 "__module": "base",
51 "__model": "res.currency",51 "__model": "res.currency",
52 "code": "EUR",52 "code": "USD",
53 "symbol": "€",53 "symbol": "$",
54 },54 },
55 "company_id": ["base:5af12v70-dv70-1v70-bv70-701a04e25v70.main_company", "Client S.A."],55 "company_id": ["base:5af12v70-dv70-1v70-bv70-701a04e25v70.main_company", "Client S.A."],
56 "company_address": {56 "company_address": {
@@ -101,7 +101,6 @@
101 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"101 assert len(order_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"
102 bank_info = order_new.partner_id.bank_ids[0]102 bank_info = order_new.partner_id.bank_ids[0]
103 assert bank_info.acc_number == "Another bank: 032465700-156700", 'Expected "Another bank: 032465700-156700", got %s' % bank_info.acc_number103 assert bank_info.acc_number == "Another bank: 032465700-156700", 'Expected "Another bank: 032465700-156700", got %s' % bank_info.acc_number
104
105 assert order_new.pricelist_id.name == 'Public Pricelist' , "Public Price list was not automatically assigned"104 assert order_new.pricelist_id.name == 'Public Pricelist' , "Public Price list was not automatically assigned"
106 assert order_new.amount_total == 350, "Amount total is wrong"105 assert order_new.amount_total == 350, "Amount total is wrong"
107 assert order_new.amount_untaxed == 350, "Untaxed amount is wrong"106 assert order_new.amount_untaxed == 350, "Untaxed amount is wrong"
@@ -135,8 +134,8 @@
135 "__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.EUR",134 "__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.EUR",
136 "__module": "base",135 "__module": "base",
137 "__model": "res.currency",136 "__model": "res.currency",
138 "code": "EUR",137 "code": "USD",
139 "symbol": "€",138 "symbol": "$",
140 },139 },
141 "company_id": ["base:5af1272e-dd26-11e0-b65e-701a04e25543.main_company", "Client S.A."],140 "company_id": ["base:5af1272e-dd26-11e0-b65e-701a04e25543.main_company", "Client S.A."],
142 "company_address": {141 "company_address": {
143142
=== modified file 'sale_crm/sale_crm_demo.xml'
--- sale_crm/sale_crm_demo.xml 2013-12-13 09:40:16 +0000
+++ sale_crm/sale_crm_demo.xml 2014-05-14 12:25:54 +0000
@@ -17,7 +17,7 @@
17 <!-- Invoice for Direct Marketing -->17 <!-- Invoice for Direct Marketing -->
1818
19 <record id="test_crm_sale_invoice_1" model="account.invoice">19 <record id="test_crm_sale_invoice_1" model="account.invoice">
20 <field name="currency_id" ref="base.EUR"/>20 <field name="currency_id" ref="base.USD"/>
21 <field name="company_id" ref="base.main_company"/>21 <field name="company_id" ref="base.main_company"/>
22 <field name="partner_id" ref="base.res_partner_1"/>22 <field name="partner_id" ref="base.res_partner_1"/>
23 <field name="journal_id" ref="account.sales_journal"/>23 <field name="journal_id" ref="account.sales_journal"/>
@@ -65,7 +65,7 @@
65 <!-- Invoice for Indirect Marketing -->65 <!-- Invoice for Indirect Marketing -->
6666
67 <record id="test_crm_sale_invoice_2" model="account.invoice">67 <record id="test_crm_sale_invoice_2" model="account.invoice">
68 <field name="currency_id" ref="base.EUR"/>68 <field name="currency_id" ref="base.USD"/>
69 <field name="company_id" ref="base.main_company"/>69 <field name="company_id" ref="base.main_company"/>
70 <field name="partner_id" ref="base.res_partner_1"/>70 <field name="partner_id" ref="base.res_partner_1"/>
71 <field name="journal_id" ref="account.sales_journal"/>71 <field name="journal_id" ref="account.sales_journal"/>

Subscribers

People subscribed via source and target branches

to all changes: