Merge lp:~openerp-dev/openobject-addons/trunk-americanization_account_config-ssh into lp:openobject-addons
- trunk-americanization_account_config-ssh
- Merge into trunk
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 |
Related bugs: |
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 |
Commit message
Description of the change
Hello,
Improve demo record and yml tests case for account,
Thanks
Sunil Sharma
- 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]:openobjec
t-addons - 9008. By Sunil Sharma(OpenERP)
-
[MRG]:openobjec
t-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)
- 9021. By Sunil Sharma(OpenERP)
-
[imp]:improve usd currency rate
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote : | # |
- 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
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_
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
1 | === modified file 'account/account_unit_test.xml' | |||
2 | --- account/account_unit_test.xml 2013-11-13 13:01:07 +0000 | |||
3 | +++ account/account_unit_test.xml 2014-05-14 12:25:54 +0000 | |||
4 | @@ -3,7 +3,7 @@ | |||
5 | 3 | <data> | 3 | <data> |
6 | 4 | <!-- This file must be loaded _after_ account_demo.xml ! --> | 4 | <!-- This file must be loaded _after_ account_demo.xml ! --> |
7 | 5 | <record id="test_invoice_1" model="account.invoice"> | 5 | <record id="test_invoice_1" model="account.invoice"> |
9 | 6 | <field name="currency_id" ref="base.EUR"/> | 6 | <field name="currency_id" ref="base.USD"/> |
10 | 7 | <field name="company_id" ref="base.main_company"/> | 7 | <field name="company_id" ref="base.main_company"/> |
11 | 8 | <field name="partner_id" ref="base.res_partner_1"/> | 8 | <field name="partner_id" ref="base.res_partner_1"/> |
12 | 9 | <field name="journal_id" ref="account.sales_journal"/> | 9 | <field name="journal_id" ref="account.sales_journal"/> |
13 | @@ -35,7 +35,7 @@ | |||
14 | 35 | </record> | 35 | </record> |
15 | 36 | 36 | ||
16 | 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"> |
18 | 38 | <test expr="currency_id.symbol">€</test> | 38 | <test expr="currency_id.symbol">$</test> |
19 | 39 | </assert> | 39 | </assert> |
20 | 40 | 40 | ||
21 | 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"> |
22 | 42 | 42 | ||
23 | === modified file 'account/data/configurable_account_chart.xml' | |||
24 | --- account/data/configurable_account_chart.xml 2012-11-29 22:26:45 +0000 | |||
25 | +++ account/data/configurable_account_chart.xml 2014-05-14 12:25:54 +0000 | |||
26 | @@ -371,7 +371,7 @@ | |||
27 | 371 | </record> | 371 | </record> |
28 | 372 | 372 | ||
29 | 373 | <record id="configurable_chart_template" model="account.chart.template"> | 373 | <record id="configurable_chart_template" model="account.chart.template"> |
31 | 374 | <field name="name">Configurable Account Chart Template</field> | 374 | <field name="name">Configurable Chart of Accounts Template</field> |
32 | 375 | <field name="account_root_id" ref="conf_chart0"/> | 375 | <field name="account_root_id" ref="conf_chart0"/> |
33 | 376 | <field name="tax_code_root_id" ref="tax_code_chart_root"/> | 376 | <field name="tax_code_root_id" ref="tax_code_chart_root"/> |
34 | 377 | <field name="bank_account_view_id" ref="conf_bnk"/> | 377 | <field name="bank_account_view_id" ref="conf_bnk"/> |
35 | 378 | 378 | ||
36 | === modified file 'account/demo/account_invoice_demo.xml' | |||
37 | --- account/demo/account_invoice_demo.xml 2012-11-29 22:26:45 +0000 | |||
38 | +++ account/demo/account_invoice_demo.xml 2014-05-14 12:25:54 +0000 | |||
39 | @@ -5,7 +5,7 @@ | |||
40 | 5 | <field name="date_due" eval="time.strftime('%Y')+'-01-30'"/> | 5 | <field name="date_due" eval="time.strftime('%Y')+'-01-30'"/> |
41 | 6 | <field name="payment_term" ref="account.account_payment_term"/> | 6 | <field name="payment_term" ref="account.account_payment_term"/> |
42 | 7 | <field name="journal_id" ref="account.expenses_journal"/> | 7 | <field name="journal_id" ref="account.expenses_journal"/> |
44 | 8 | <field name="currency_id" ref="base.EUR"/> | 8 | <field name="currency_id" ref="base.USD"/> |
45 | 9 | <field name="user_id" ref="base.user_demo"/> | 9 | <field name="user_id" ref="base.user_demo"/> |
46 | 10 | <field name="reference_type">none</field> | 10 | <field name="reference_type">none</field> |
47 | 11 | <field name="company_id" ref="base.main_company"/> | 11 | <field name="company_id" ref="base.main_company"/> |
48 | 12 | 12 | ||
49 | === modified file 'account/demo/account_minimal.xml' | |||
50 | --- account/demo/account_minimal.xml 2013-10-27 12:31:04 +0000 | |||
51 | +++ account/demo/account_minimal.xml 2014-05-14 12:25:54 +0000 | |||
52 | @@ -122,13 +122,13 @@ | |||
53 | 122 | <field name="type">other</field> | 122 | <field name="type">other</field> |
54 | 123 | <field name="user_type" ref="data_account_type_income"/> | 123 | <field name="user_type" ref="data_account_type_income"/> |
55 | 124 | </record> | 124 | </record> |
57 | 125 | <record id="usd_bnk" model="account.account"> | 125 | <record id="eur_bnk" model="account.account"> |
58 | 126 | <field name="code">X11007</field> | 126 | <field name="code">X11007</field> |
60 | 127 | <field name="name">USD Bank Account - (test)</field> | 127 | <field name="name">EUR Bank Account - (test)</field> |
61 | 128 | <field ref="cas" name="parent_id"/> | 128 | <field ref="cas" name="parent_id"/> |
62 | 129 | <field name="type">liquidity</field> | 129 | <field name="type">liquidity</field> |
63 | 130 | <field name="user_type" ref="data_account_type_asset"/> | 130 | <field name="user_type" ref="data_account_type_asset"/> |
65 | 131 | <field name="currency_id" ref="base.USD"/> | 131 | <field name="currency_id" ref="base.EUR"/> |
66 | 132 | </record> | 132 | </record> |
67 | 133 | 133 | ||
68 | 134 | <record model="account.account" id="liabilities_view"> | 134 | <record model="account.account" id="liabilities_view"> |
69 | @@ -409,14 +409,15 @@ | |||
70 | 409 | <field name="user_id" ref="base.user_root"/> | 409 | <field name="user_id" ref="base.user_root"/> |
71 | 410 | </record> | 410 | </record> |
72 | 411 | 411 | ||
76 | 412 | <record id="bank_journal_usd" model="account.journal"> | 412 | <record id="bank_journal_eur" model="account.journal"> |
77 | 413 | <field name="name">USD Bank Journal - (test)</field> | 413 | <field name="name">EUR Bank Journal - (test)</field> |
78 | 414 | <field name="code">TUBK</field> | 414 | <field name="code">TEBK</field> |
79 | 415 | <field name="type">bank</field> | 415 | <field name="type">bank</field> |
83 | 416 | <field name="default_debit_account_id" ref="usd_bnk"/> | 416 | <field name="default_debit_account_id" ref="eur_bnk"/> |
84 | 417 | <field name="default_credit_account_id" ref="usd_bnk"/> | 417 | <field name="default_credit_account_id" ref="eur_bnk"/> |
85 | 418 | <field name="currency" ref="base.USD"/> | 418 | <field name="currency" ref="base.EUR"/> |
86 | 419 | </record> | 419 | </record> |
87 | 420 | |||
88 | 420 | <!-- | 421 | <!-- |
89 | 421 | Product income and expense accounts, default parameters | 422 | Product income and expense accounts, default parameters |
90 | 422 | --> | 423 | --> |
91 | 423 | 424 | ||
92 | === modified file 'account/res_config.py' | |||
93 | --- account/res_config.py 2014-04-23 11:40:53 +0000 | |||
94 | +++ account/res_config.py 2014-05-14 12:25:54 +0000 | |||
95 | @@ -39,8 +39,7 @@ | |||
96 | 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', |
97 | 40 | string='This company has its own chart of accounts', | 40 | string='This company has its own chart of accounts', |
98 | 41 | help="""Check this box if this company is a legal entity."""), | 41 | help="""Check this box if this company is a legal entity."""), |
101 | 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."), |
100 | 43 | string='Default company currency', help="Main currency of the company."), | ||
102 | 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, |
103 | 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."), |
104 | 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, |
105 | @@ -127,6 +126,16 @@ | |||
106 | 127 | implied_group="account.group_supplier_inv_check_total"), | 126 | implied_group="account.group_supplier_inv_check_total"), |
107 | 128 | } | 127 | } |
108 | 129 | 128 | ||
109 | 129 | def set_default_currency(self, cr, uid, ids, context=None): | ||
110 | 130 | config_data = self.browse(cr, uid, ids, context=context)[0] | ||
111 | 131 | company_id = config_data.company_id.id | ||
112 | 132 | currency_id = config_data.currency_id.id | ||
113 | 133 | return self.pool.get('res.company').write(cr, uid, [company_id], {'currency_id': currency_id}, context=context) | ||
114 | 134 | |||
115 | 135 | def get_default_currency(self, cr, uid, fields, context=None): | ||
116 | 136 | currency_id = self.pool.get('res.company')._get_company_currency(cr, uid, uid, context) | ||
117 | 137 | return {'currency_id': currency_id} | ||
118 | 138 | |||
119 | 130 | def _default_company(self, cr, uid, context=None): | 139 | def _default_company(self, cr, uid, context=None): |
120 | 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) |
121 | 132 | return user.company_id.id | 141 | return user.company_id.id |
122 | 133 | 142 | ||
123 | === modified file 'account/test/account_change_currency.yml' | |||
124 | --- account/test/account_change_currency.yml 2012-11-29 22:26:45 +0000 | |||
125 | +++ account/test/account_change_currency.yml 2014-05-14 12:25:54 +0000 | |||
126 | @@ -4,7 +4,7 @@ | |||
127 | 4 | !record {model: account.invoice, id: account_invoice_currency}: | 4 | !record {model: account.invoice, id: account_invoice_currency}: |
128 | 5 | account_id: account.a_recv | 5 | account_id: account.a_recv |
129 | 6 | company_id: base.main_company | 6 | company_id: base.main_company |
131 | 7 | currency_id: base.EUR | 7 | currency_id: base.USD |
132 | 8 | invoice_line: | 8 | invoice_line: |
133 | 9 | - account_id: account.a_sale | 9 | - account_id: account.a_sale |
134 | 10 | name: '[PCSC234] PC Assemble SC234' | 10 | name: '[PCSC234] PC Assemble SC234' |
135 | 11 | 11 | ||
136 | === modified file 'account/test/account_customer_invoice.yml' | |||
137 | --- account/test/account_customer_invoice.yml 2013-10-27 12:31:04 +0000 | |||
138 | +++ account/test/account_customer_invoice.yml 2014-05-14 12:25:54 +0000 | |||
139 | @@ -36,8 +36,8 @@ | |||
140 | 36 | I manually assign tax on invoice | 36 | I manually assign tax on invoice |
141 | 37 | - | 37 | - |
142 | 38 | !python {model: account.invoice.tax}: | | 38 | !python {model: account.invoice.tax}: | |
145 | 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) |
146 | 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) |
147 | 41 | invoice_tax_line = { | 41 | invoice_tax_line = { |
148 | 42 | 'name': 'Test Tax for Customer Invoice', | 42 | 'name': 'Test Tax for Customer Invoice', |
149 | 43 | 'manual': 1, | 43 | 'manual': 1, |
150 | 44 | 44 | ||
151 | === modified file 'account/test/account_invoice_state.yml' | |||
152 | --- account/test/account_invoice_state.yml 2013-10-27 12:31:04 +0000 | |||
153 | +++ account/test/account_invoice_state.yml 2014-05-14 12:25:54 +0000 | |||
154 | @@ -9,7 +9,7 @@ | |||
155 | 9 | !record {model: account.invoice, id: account_invoice_state}: | 9 | !record {model: account.invoice, id: account_invoice_state}: |
156 | 10 | account_id: account.a_recv | 10 | account_id: account.a_recv |
157 | 11 | company_id: base.main_company | 11 | company_id: base.main_company |
159 | 12 | currency_id: base.EUR | 12 | currency_id: base.USD |
160 | 13 | invoice_line: | 13 | invoice_line: |
161 | 14 | - account_id: account.a_sale | 14 | - account_id: account.a_sale |
162 | 15 | name: '[PCSC234] PC Assemble SC234' | 15 | name: '[PCSC234] PC Assemble SC234' |
163 | 16 | 16 | ||
164 | === modified file 'account/test/account_report.yml' | |||
165 | --- account/test/account_report.yml 2014-04-02 16:40:53 +0000 | |||
166 | +++ account/test/account_report.yml 2014-05-14 12:25:54 +0000 | |||
167 | @@ -2,7 +2,7 @@ | |||
168 | 2 | In order to test the PDF reports defined on an invoice, we will create a Invoice Record | 2 | In order to test the PDF reports defined on an invoice, we will create a Invoice Record |
169 | 3 | - | 3 | - |
170 | 4 | !record {model: account.invoice, id: test_invoice_1}: | 4 | !record {model: account.invoice, id: test_invoice_1}: |
172 | 5 | currency_id: base.EUR | 5 | currency_id: base.USD |
173 | 6 | company_id: base.main_company | 6 | company_id: base.main_company |
174 | 7 | partner_id: base.res_partner_1 | 7 | partner_id: base.res_partner_1 |
175 | 8 | state: draft | 8 | state: draft |
176 | 9 | 9 | ||
177 | === modified file 'account/test/account_sequence_test.yml' | |||
178 | --- account/test/account_sequence_test.yml 2012-11-29 22:26:45 +0000 | |||
179 | +++ account/test/account_sequence_test.yml 2014-05-14 12:25:54 +0000 | |||
180 | @@ -17,7 +17,7 @@ | |||
181 | 17 | - !record {model: account.invoice, id: invoice_seq_test}: | 17 | - !record {model: account.invoice, id: invoice_seq_test}: |
182 | 18 | account_id: account.a_recv | 18 | account_id: account.a_recv |
183 | 19 | company_id: base.main_company | 19 | company_id: base.main_company |
185 | 20 | currency_id: base.EUR | 20 | currency_id: base.USD |
186 | 21 | invoice_line: | 21 | invoice_line: |
187 | 22 | - account_id: account.a_sale | 22 | - account_id: account.a_sale |
188 | 23 | name: '[PC-DEM] PC on Demand' | 23 | name: '[PC-DEM] PC on Demand' |
189 | 24 | 24 | ||
190 | === modified file 'account/test/account_supplier_invoice.yml' | |||
191 | --- account/test/account_supplier_invoice.yml 2013-10-27 12:31:04 +0000 | |||
192 | +++ account/test/account_supplier_invoice.yml 2014-05-14 12:25:54 +0000 | |||
193 | @@ -30,7 +30,7 @@ | |||
194 | 30 | account_id: account.a_pay | 30 | account_id: account.a_pay |
195 | 31 | check_total: 3000.0 | 31 | check_total: 3000.0 |
196 | 32 | company_id: base.main_company | 32 | company_id: base.main_company |
198 | 33 | currency_id: base.EUR | 33 | currency_id: base.USD |
199 | 34 | invoice_line: | 34 | invoice_line: |
200 | 35 | - account_id: account.a_expense | 35 | - account_id: account.a_expense |
201 | 36 | name: '[PCSC234] PC Assemble SC234' | 36 | name: '[PCSC234] PC Assemble SC234' |
202 | 37 | 37 | ||
203 | === modified file 'account/test/test_edi_invoice.yml' | |||
204 | --- account/test/test_edi_invoice.yml 2012-11-29 22:26:45 +0000 | |||
205 | +++ account/test/test_edi_invoice.yml 2014-05-14 12:25:54 +0000 | |||
206 | @@ -6,7 +6,7 @@ | |||
207 | 6 | !record {model: account.invoice, id: invoice_edi_1}: | 6 | !record {model: account.invoice, id: invoice_edi_1}: |
208 | 7 | journal_id: 1 | 7 | journal_id: 1 |
209 | 8 | partner_id: base.res_partner_2 | 8 | partner_id: base.res_partner_2 |
211 | 9 | currency_id: base.EUR | 9 | currency_id: base.USD |
212 | 10 | company_id: 1 | 10 | company_id: 1 |
213 | 11 | account_id: account.a_pay | 11 | account_id: account.a_pay |
214 | 12 | date_invoice: !eval "'%s' % (time.strftime('%Y-%m-%d'))" | 12 | date_invoice: !eval "'%s' % (time.strftime('%Y-%m-%d'))" |
215 | 13 | 13 | ||
216 | === modified file 'account_voucher/__openerp__.py' | |||
217 | --- account_voucher/__openerp__.py 2014-04-02 16:40:53 +0000 | |||
218 | +++ account_voucher/__openerp__.py 2014-05-14 12:25:54 +0000 | |||
219 | @@ -65,13 +65,13 @@ | |||
220 | 65 | 'test/account_voucher.yml', | 65 | 'test/account_voucher.yml', |
221 | 66 | 'test/sales_receipt.yml', | 66 | 'test/sales_receipt.yml', |
222 | 67 | 'test/sales_payment.yml', | 67 | 'test/sales_payment.yml', |
228 | 68 | 'test/case1_usd_usd.yml', | 68 | 'test/case1_eur_eur.yml', |
229 | 69 | 'test/case1_usd_usd_payment_rate.yml', | 69 | 'test/case1_eur_eur_payment_rate.yml', |
230 | 70 | 'test/case2_usd_eur_debtor_in_eur.yml', | 70 | 'test/case2_eur_usd_debtor_in_usd.yml', |
231 | 71 | 'test/case2_usd_eur_debtor_in_usd.yml', | 71 | 'test/case2_eur_usd_debtor_in_eur.yml', |
232 | 72 | 'test/case3_eur_eur.yml', | 72 | 'test/case3_usd_usd.yml', |
233 | 73 | 'test/case4_cad_chf.yml', | 73 | 'test/case4_cad_chf.yml', |
235 | 74 | 'test/case_eur_usd.yml', | 74 | 'test/case_usd_eur.yml', |
236 | 75 | ], | 75 | ], |
237 | 76 | 'auto_install': False, | 76 | 'auto_install': False, |
238 | 77 | 'application': True, | 77 | 'application': True, |
239 | 78 | 78 | ||
240 | === renamed file 'account_voucher/test/case1_usd_usd.yml' => 'account_voucher/test/case1_eur_eur.yml' | |||
241 | --- account_voucher/test/case1_usd_usd.yml 2013-10-27 12:31:04 +0000 | |||
242 | +++ account_voucher/test/case1_eur_eur.yml 2014-05-14 12:25:54 +0000 | |||
243 | @@ -1,6 +1,6 @@ | |||
244 | 1 | - | 1 | - |
247 | 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, |
248 | 3 | I create 2 Invoices in USD and make 2 Payments in USD based on the currency rating on that particular date | 3 | I create 2 Invoices in EUR and make 2 Payments in EUR based on the currency rating on that particular date |
249 | 4 | - | 4 | - |
250 | 5 | I set the income and expense currency accounts on the main company | 5 | I set the income and expense currency accounts on the main company |
251 | 6 | - | 6 | - |
252 | @@ -11,69 +11,69 @@ | |||
253 | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} |
254 | 12 | self.write(cr, uid, ref('base.main_company'), vals) | 12 | self.write(cr, uid, ref('base.main_company'), vals) |
255 | 13 | - | 13 | - |
257 | 14 | I create currency USD in OpenERP for January of 1.333333 Rate | 14 | I create currency EUR in OpenERP for January of 0.800000 Rate |
258 | 15 | - | 15 | - |
259 | 16 | !python {model: res.currency.rate}: | | 16 | !python {model: res.currency.rate}: | |
260 | 17 | from datetime import datetime | 17 | from datetime import datetime |
262 | 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] |
263 | 19 | date = '%s-01-01' %(datetime.now().year) | 19 | date = '%s-01-01' %(datetime.now().year) |
264 | 20 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) | 20 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) |
271 | 21 | self.write(cr, uid, ids, {'rate': 1.333333}) | 21 | self.write(cr, uid, ids, {'rate': 0.800000}) |
272 | 22 | - | 22 | - |
273 | 23 | I create currency USD in OpenERP for February of 1.250000 Rate | 23 | I create currency EUR in OpenERP for February of 0.700000 Rate |
274 | 24 | - | 24 | - |
275 | 25 | !record {model: res.currency.rate, id: feb_usd}: | 25 | !record {model: res.currency.rate, id: feb_eur}: |
276 | 26 | currency_id: base.USD | 26 | currency_id: base.EUR |
277 | 27 | name: !eval "'%s-02-01' %(datetime.now().year)" | 27 | name: !eval "'%s-02-01' %(datetime.now().year)" |
279 | 28 | rate: 1.250000 | 28 | rate: 0.700000 |
280 | 29 | 29 | ||
281 | 30 | - | 30 | - |
283 | 31 | I create currency USD in OpenERP for March of 1.111111 Rate | 31 | I create currency EUR in OpenERP for March of 0.600000 Rate |
284 | 32 | - | 32 | - |
287 | 33 | !record {model: res.currency.rate, id: mar_usd}: | 33 | !record {model: res.currency.rate, id: mar_eur}: |
288 | 34 | currency_id: base.USD | 34 | currency_id: base.EUR |
289 | 35 | name: !eval "'%s-03-01' %(datetime.now().year)" | 35 | name: !eval "'%s-03-01' %(datetime.now().year)" |
291 | 36 | rate: 1.111111 | 36 | rate: 0.600000 |
292 | 37 | 37 | ||
293 | 38 | - | 38 | - |
295 | 39 | I create currency USD in OpenERP for April of 1.052632 Rate | 39 | I create currency EUR in OpenERP for April of 0.500000 Rate |
296 | 40 | - | 40 | - |
299 | 41 | !record {model: res.currency.rate, id: apr_usd}: | 41 | !record {model: res.currency.rate, id: apr_eur}: |
300 | 42 | currency_id: base.USD | 42 | currency_id: base.EUR |
301 | 43 | name: !eval "'%s-04-01' %(datetime.now().year)" | 43 | name: !eval "'%s-04-01' %(datetime.now().year)" |
303 | 44 | rate: 1.052632 | 44 | rate: 0.500000 |
304 | 45 | 45 | ||
305 | 46 | - | 46 | - |
307 | 47 | I create a cash account with currency USD | 47 | I create a cash account with currency EUR |
308 | 48 | - | 48 | - |
313 | 49 | !record {model: account.account, id: account_cash_usd_id}: | 49 | !record {model: account.account, id: account_cash_eur_id}: |
314 | 50 | currency_id: base.USD | 50 | currency_id: base.EUR |
315 | 51 | name: "cash account in usd" | 51 | name: "cash account in EUR" |
316 | 52 | code: "Xcash usd" | 52 | code: "Xcash EUR" |
317 | 53 | type: 'liquidity' | 53 | type: 'liquidity' |
318 | 54 | user_type: "account.data_account_type_cash" | 54 | user_type: "account.data_account_type_cash" |
319 | 55 | 55 | ||
320 | 56 | - | 56 | - |
322 | 57 | I create a bank journal with USD as currency | 57 | I create a bank journal with EUR as currency |
323 | 58 | - | 58 | - |
327 | 59 | !record {model: account.journal, id: bank_journal_USD}: | 59 | !record {model: account.journal, id: bank_journal_EUR}: |
328 | 60 | name: Bank Journal(USD) | 60 | name: Bank Journal(EUR) |
329 | 61 | code: BUSD | 61 | code: BEUR |
330 | 62 | type: bank | 62 | type: bank |
331 | 63 | analytic_journal_id: account.sit | 63 | analytic_journal_id: account.sit |
332 | 64 | sequence_id: account.sequence_bank_journal | 64 | sequence_id: account.sequence_bank_journal |
336 | 65 | default_debit_account_id: account_cash_usd_id | 65 | default_debit_account_id: account_cash_eur_id |
337 | 66 | default_credit_account_id: account_cash_usd_id | 66 | default_credit_account_id: account_cash_eur_id |
338 | 67 | currency: base.USD | 67 | currency: base.EUR |
339 | 68 | company_id: base.main_company | 68 | company_id: base.main_company |
340 | 69 | 69 | ||
341 | 70 | - | 70 | - |
343 | 71 | I create the first invoice on 1st January for 200 USD | 71 | I create the first invoice on 1st January for 200 EUR |
344 | 72 | - | 72 | - |
345 | 73 | !record {model: account.invoice, id: account_invoice_jan}: | 73 | !record {model: account.invoice, id: account_invoice_jan}: |
346 | 74 | account_id: account.a_recv | 74 | account_id: account.a_recv |
347 | 75 | company_id: base.main_company | 75 | company_id: base.main_company |
349 | 76 | currency_id: base.USD | 76 | currency_id: base.EUR |
350 | 77 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 77 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
351 | 78 | period_id: account.period_1 | 78 | period_id: account.period_1 |
352 | 79 | invoice_line: | 79 | invoice_line: |
353 | @@ -91,7 +91,7 @@ | |||
354 | 91 | - | 91 | - |
355 | 92 | !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan} | 92 | !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan} |
356 | 93 | - | 93 | - |
358 | 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) |
359 | 95 | - | 95 | - |
360 | 96 | !python {model: account.invoice}: | | 96 | !python {model: account.invoice}: | |
361 | 97 | invoice_id = self.browse(cr, uid, ref("account_invoice_jan")) | 97 | invoice_id = self.browse(cr, uid, ref("account_invoice_jan")) |
362 | @@ -99,14 +99,14 @@ | |||
363 | 99 | move_line_obj = self.pool.get('account.move.line') | 99 | move_line_obj = self.pool.get('account.move.line') |
364 | 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)]) |
365 | 101 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 101 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
367 | 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" |
368 | 103 | - | 103 | - |
370 | 104 | I create the second invoice on 1st February for 100 USD | 104 | I create the second invoice on 1st February for 100 EUR |
371 | 105 | - | 105 | - |
372 | 106 | !record {model: account.invoice, id: account_invoice_feb}: | 106 | !record {model: account.invoice, id: account_invoice_feb}: |
373 | 107 | account_id: account.a_recv | 107 | account_id: account.a_recv |
374 | 108 | company_id: base.main_company | 108 | company_id: base.main_company |
376 | 109 | currency_id: base.USD | 109 | currency_id: base.EUR |
377 | 110 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" | 110 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" |
378 | 111 | period_id: account.period_2 | 111 | period_id: account.period_2 |
379 | 112 | invoice_line: | 112 | invoice_line: |
380 | @@ -124,7 +124,7 @@ | |||
381 | 124 | - | 124 | - |
382 | 125 | !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb} | 125 | !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb} |
383 | 126 | - | 126 | - |
385 | 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) |
386 | 128 | - | 128 | - |
387 | 129 | !python {model: account.invoice}: | | 129 | !python {model: account.invoice}: | |
388 | 130 | invoice_id = self.browse(cr, uid, ref("account_invoice_feb")) | 130 | invoice_id = self.browse(cr, uid, ref("account_invoice_feb")) |
389 | @@ -132,7 +132,7 @@ | |||
390 | 132 | move_line_obj = self.pool.get('account.move.line') | 132 | move_line_obj = self.pool.get('account.move.line') |
391 | 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)]) |
392 | 134 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 134 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
394 | 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" |
395 | 136 | 136 | ||
396 | 137 | - | 137 | - |
397 | 138 | I set the context that will be used for the encoding of all the vouchers of this file | 138 | I set the context that will be used for the encoding of all the vouchers of this file |
398 | @@ -140,14 +140,14 @@ | |||
399 | 140 | !context | 140 | !context |
400 | 141 | 'type': 'receipt' | 141 | 'type': 'receipt' |
401 | 142 | - | 142 | - |
403 | 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, |
404 | 144 | - | 144 | - |
405 | 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}: |
406 | 146 | account_id: account.cash | 146 | account_id: account.cash |
407 | 147 | amount: 240.0 | 147 | amount: 240.0 |
408 | 148 | company_id: base.main_company | 148 | company_id: base.main_company |
411 | 149 | journal_id: bank_journal_USD | 149 | journal_id: bank_journal_EUR |
412 | 150 | name: 'First payment: Case 1 USD/USD' | 150 | name: 'First payment: Case 1 EUR/EUR' |
413 | 151 | partner_id: base.res_partner_19 | 151 | partner_id: base.res_partner_19 |
414 | 152 | period_id: account.period_3 | 152 | period_id: account.period_3 |
415 | 153 | date: !eval time.strftime("%Y-03-01") | 153 | date: !eval time.strftime("%Y-03-01") |
416 | @@ -174,20 +174,20 @@ | |||
417 | 174 | I check that writeoff amount computed is -10.0 | 174 | I check that writeoff amount computed is -10.0 |
418 | 175 | - | 175 | - |
419 | 176 | !python {model: account.voucher}: | | 176 | !python {model: account.voucher}: | |
421 | 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'))]) |
422 | 178 | voucher_id = self.browse(cr, uid, voucher[0]) | 178 | voucher_id = self.browse(cr, uid, voucher[0]) |
423 | 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" |
424 | 180 | - | 180 | - |
425 | 181 | I confirm the voucher | 181 | I confirm the voucher |
426 | 182 | - | 182 | - |
427 | 183 | !python {model: account.voucher}: | | 183 | !python {model: account.voucher}: | |
429 | 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'))]) |
430 | 185 | self.signal_proforma_voucher(cr, uid, voucher) | 185 | self.signal_proforma_voucher(cr, uid, voucher) |
431 | 186 | - | 186 | - |
432 | 187 | I check that the move of my first voucher is valid | 187 | I check that the move of my first voucher is valid |
433 | 188 | - | 188 | - |
434 | 189 | !python {model: account.voucher}: | | 189 | !python {model: account.voucher}: | |
436 | 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'))]) |
437 | 191 | voucher_id = self.browse(cr, uid, voucher[0]) | 191 | voucher_id = self.browse(cr, uid, voucher[0]) |
438 | 192 | move_line_obj = self.pool.get('account.move.line') | 192 | move_line_obj = self.pool.get('account.move.line') |
439 | 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)]) |
440 | @@ -196,24 +196,24 @@ | |||
441 | 196 | - | 196 | - |
442 | 197 | I check that my debtor account is correct | 197 | I check that my debtor account is correct |
443 | 198 | - | 198 | - |
445 | 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 63 | 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 300 and 116.67 |
446 | 200 | - | 200 | - |
448 | 201 | I check that my write-off is correct. 9 debit and 10 amount_currency | 201 | I check that my write-off is correct. 16.67 debit and 10 amount_currency |
449 | 202 | - | 202 | - |
450 | 203 | !python {model: account.voucher}: | | 203 | !python {model: account.voucher}: | |
452 | 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'))]) |
453 | 205 | voucher_id = self.browse(cr, uid, voucher[0]) | 205 | voucher_id = self.browse(cr, uid, voucher[0]) |
454 | 206 | move_line_obj = self.pool.get('account.move.line') | 206 | move_line_obj = self.pool.get('account.move.line') |
455 | 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)]) |
456 | 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): |
457 | 209 | if move_line.amount_currency == -180.00: | 209 | if move_line.amount_currency == -180.00: |
459 | 210 | assert move_line.credit == 162.00, "Debtor account has wrong entry." | 210 | assert move_line.credit == 300.0, "Debtor account has wrong entry." |
460 | 211 | elif move_line.amount_currency == -70.00: | 211 | elif move_line.amount_currency == -70.00: |
462 | 212 | assert move_line.credit == 63.00, "Debtor account has wrong entry." | 212 | assert move_line.credit == 116.67, "Debtor account has wrong entry." |
463 | 213 | elif move_line.amount_currency == 10.00: | 213 | elif move_line.amount_currency == 10.00: |
465 | 214 | assert move_line.debit == 9.00, "Writeoff amount is wrong." | 214 | assert move_line.debit == 16.67, "Writeoff amount is wrong." |
466 | 215 | elif move_line.amount_currency == 240.00: | 215 | elif move_line.amount_currency == 240.00: |
468 | 216 | assert move_line.debit == 216.00, "Bank entry is wrong." | 216 | assert move_line.debit == 400.00, "Bank entry is wrong." |
469 | 217 | else: | 217 | else: |
470 | 218 | assert False, "Unrecognized journal entry" | 218 | assert False, "Unrecognized journal entry" |
471 | 219 | - | 219 | - |
472 | @@ -235,13 +235,13 @@ | |||
473 | 235 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 235 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
474 | 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" |
475 | 237 | - | 237 | - |
477 | 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, |
478 | 239 | - | 239 | - |
479 | 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}: |
480 | 241 | account_id: account.cash | 241 | account_id: account.cash |
481 | 242 | amount: 45.0 | 242 | amount: 45.0 |
482 | 243 | company_id: base.main_company | 243 | company_id: base.main_company |
484 | 244 | journal_id: bank_journal_USD | 244 | journal_id: bank_journal_EUR |
485 | 245 | name: 'Second payment: Case 1' | 245 | name: 'Second payment: Case 1' |
486 | 246 | partner_id: base.res_partner_19 | 246 | partner_id: base.res_partner_19 |
487 | 247 | period_id: account.period_3 | 247 | period_id: account.period_3 |
488 | @@ -290,13 +290,13 @@ | |||
489 | 290 | - | 290 | - |
490 | 291 | I check that my debtor account is correct | 291 | I check that my debtor account is correct |
491 | 292 | - | 292 | - |
493 | 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.5 | 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 40 and 60 |
494 | 294 | - | 294 | - |
495 | 295 | I check that my currency rate difference is correct. 8.5 in credit with no amount_currency | 295 | I check that my currency rate difference is correct. 8.5 in credit with no amount_currency |
496 | 296 | - | 296 | - |
497 | 297 | I check that the total reconcilation created entries as expected | 297 | I check that the total reconcilation created entries as expected |
498 | 298 | - | 298 | - |
500 | 299 | I check that my writeoff is correct. 4.75 debit and 5 amount_currency | 299 | I check that my writeoff is correct. 10.0 debit and 5 amount_currency |
501 | 300 | - | 300 | - |
502 | 301 | !python {model: account.voucher}: | | 301 | !python {model: account.voucher}: | |
503 | 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'))]) |
504 | @@ -313,21 +313,21 @@ | |||
505 | 313 | reconcile_a = move_line.reconcile_id.id | 313 | reconcile_a = move_line.reconcile_id.id |
506 | 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): |
507 | 315 | if move_line.amount_currency == -20.00: | 315 | if move_line.amount_currency == -20.00: |
509 | 316 | assert move_line.credit == 19.00, "Debtor account has wrong entry." | 316 | assert move_line.credit == 40.00, "Debtor account has wrong entry." |
510 | 317 | elif move_line.amount_currency == -30.00: | 317 | elif move_line.amount_currency == -30.00: |
512 | 318 | assert move_line.credit == 28.50, "Debtor account has wrong entry." | 318 | assert move_line.credit == 60.0, "Debtor account has wrong entry." |
513 | 319 | elif move_line.amount_currency == 5.00: | 319 | elif move_line.amount_currency == 5.00: |
516 | 320 | assert move_line.debit == 4.75, "Writeoff amount is wrong." | 320 | assert move_line.debit == 10.0, "Writeoff amount is wrong." |
517 | 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: |
518 | 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" |
520 | 323 | elif move_line.credit == 11.5: | 323 | elif move_line.credit == 33.81: |
521 | 324 | assert move_line.amount_currency == 0.0 | 324 | assert move_line.amount_currency == 0.0 |
523 | 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: |
524 | 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" |
526 | 327 | elif move_line.credit == 31.0: | 327 | elif move_line.credit == 90.0: |
527 | 328 | assert move_line.amount_currency == 0.0 | 328 | assert move_line.amount_currency == 0.0 |
528 | 329 | elif move_line.amount_currency == 45.00: | 329 | elif move_line.amount_currency == 45.00: |
530 | 330 | assert move_line.debit == 42.75, "Bank entry is wrong." | 330 | assert move_line.debit == 90.0, "Bank entry is wrong." |
531 | 331 | else: | 331 | else: |
532 | 332 | assert False, "Unrecognized journal entry" | 332 | assert False, "Unrecognized journal entry" |
533 | 333 | - | 333 | - |
534 | 334 | 334 | ||
535 | === renamed file 'account_voucher/test/case1_usd_usd_payment_rate.yml' => 'account_voucher/test/case1_eur_eur_payment_rate.yml' | |||
536 | --- account_voucher/test/case1_usd_usd_payment_rate.yml 2013-05-14 12:03:41 +0000 | |||
537 | +++ account_voucher/test/case1_eur_eur_payment_rate.yml 2014-05-14 12:25:54 +0000 | |||
538 | @@ -1,6 +1,6 @@ | |||
539 | 1 | - | 1 | - |
542 | 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, |
543 | 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 OpenERP | 3 | 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 |
544 | 4 | - | 4 | - |
545 | 5 | I set the income and expense currency accounts on the main company | 5 | I set the income and expense currency accounts on the main company |
546 | 6 | - | 6 | - |
547 | @@ -11,60 +11,60 @@ | |||
548 | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} |
549 | 12 | self.write(cr, uid, ref('base.main_company'), vals) | 12 | self.write(cr, uid, ref('base.main_company'), vals) |
550 | 13 | - | 13 | - |
552 | 14 | I create currency USD in OpenERP for January of 1.333333 Rate | 14 | I create currency EUR in OpenERP for January of 0.888888 Rate |
553 | 15 | - | 15 | - |
554 | 16 | !python {model: res.currency.rate}: | | 16 | !python {model: res.currency.rate}: | |
555 | 17 | from datetime import datetime | 17 | from datetime import datetime |
557 | 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] |
558 | 19 | date = '%s-01-01' %(datetime.now().year) | 19 | date = '%s-01-01' %(datetime.now().year) |
559 | 20 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) | 20 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) |
566 | 21 | self.write(cr, uid, ids, {'rate': 1.333333}) | 21 | self.write(cr, uid, ids, {'rate': 0.888888}) |
567 | 22 | - | 22 | - |
568 | 23 | I create currency USD in OpenERP for February of 1.250000 Rate | 23 | I create currency EUR in OpenERP for February of 0.999999 Rate |
569 | 24 | - | 24 | - |
570 | 25 | !record {model: res.currency.rate, id: feb_usd}: | 25 | !record {model: res.currency.rate, id: feb_eur}: |
571 | 26 | currency_id: base.USD | 26 | currency_id: base.EUR |
572 | 27 | name: !eval "'%s-02-01' %(datetime.now().year)" | 27 | name: !eval "'%s-02-01' %(datetime.now().year)" |
574 | 28 | rate: 1.250000 | 28 | rate: 0.999999 |
575 | 29 | 29 | ||
576 | 30 | - | 30 | - |
578 | 31 | I create currency USD in OpenERP for March of 1.111111 Rate | 31 | I create currency EUR in OpenERP for March of 0.777777 Rate |
579 | 32 | - | 32 | - |
582 | 33 | !record {model: res.currency.rate, id: mar_usd}: | 33 | !record {model: res.currency.rate, id: mar_eur}: |
583 | 34 | currency_id: base.USD | 34 | currency_id: base.EUR |
584 | 35 | name: !eval "'%s-03-01' %(datetime.now().year)" | 35 | name: !eval "'%s-03-01' %(datetime.now().year)" |
586 | 36 | rate: 1.111111 | 36 | rate: 0.777777 |
587 | 37 | 37 | ||
588 | 38 | - | 38 | - |
590 | 39 | I create currency USD in OpenERP for April of 1.052632 Rate | 39 | I create currency EUR in OpenERP for April of 0.666666 Rate |
591 | 40 | - | 40 | - |
594 | 41 | !record {model: res.currency.rate, id: apr_usd}: | 41 | !record {model: res.currency.rate, id: apr_eur}: |
595 | 42 | currency_id: base.USD | 42 | currency_id: base.EUR |
596 | 43 | name: !eval "'%s-04-01' %(datetime.now().year)" | 43 | name: !eval "'%s-04-01' %(datetime.now().year)" |
598 | 44 | rate: 1.052632 | 44 | rate: 0.666666 |
599 | 45 | 45 | ||
600 | 46 | - | 46 | - |
602 | 47 | I create a cash account with currency USD | 47 | I create a cash account with currency EUR |
603 | 48 | - | 48 | - |
608 | 49 | !record {model: account.account, id: account_cash_usd_id}: | 49 | !record {model: account.account, id: account_cash_eur_id}: |
609 | 50 | currency_id: base.USD | 50 | currency_id: base.EUR |
610 | 51 | name: "cash account in usd" | 51 | name: "cash account in EUR" |
611 | 52 | code: "Xcash usd" | 52 | code: "Xcash eur" |
612 | 53 | type: 'liquidity' | 53 | type: 'liquidity' |
613 | 54 | user_type: "account.data_account_type_cash" | 54 | user_type: "account.data_account_type_cash" |
614 | 55 | 55 | ||
615 | 56 | - | 56 | - |
617 | 57 | I create a bank journal with USD as currency | 57 | I create a bank journal with EUR as currency |
618 | 58 | - | 58 | - |
622 | 59 | !record {model: account.journal, id: bank_journal_USD}: | 59 | !record {model: account.journal, id: bank_journal_EUR}: |
623 | 60 | name: Bank Journal(USD) | 60 | name: Bank Journal(EUR) |
624 | 61 | code: BUSD | 61 | code: BEUR |
625 | 62 | type: bank | 62 | type: bank |
626 | 63 | analytic_journal_id: account.sit | 63 | analytic_journal_id: account.sit |
627 | 64 | sequence_id: account.sequence_bank_journal | 64 | sequence_id: account.sequence_bank_journal |
631 | 65 | default_debit_account_id: account_cash_usd_id | 65 | default_debit_account_id: account_cash_eur_id |
632 | 66 | default_credit_account_id: account_cash_usd_id | 66 | default_credit_account_id: account_cash_eur_id |
633 | 67 | currency: base.USD | 67 | currency: base.EUR |
634 | 68 | company_id: base.main_company | 68 | company_id: base.main_company |
635 | 69 | 69 | ||
636 | 70 | - | 70 | - |
637 | @@ -75,12 +75,12 @@ | |||
638 | 75 | property_account_receivable: account.a_recv | 75 | property_account_receivable: account.a_recv |
639 | 76 | property_account_payable: account.a_pay | 76 | property_account_payable: account.a_pay |
640 | 77 | - | 77 | - |
642 | 78 | I create the first invoice on 1st January for 200 USD | 78 | I create the first invoice on 1st January for 200 EUR |
643 | 79 | - | 79 | - |
644 | 80 | !record {model: account.invoice, id: account_invoice_jan_payment_rate}: | 80 | !record {model: account.invoice, id: account_invoice_jan_payment_rate}: |
645 | 81 | account_id: account.a_recv | 81 | account_id: account.a_recv |
646 | 82 | company_id: base.main_company | 82 | company_id: base.main_company |
648 | 83 | currency_id: base.USD | 83 | currency_id: base.EUR |
649 | 84 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 84 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
650 | 85 | period_id: account.period_1 | 85 | period_id: account.period_1 |
651 | 86 | invoice_line: | 86 | invoice_line: |
652 | @@ -98,7 +98,7 @@ | |||
653 | 98 | - | 98 | - |
654 | 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} |
655 | 100 | - | 100 | - |
657 | 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) |
658 | 102 | - | 102 | - |
659 | 103 | !python {model: account.invoice}: | | 103 | !python {model: account.invoice}: | |
660 | 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")) |
661 | @@ -106,14 +106,14 @@ | |||
662 | 106 | move_line_obj = self.pool.get('account.move.line') | 106 | move_line_obj = self.pool.get('account.move.line') |
663 | 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)]) |
664 | 108 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 108 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
666 | 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" |
667 | 110 | - | 110 | - |
669 | 111 | I create the second invoice on 1st February for 100 USD | 111 | I create the second invoice on 1st February for 100 EUR |
670 | 112 | - | 112 | - |
671 | 113 | !record {model: account.invoice, id: account_invoice_feb_payment_rate}: | 113 | !record {model: account.invoice, id: account_invoice_feb_payment_rate}: |
672 | 114 | account_id: account.a_recv | 114 | account_id: account.a_recv |
673 | 115 | company_id: base.main_company | 115 | company_id: base.main_company |
675 | 116 | currency_id: base.USD | 116 | currency_id: base.EUR |
676 | 117 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" | 117 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" |
677 | 118 | period_id: account.period_2 | 118 | period_id: account.period_2 |
678 | 119 | invoice_line: | 119 | invoice_line: |
679 | @@ -131,7 +131,7 @@ | |||
680 | 131 | - | 131 | - |
681 | 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} |
682 | 133 | - | 133 | - |
684 | 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) |
685 | 135 | - | 135 | - |
686 | 136 | !python {model: account.invoice}: | | 136 | !python {model: account.invoice}: | |
687 | 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")) |
688 | @@ -139,7 +139,7 @@ | |||
689 | 139 | move_line_obj = self.pool.get('account.move.line') | 139 | move_line_obj = self.pool.get('account.move.line') |
690 | 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)]) |
691 | 141 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 141 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
693 | 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" |
694 | 143 | 143 | ||
695 | 144 | - | 144 | - |
696 | 145 | I set the context that will be used for the encoding of all the vouchers of this file | 145 | I set the context that will be used for the encoding of all the vouchers of this file |
697 | @@ -147,14 +147,14 @@ | |||
698 | 147 | !context | 147 | !context |
699 | 148 | 'type': 'receipt' | 148 | 'type': 'receipt' |
700 | 149 | - | 149 | - |
702 | 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€ |
703 | 151 | - | 151 | - |
704 | 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}: |
705 | 153 | account_id: account.cash | 153 | account_id: account.cash |
706 | 154 | amount: 240.0 | 154 | amount: 240.0 |
707 | 155 | company_id: base.main_company | 155 | company_id: base.main_company |
710 | 156 | journal_id: bank_journal_USD | 156 | journal_id: bank_journal_EUR |
711 | 157 | name: 'Payment: Case 1 USD/USD payment rate' | 157 | name: 'Payment: Case 1 EUR/EUR payment rate' |
712 | 158 | partner_id: res_partner_mc_kay | 158 | partner_id: res_partner_mc_kay |
713 | 159 | period_id: account.period_3 | 159 | period_id: account.period_3 |
714 | 160 | date: !eval time.strftime("%Y-03-01") | 160 | date: !eval time.strftime("%Y-03-01") |
715 | @@ -162,7 +162,7 @@ | |||
716 | 162 | writeoff_acc_id: account.a_expense | 162 | writeoff_acc_id: account.a_expense |
717 | 163 | comment: 'Write Off' | 163 | comment: 'Write Off' |
718 | 164 | payment_rate: 0.8 | 164 | payment_rate: 0.8 |
720 | 165 | payment_rate_currency_id: base.EUR | 165 | payment_rate_currency_id: base.USD |
721 | 166 | 166 | ||
722 | 167 | - | 167 | - |
723 | 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$> |
724 | @@ -226,22 +226,22 @@ | |||
725 | 226 | else: | 226 | else: |
726 | 227 | assert False, "Unrecognized journal entry" | 227 | assert False, "Unrecognized journal entry" |
727 | 228 | - | 228 | - |
729 | 229 | I check the residual amount of Invoice1, should be 20 in amount_currency and 6 in amount_residual | 229 | I check the residual amount of Invoice1, should be 20 in amount_currency and 81 in amount_residual |
730 | 230 | - | 230 | - |
731 | 231 | !python {model: account.invoice}: | | 231 | !python {model: account.invoice}: | |
732 | 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")) |
733 | 233 | move_line_obj = self.pool.get('account.move.line') | 233 | move_line_obj = self.pool.get('account.move.line') |
734 | 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)]) |
735 | 235 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 235 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
737 | 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" |
738 | 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" |
739 | 238 | - | 238 | - |
741 | 239 | I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual | 239 | I check the residual amuont of Invoice2, should be 30 in residual currency and 44 in amount_residual |
742 | 240 | - | 240 | - |
743 | 241 | !python {model: account.invoice}: | | 241 | !python {model: account.invoice}: | |
744 | 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")) |
745 | 243 | move_line_obj = self.pool.get('account.move.line') | 243 | move_line_obj = self.pool.get('account.move.line') |
746 | 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)]) |
747 | 245 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 245 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
749 | 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" |
750 | 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" |
751 | 248 | 248 | ||
752 | === renamed file 'account_voucher/test/case2_usd_eur_debtor_in_usd.yml' => 'account_voucher/test/case2_eur_usd_debtor_in_eur.yml' | |||
753 | --- account_voucher/test/case2_usd_eur_debtor_in_usd.yml 2013-10-27 12:31:04 +0000 | |||
754 | +++ account_voucher/test/case2_eur_usd_debtor_in_eur.yml 2014-05-14 12:25:54 +0000 | |||
755 | @@ -1,6 +1,6 @@ | |||
756 | 1 | - | 1 | - |
759 | 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, |
760 | 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 date | 3 | 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 |
761 | 4 | - | 4 | - |
762 | 5 | I set the income and expense currency accounts on the main company | 5 | I set the income and expense currency accounts on the main company |
763 | 6 | - | 6 | - |
764 | @@ -11,42 +11,54 @@ | |||
765 | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} |
766 | 12 | self.write(cr, uid, ref('base.main_company'), vals) | 12 | self.write(cr, uid, ref('base.main_company'), vals) |
767 | 13 | - | 13 | - |
769 | 14 | I modify the debtor account in order to set the currency_id = USD | 14 | I modify the debtor account in order to set the currency_id = EUR |
770 | 15 | - | 15 | - |
771 | 16 | !python {model: account.account}: | | 16 | !python {model: account.account}: | |
772 | 17 | from datetime import datetime | 17 | from datetime import datetime |
773 | 18 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) | 18 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) |
775 | 19 | self.write(cr, uid, ids, {'currency_id': ref('base.USD')}) | 19 | self.write(cr, uid, ids, {'currency_id': ref('base.EUR')}) |
776 | 20 | - | 20 | - |
778 | 21 | I create currency USD in OpenERP for January of 1.333333 Rate | 21 | I create currency EUR in OpenERP for January of 0.800000 Rate |
779 | 22 | - | 22 | - |
780 | 23 | !python {model: res.currency.rate}: | | 23 | !python {model: res.currency.rate}: | |
781 | 24 | from datetime import datetime | 24 | from datetime import datetime |
783 | 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] |
784 | 26 | date = '%s-01-01' %(datetime.now().year) | 26 | date = '%s-01-01' %(datetime.now().year) |
785 | 27 | ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)]) | 27 | ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)]) |
792 | 28 | self.write(cr, uid, ids, {'rate': 1.333333}) | 28 | self.write(cr, uid, ids, {'rate': 0.800000}) |
793 | 29 | - | 29 | - |
794 | 30 | I create currency USD in OpenERP for February of 1.250000 Rate | 30 | I create currency EUR in OpenERP for February of 0.900000 Rate |
795 | 31 | - | 31 | - |
796 | 32 | !record {model: res.currency.rate, id: feb_usd}: | 32 | !record {model: res.currency.rate, id: feb_eur}: |
797 | 33 | currency_id: base.USD | 33 | currency_id: base.EUR |
798 | 34 | name: !eval "'%s-02-01' %(datetime.now().year)" | 34 | name: !eval "'%s-02-01' %(datetime.now().year)" |
805 | 35 | rate: 1.250000 | 35 | rate: 0.900000 |
806 | 36 | - | 36 | - |
807 | 37 | I create currency USD in OpenERP for March of 1.111111 Rate | 37 | I create currency EUR in OpenERP for March of 0.600000 Rate |
808 | 38 | - | 38 | - |
809 | 39 | !record {model: res.currency.rate, id: mar_usd}: | 39 | !record {model: res.currency.rate, id: mar_eur}: |
810 | 40 | currency_id: base.USD | 40 | currency_id: base.EUR |
811 | 41 | name: !eval "'%s-03-01' %(datetime.now().year)" | 41 | name: !eval "'%s-03-01' %(datetime.now().year)" |
818 | 42 | rate: 1.111111 | 42 | rate: 0.600000 |
819 | 43 | - | 43 | - |
820 | 44 | I create currency USD in OpenERP for April of 1.052632 Rate | 44 | I create currency EUR in OpenERP for April of 0.500000 Rate |
821 | 45 | - | 45 | - |
822 | 46 | !record {model: res.currency.rate, id: apr_usd}: | 46 | !record {model: res.currency.rate, id: apr_eur}: |
823 | 47 | currency_id: base.USD | 47 | currency_id: base.EUR |
824 | 48 | name: !eval "'%s-04-01' %(datetime.now().year)" | 48 | name: !eval "'%s-04-01' %(datetime.now().year)" |
826 | 49 | rate: 1.052632 | 49 | rate: 0.500000 |
827 | 50 | - | ||
828 | 51 | I create a bank journal with USD as currency | ||
829 | 52 | - | ||
830 | 53 | !record {model: account.journal, id: bank_journal_USD}: | ||
831 | 54 | name: Bank Journal(USD) | ||
832 | 55 | code: BUSD | ||
833 | 56 | type: bank | ||
834 | 57 | analytic_journal_id: account.sit | ||
835 | 58 | sequence_id: account.sequence_bank_journal | ||
836 | 59 | default_debit_account_id: account.cash | ||
837 | 60 | default_credit_account_id: account.cash | ||
838 | 61 | company_id: base.main_company | ||
839 | 50 | - | 62 | - |
840 | 51 | I create a bank journal with EUR as currency | 63 | I create a bank journal with EUR as currency |
841 | 52 | - | 64 | - |
842 | @@ -56,29 +68,17 @@ | |||
843 | 56 | type: bank | 68 | type: bank |
844 | 57 | analytic_journal_id: account.sit | 69 | analytic_journal_id: account.sit |
845 | 58 | sequence_id: account.sequence_bank_journal | 70 | sequence_id: account.sequence_bank_journal |
864 | 59 | default_debit_account_id: account.cash | 71 | default_debit_account_id: account_cash_eur_id |
865 | 60 | default_credit_account_id: account.cash | 72 | default_credit_account_id: account_cash_eur_id |
866 | 61 | company_id: base.main_company | 73 | currency: base.EUR |
867 | 62 | - | 74 | company_id: base.main_company |
868 | 63 | I create a bank journal with USD as currency | 75 | - |
869 | 64 | - | 76 | I create the first invoice on 1st January for 200 EUR |
852 | 65 | !record {model: account.journal, id: bank_journal_USD}: | ||
853 | 66 | name: Bank Journal(USD) | ||
854 | 67 | code: BUSD | ||
855 | 68 | type: bank | ||
856 | 69 | analytic_journal_id: account.sit | ||
857 | 70 | sequence_id: account.sequence_bank_journal | ||
858 | 71 | default_debit_account_id: account_cash_usd_id | ||
859 | 72 | default_credit_account_id: account_cash_usd_id | ||
860 | 73 | currency: base.USD | ||
861 | 74 | company_id: base.main_company | ||
862 | 75 | - | ||
863 | 76 | I create the first invoice on 1st January for 200 USD | ||
870 | 77 | - | 77 | - |
871 | 78 | !record {model: account.invoice, id: account_first_invoice_jan_michal}: | 78 | !record {model: account.invoice, id: account_first_invoice_jan_michal}: |
872 | 79 | account_id: account.a_recv | 79 | account_id: account.a_recv |
873 | 80 | company_id: base.main_company | 80 | company_id: base.main_company |
875 | 81 | currency_id: base.USD | 81 | currency_id: base.EUR |
876 | 82 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 82 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
877 | 83 | period_id: account.period_1 | 83 | period_id: account.period_1 |
878 | 84 | invoice_line: | 84 | invoice_line: |
879 | @@ -96,7 +96,7 @@ | |||
880 | 96 | - | 96 | - |
881 | 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} |
882 | 98 | - | 98 | - |
884 | 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) |
885 | 100 | - | 100 | - |
886 | 101 | !python {model: account.invoice}: | | 101 | !python {model: account.invoice}: | |
887 | 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")) |
888 | @@ -104,14 +104,14 @@ | |||
889 | 104 | move_line_obj = self.pool.get('account.move.line') | 104 | move_line_obj = self.pool.get('account.move.line') |
890 | 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)]) |
891 | 106 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 106 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
893 | 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" |
894 | 108 | - | 108 | - |
896 | 109 | I create the second invoice on 1st February for 100 USD | 109 | I create the second invoice on 1st February for 100 EUR |
897 | 110 | - | 110 | - |
898 | 111 | !record {model: account.invoice, id: account_second_invoice_feb_michal}: | 111 | !record {model: account.invoice, id: account_second_invoice_feb_michal}: |
899 | 112 | account_id: account.a_recv | 112 | account_id: account.a_recv |
900 | 113 | company_id: base.main_company | 113 | company_id: base.main_company |
902 | 114 | currency_id: base.USD | 114 | currency_id: base.EUR |
903 | 115 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" | 115 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" |
904 | 116 | period_id: account.period_2 | 116 | period_id: account.period_2 |
905 | 117 | invoice_line: | 117 | invoice_line: |
906 | @@ -129,7 +129,7 @@ | |||
907 | 129 | - | 129 | - |
908 | 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} |
909 | 131 | - | 131 | - |
911 | 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) |
912 | 133 | - | 133 | - |
913 | 134 | !python {model: account.invoice}: | | 134 | !python {model: account.invoice}: | |
914 | 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")) |
915 | @@ -137,20 +137,20 @@ | |||
916 | 137 | move_line_obj = self.pool.get('account.move.line') | 137 | move_line_obj = self.pool.get('account.move.line') |
917 | 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)]) |
918 | 139 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 139 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
920 | 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" |
921 | 141 | - | 141 | - |
922 | 142 | I set the context that will be used for the encoding of all the vouchers of this file | 142 | I set the context that will be used for the encoding of all the vouchers of this file |
923 | 143 | - | 143 | - |
924 | 144 | !context | 144 | !context |
925 | 145 | 'type': 'receipt' | 145 | 'type': 'receipt' |
926 | 146 | - | 146 | - |
928 | 147 | I create the first voucher of payment with values 200 EUR, journal EUR | 147 | I create the first voucher of payment with values 200 USD, journal USD |
929 | 148 | - | 148 | - |
930 | 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}: |
931 | 150 | account_id: account.cash | 150 | account_id: account.cash |
932 | 151 | amount: 200.0 | 151 | amount: 200.0 |
933 | 152 | company_id: base.main_company | 152 | company_id: base.main_company |
935 | 153 | journal_id: bank_journal_EUR | 153 | journal_id: bank_journal_USD |
936 | 154 | partner_id: base.res_partner_19 | 154 | partner_id: base.res_partner_19 |
937 | 155 | period_id: account.period_3 | 155 | period_id: account.period_3 |
938 | 156 | date: !eval time.strftime("%Y-03-01") | 156 | date: !eval time.strftime("%Y-03-01") |
939 | @@ -193,7 +193,7 @@ | |||
940 | 193 | - | 193 | - |
941 | 194 | I check that my debtor account is correct | 194 | I check that my debtor account is correct |
942 | 195 | - | 195 | - |
944 | 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 70 | 196 | 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 |
945 | 197 | - | 197 | - |
946 | 198 | !python {model: account.voucher}: | | 198 | !python {model: account.voucher}: | |
947 | 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'))]) |
948 | @@ -202,35 +202,35 @@ | |||
949 | 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)]) |
950 | 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): |
951 | 204 | if move_line.credit == 70.0: | 204 | if move_line.credit == 70.0: |
953 | 205 | assert move_line.amount_currency == -77.78, "Wrong debtor entry" | 205 | assert move_line.amount_currency == -42.0, "Wrong debtor entry" |
954 | 206 | if move_line.credit == 130.0: | 206 | if move_line.credit == 130.0: |
955 | 207 | assert move_line.amount_currency == -144.44, "Wrong debtor entry" | 207 | assert move_line.amount_currency == -144.44, "Wrong debtor entry" |
956 | 208 | - | 208 | - |
958 | 209 | I check the residual amount of Invoice1, should be 55.56 in residual currency and 20 in amount_residual | 209 | I check the residual amount of Invoice1, should be 158.0 in residual currency and 180.0 in amount_residual |
959 | 210 | - | 210 | - |
960 | 211 | !python {model: account.invoice}: | | 211 | !python {model: account.invoice}: | |
961 | 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")) |
962 | 213 | move_line_obj = self.pool.get('account.move.line') | 213 | move_line_obj = self.pool.get('account.move.line') |
963 | 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)]) |
964 | 215 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 215 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
966 | 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" |
967 | 217 | - | 217 | - |
969 | 218 | I check the residual amount of Invoice2, should be 22.22 in residual currency and 10 in amount_residual | 218 | I check the residual amount of Invoice2, should be 58.0 in residual currency and 41.11 in amount_residual |
970 | 219 | - | 219 | - |
971 | 220 | !python {model: account.invoice}: | | 220 | !python {model: account.invoice}: | |
972 | 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")) |
973 | 222 | move_line_obj = self.pool.get('account.move.line') | 222 | move_line_obj = self.pool.get('account.move.line') |
974 | 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)]) |
975 | 224 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 224 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
977 | 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" |
978 | 226 | - | 226 | - |
980 | 227 | I create the second voucher of payment with values 80 USD, journal USD | 227 | I create the second voucher of payment with values 80 EUR, journal EUR |
981 | 228 | - | 228 | - |
982 | 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}: |
983 | 230 | account_id: account.cash | 230 | account_id: account.cash |
984 | 231 | amount: 80.0 | 231 | amount: 80.0 |
985 | 232 | company_id: base.main_company | 232 | company_id: base.main_company |
987 | 233 | journal_id: bank_journal_USD | 233 | journal_id: bank_journal_EUR |
988 | 234 | partner_id: base.res_partner_19 | 234 | partner_id: base.res_partner_19 |
989 | 235 | period_id: account.period_3 | 235 | period_id: account.period_3 |
990 | 236 | date: !eval time.strftime("%Y-04-01") | 236 | date: !eval time.strftime("%Y-04-01") |
991 | @@ -247,20 +247,20 @@ | |||
992 | 247 | voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2b')) | 247 | voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2b')) |
993 | 248 | data = [] | 248 | data = [] |
994 | 249 | for item in voucher_id.line_cr_ids: | 249 | for item in voucher_id.line_cr_ids: |
997 | 250 | if item.amount_unreconciled == 55.56: | 250 | if item.amount_unreconciled == 158.0: |
998 | 251 | data += [(item.id, 55.56)] | 251 | data += [(item.id, 158.0)] |
999 | 252 | else: | 252 | else: |
1001 | 253 | data += [(item.id, 22.22)] | 253 | data += [(item.id, 58.0)] |
1002 | 254 | for line_id, amount in data: | 254 | for line_id, amount in data: |
1003 | 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}) |
1004 | 256 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" | 256 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" |
1005 | 257 | - | 257 | - |
1007 | 258 | I check that writeoff amount computed is 2.22 | 258 | I check that writeoff amount computed is -136.0 |
1008 | 259 | - | 259 | - |
1009 | 260 | !python {model: account.voucher}: | | 260 | !python {model: account.voucher}: | |
1010 | 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'))]) |
1011 | 262 | voucher_id = self.browse(cr, uid, voucher[0]) | 262 | voucher_id = self.browse(cr, uid, voucher[0]) |
1013 | 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$" |
1014 | 264 | - | 264 | - |
1015 | 265 | I confirm the voucher | 265 | I confirm the voucher |
1016 | 266 | - | 266 | - |
1017 | 267 | 267 | ||
1018 | === renamed file 'account_voucher/test/case2_usd_eur_debtor_in_eur.yml' => 'account_voucher/test/case2_eur_usd_debtor_in_usd.yml' | |||
1019 | --- account_voucher/test/case2_usd_eur_debtor_in_eur.yml 2013-10-27 12:31:04 +0000 | |||
1020 | +++ account_voucher/test/case2_eur_usd_debtor_in_usd.yml 2014-05-14 12:25:54 +0000 | |||
1021 | @@ -1,6 +1,6 @@ | |||
1022 | 1 | - | 1 | - |
1025 | 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, |
1026 | 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 date | 3 | 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 |
1027 | 4 | - | 4 | - |
1028 | 5 | I set the income and expense currency accounts on the main company | 5 | I set the income and expense currency accounts on the main company |
1029 | 6 | - | 6 | - |
1030 | @@ -18,35 +18,47 @@ | |||
1031 | 18 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) | 18 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) |
1032 | 19 | self.write(cr, uid, ids, {'currency_id': False}) | 19 | self.write(cr, uid, ids, {'currency_id': False}) |
1033 | 20 | - | 20 | - |
1035 | 21 | I create currency USD in OpenERP for January of 1.333333 Rate | 21 | I create currency EUR in OpenERP for January of 0.800000 Rate |
1036 | 22 | - | 22 | - |
1037 | 23 | !python {model: res.currency.rate}: | | 23 | !python {model: res.currency.rate}: | |
1038 | 24 | from datetime import datetime | 24 | from datetime import datetime |
1040 | 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] |
1041 | 26 | date = '%s-01-01' %(datetime.now().year) | 26 | date = '%s-01-01' %(datetime.now().year) |
1042 | 27 | ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)]) | 27 | ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)]) |
1049 | 28 | self.write(cr, uid, ids, {'rate': 1.333333}) | 28 | self.write(cr, uid, ids, {'rate': 0.800000}) |
1050 | 29 | - | 29 | - |
1051 | 30 | I create currency USD in OpenERP for February of 1.250000 Rate | 30 | I create currency EUR in OpenERP for February of 0.900000 Rate |
1052 | 31 | - | 31 | - |
1053 | 32 | !record {model: res.currency.rate, id: feb_usd}: | 32 | !record {model: res.currency.rate, id: feb_eur}: |
1054 | 33 | currency_id: base.USD | 33 | currency_id: base.EUR |
1055 | 34 | name: !eval "'%s-02-01' %(datetime.now().year)" | 34 | name: !eval "'%s-02-01' %(datetime.now().year)" |
1062 | 35 | rate: 1.250000 | 35 | rate: 0.900000 |
1063 | 36 | - | 36 | - |
1064 | 37 | I create currency USD in OpenERP for March of 1.111111 Rate | 37 | I create currency EUR in OpenERP for March of 0.600000 Rate |
1065 | 38 | - | 38 | - |
1066 | 39 | !record {model: res.currency.rate, id: mar_usd}: | 39 | !record {model: res.currency.rate, id: mar_eur}: |
1067 | 40 | currency_id: base.USD | 40 | currency_id: base.EUR |
1068 | 41 | name: !eval "'%s-03-01' %(datetime.now().year)" | 41 | name: !eval "'%s-03-01' %(datetime.now().year)" |
1075 | 42 | rate: 1.111111 | 42 | rate: 0.600000 |
1076 | 43 | - | 43 | - |
1077 | 44 | I create currency USD in OpenERP for April of 1.052632 Rate | 44 | I create currency EUR in OpenERP for April of 0.500000 Rate |
1078 | 45 | - | 45 | - |
1079 | 46 | !record {model: res.currency.rate, id: apr_usd}: | 46 | !record {model: res.currency.rate, id: apr_eur}: |
1080 | 47 | currency_id: base.USD | 47 | currency_id: base.EUR |
1081 | 48 | name: !eval "'%s-04-01' %(datetime.now().year)" | 48 | name: !eval "'%s-04-01' %(datetime.now().year)" |
1083 | 49 | rate: 1.052632 | 49 | rate: 0.500000 |
1084 | 50 | - | ||
1085 | 51 | I create a bank journal with USD as currency | ||
1086 | 52 | - | ||
1087 | 53 | !record {model: account.journal, id: bank_journal_USD}: | ||
1088 | 54 | name: Bank Journal(USD) | ||
1089 | 55 | code: BUSD | ||
1090 | 56 | type: bank | ||
1091 | 57 | analytic_journal_id: account.sit | ||
1092 | 58 | sequence_id: account.sequence_bank_journal | ||
1093 | 59 | default_debit_account_id: account.cash | ||
1094 | 60 | default_credit_account_id: account.cash | ||
1095 | 61 | company_id: base.main_company | ||
1096 | 50 | - | 62 | - |
1097 | 51 | I create a bank journal with EUR as currency | 63 | I create a bank journal with EUR as currency |
1098 | 52 | - | 64 | - |
1099 | @@ -56,29 +68,17 @@ | |||
1100 | 56 | type: bank | 68 | type: bank |
1101 | 57 | analytic_journal_id: account.sit | 69 | analytic_journal_id: account.sit |
1102 | 58 | sequence_id: account.sequence_bank_journal | 70 | sequence_id: account.sequence_bank_journal |
1121 | 59 | default_debit_account_id: account.cash | 71 | default_debit_account_id: account_cash_eur_id |
1122 | 60 | default_credit_account_id: account.cash | 72 | default_credit_account_id: account_cash_eur_id |
1123 | 61 | company_id: base.main_company | 73 | currency: base.EUR |
1124 | 62 | - | 74 | company_id: base.main_company |
1125 | 63 | I create a bank journal with USD as currency | 75 | - |
1126 | 64 | - | 76 | I create the first invoice on 1st January for 200 EUR |
1109 | 65 | !record {model: account.journal, id: bank_journal_USD}: | ||
1110 | 66 | name: Bank Journal(USD) | ||
1111 | 67 | code: BUSD | ||
1112 | 68 | type: bank | ||
1113 | 69 | analytic_journal_id: account.sit | ||
1114 | 70 | sequence_id: account.sequence_bank_journal | ||
1115 | 71 | default_debit_account_id: account_cash_usd_id | ||
1116 | 72 | default_credit_account_id: account_cash_usd_id | ||
1117 | 73 | currency: base.USD | ||
1118 | 74 | company_id: base.main_company | ||
1119 | 75 | - | ||
1120 | 76 | I create the first invoice on 1st January for 200 USD | ||
1127 | 77 | - | 77 | - |
1128 | 78 | !record {model: account.invoice, id: account_first_invoice_jan}: | 78 | !record {model: account.invoice, id: account_first_invoice_jan}: |
1129 | 79 | account_id: account.a_recv | 79 | account_id: account.a_recv |
1130 | 80 | company_id: base.main_company | 80 | company_id: base.main_company |
1132 | 81 | currency_id: base.USD | 81 | currency_id: base.EUR |
1133 | 82 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 82 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
1134 | 83 | period_id: account.period_1 | 83 | period_id: account.period_1 |
1135 | 84 | invoice_line: | 84 | invoice_line: |
1136 | @@ -96,7 +96,7 @@ | |||
1137 | 96 | - | 96 | - |
1138 | 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} |
1139 | 98 | - | 98 | - |
1141 | 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) |
1142 | 100 | - | 100 | - |
1143 | 101 | !python {model: account.invoice}: | | 101 | !python {model: account.invoice}: | |
1144 | 102 | invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan")) | 102 | invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan")) |
1145 | @@ -104,14 +104,14 @@ | |||
1146 | 104 | move_line_obj = self.pool.get('account.move.line') | 104 | move_line_obj = self.pool.get('account.move.line') |
1147 | 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)]) |
1148 | 106 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 106 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1150 | 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" |
1151 | 108 | - | 108 | - |
1153 | 109 | I create the second invoice on 1st February for 100 USD | 109 | I create the second invoice on 1st February for 100 EUR |
1154 | 110 | - | 110 | - |
1155 | 111 | !record {model: account.invoice, id: account_second_invoice_feb}: | 111 | !record {model: account.invoice, id: account_second_invoice_feb}: |
1156 | 112 | account_id: account.a_recv | 112 | account_id: account.a_recv |
1157 | 113 | company_id: base.main_company | 113 | company_id: base.main_company |
1159 | 114 | currency_id: base.USD | 114 | currency_id: base.EUR |
1160 | 115 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" | 115 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" |
1161 | 116 | period_id: account.period_2 | 116 | period_id: account.period_2 |
1162 | 117 | invoice_line: | 117 | invoice_line: |
1163 | @@ -129,7 +129,7 @@ | |||
1164 | 129 | - | 129 | - |
1165 | 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} |
1166 | 131 | - | 131 | - |
1168 | 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) |
1169 | 133 | - | 133 | - |
1170 | 134 | !python {model: account.invoice}: | | 134 | !python {model: account.invoice}: | |
1171 | 135 | invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb")) | 135 | invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb")) |
1172 | @@ -137,7 +137,7 @@ | |||
1173 | 137 | move_line_obj = self.pool.get('account.move.line') | 137 | move_line_obj = self.pool.get('account.move.line') |
1174 | 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)]) |
1175 | 139 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 139 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1177 | 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" |
1178 | 141 | - | 141 | - |
1179 | 142 | I set the context that will be used for the encoding of all the vouchers of this file | 142 | I set the context that will be used for the encoding of all the vouchers of this file |
1180 | 143 | - | 143 | - |
1181 | @@ -150,7 +150,7 @@ | |||
1182 | 150 | account_id: account.cash | 150 | account_id: account.cash |
1183 | 151 | amount: 200.0 | 151 | amount: 200.0 |
1184 | 152 | company_id: base.main_company | 152 | company_id: base.main_company |
1186 | 153 | journal_id: bank_journal_EUR | 153 | journal_id: bank_journal_USD |
1187 | 154 | partner_id: base.res_partner_19 | 154 | partner_id: base.res_partner_19 |
1188 | 155 | period_id: account.period_3 | 155 | period_id: account.period_3 |
1189 | 156 | date: !eval time.strftime("%Y-03-01") | 156 | date: !eval time.strftime("%Y-03-01") |
1190 | @@ -194,31 +194,31 @@ | |||
1191 | 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): |
1192 | 195 | assert move_line.state == 'valid', "Voucher move is not valid" | 195 | assert move_line.state == 'valid', "Voucher move is not valid" |
1193 | 196 | - | 196 | - |
1195 | 197 | I check the residual amount of Invoice1, should be 55.56 in residual currency and 20 in amount_residual | 197 | I check the residual amount of Invoice1, should be 158.0 in residual currency and 180 in amount_residual |
1196 | 198 | - | 198 | - |
1197 | 199 | !python {model: account.invoice}: | | 199 | !python {model: account.invoice}: | |
1198 | 200 | invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan")) | 200 | invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan")) |
1199 | 201 | move_line_obj = self.pool.get('account.move.line') | 201 | move_line_obj = self.pool.get('account.move.line') |
1200 | 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)]) |
1201 | 203 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 203 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1203 | 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) |
1204 | 205 | - | 205 | - |
1206 | 206 | I check the residual amuont of Invoice2, should be 22.22 in residual currency and 10 in amount_residual | 206 | I check the residual amuont of Invoice2, should be 58.0 in residual currency and 41.11 in amount_residual |
1207 | 207 | - | 207 | - |
1208 | 208 | !python {model: account.invoice}: | | 208 | !python {model: account.invoice}: | |
1209 | 209 | invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb")) | 209 | invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb")) |
1210 | 210 | move_line_obj = self.pool.get('account.move.line') | 210 | move_line_obj = self.pool.get('account.move.line') |
1211 | 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)]) |
1212 | 212 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 212 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1214 | 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" |
1215 | 214 | - | 214 | - |
1217 | 215 | I create the second voucher of payment with values 80 USD, journal USD | 215 | I create the second voucher of payment with values 80 EUR, journal EUR |
1218 | 216 | - | 216 | - |
1219 | 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}: |
1220 | 218 | account_id: account.cash | 218 | account_id: account.cash |
1221 | 219 | amount: 80 | 219 | amount: 80 |
1222 | 220 | company_id: base.main_company | 220 | company_id: base.main_company |
1224 | 221 | journal_id: bank_journal_USD | 221 | journal_id: bank_journal_EUR |
1225 | 222 | partner_id: base.res_partner_19 | 222 | partner_id: base.res_partner_19 |
1226 | 223 | period_id: account.period_3 | 223 | period_id: account.period_3 |
1227 | 224 | date: !eval time.strftime("%Y-04-01") | 224 | date: !eval time.strftime("%Y-04-01") |
1228 | @@ -237,20 +237,20 @@ | |||
1229 | 237 | voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2a')) | 237 | voucher_id = self.browse(cr, uid, ref('account_voucher_2_case2a')) |
1230 | 238 | data = [] | 238 | data = [] |
1231 | 239 | for item in voucher_id.line_cr_ids: | 239 | for item in voucher_id.line_cr_ids: |
1234 | 240 | if item.amount_unreconciled == 55.56: | 240 | if item.amount_unreconciled == 158.0: |
1235 | 241 | data += [(item.id, 55.56)] | 241 | data += [(item.id, 158.0)] |
1236 | 242 | else: | 242 | else: |
1238 | 243 | data += [(item.id, 22.22)] | 243 | data += [(item.id, 58.0)] |
1239 | 244 | for line_id, amount in data: | 244 | for line_id, amount in data: |
1240 | 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}) |
1241 | 246 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" | 246 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" |
1242 | 247 | - | 247 | - |
1244 | 248 | I check that writeoff amount computed is 2.22 | 248 | I check that writeoff amount computed is -136.0 |
1245 | 249 | - | 249 | - |
1246 | 250 | !python {model: account.voucher}: | | 250 | !python {model: account.voucher}: | |
1247 | 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'))]) |
1248 | 252 | voucher_id = self.browse(cr, uid, voucher[0]) | 252 | voucher_id = self.browse(cr, uid, voucher[0]) |
1250 | 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$" |
1251 | 254 | - | 254 | - |
1252 | 255 | I confirm the voucher | 255 | I confirm the voucher |
1253 | 256 | - | 256 | - |
1254 | @@ -268,11 +268,11 @@ | |||
1255 | 268 | - | 268 | - |
1256 | 269 | I check that my debtor account is correct | 269 | I check that my debtor account is correct |
1257 | 270 | - | 270 | - |
1259 | 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($). |
1260 | 272 | - | 272 | - |
1261 | 273 | I check that my currency rate difference is correct. | 273 | I check that my currency rate difference is correct. |
1262 | 274 | - | 274 | - |
1264 | 275 | I check that my writeoff is correct. 2.11 in credit and 2.22 in amount_currency | 275 | I check that my writeoff is correct. 2.11 in credit and -136.0 in amount_currency |
1265 | 276 | - | 276 | - |
1266 | 277 | !python {model: account.voucher}: | | 277 | !python {model: account.voucher}: | |
1267 | 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'))]) |
1268 | @@ -307,7 +307,7 @@ | |||
1269 | 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)]) |
1270 | 308 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 308 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1271 | 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" |
1273 | 310 | - | 310 | - |
1274 | 311 | I check the residual amuont of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid | 311 | I check the residual amuont of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid |
1275 | 312 | - | 312 | - |
1276 | 313 | !python {model: account.invoice}: | | 313 | !python {model: account.invoice}: | |
1277 | 314 | 314 | ||
1278 | === renamed file 'account_voucher/test/case2_suppl_usd_eur.yml' => 'account_voucher/test/case2_suppl_eur_usd.yml' | |||
1279 | --- account_voucher/test/case2_suppl_usd_eur.yml 2013-10-27 12:31:04 +0000 | |||
1280 | +++ account_voucher/test/case2_suppl_eur_usd.yml 2014-05-14 12:25:54 +0000 | |||
1281 | @@ -21,7 +21,7 @@ | |||
1282 | 21 | sequence_id: account.sequence_bank_journal | 21 | sequence_id: account.sequence_bank_journal |
1283 | 22 | default_debit_account_id: account.cash | 22 | default_debit_account_id: account.cash |
1284 | 23 | default_credit_account_id: account.cash | 23 | default_credit_account_id: account.cash |
1286 | 24 | currency: base.EUR | 24 | currency: base.USD |
1287 | 25 | company_id: base.main_company | 25 | company_id: base.main_company |
1288 | 26 | - | 26 | - |
1289 | 27 | I create a bank journal with USD as currency | 27 | I create a bank journal with USD as currency |
1290 | 28 | 28 | ||
1291 | === renamed file 'account_voucher/test/case3_eur_eur.yml' => 'account_voucher/test/case3_usd_usd.yml' | |||
1292 | --- account_voucher/test/case3_eur_eur.yml 2013-10-27 12:31:04 +0000 | |||
1293 | +++ account_voucher/test/case3_usd_usd.yml 2014-05-14 12:25:54 +0000 | |||
1294 | @@ -1,11 +1,11 @@ | |||
1295 | 1 | - | 1 | - |
1303 | 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, |
1304 | 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. |
1305 | 4 | - | 4 | - |
1306 | 5 | I create currency EUR in OpenERP for January of 1.000000 Rate | 5 | I create currency USD in OpenERP for January of 1.000000 Rate |
1307 | 6 | - | 6 | - |
1308 | 7 | !record {model: res.currency.rate, id: jan_eur}: | 7 | !record {model: res.currency.rate, id: jan_USD}: |
1309 | 8 | currency_id: base.EUR | 8 | currency_id: base.USD |
1310 | 9 | name: !eval "'%s-01-01' %(datetime.now().year)" | 9 | name: !eval "'%s-01-01' %(datetime.now().year)" |
1311 | 10 | rate: 1.000000 | 10 | rate: 1.000000 |
1312 | 11 | - | 11 | - |
1313 | @@ -16,11 +16,11 @@ | |||
1314 | 16 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) | 16 | ids = self.search(cr, uid, [('name', 'ilike', 'debtor')]) |
1315 | 17 | self.write(cr, uid, ids, {'currency_id': False}) | 17 | self.write(cr, uid, ids, {'currency_id': False}) |
1316 | 18 | - | 18 | - |
1318 | 19 | I create a bank journal with EUR as currency | 19 | I create a bank journal with USD as currency |
1319 | 20 | - | 20 | - |
1323 | 21 | !record {model: account.journal, id: bank_journal_EUR}: | 21 | !record {model: account.journal, id: bank_journal_USD}: |
1324 | 22 | name: Bank Journal(EUR) | 22 | name: Bank Journal(USD) |
1325 | 23 | code: BEUR | 23 | code: BUSD |
1326 | 24 | type: bank | 24 | type: bank |
1327 | 25 | analytic_journal_id: account.sit | 25 | analytic_journal_id: account.sit |
1328 | 26 | sequence_id: account.sequence_bank_journal | 26 | sequence_id: account.sequence_bank_journal |
1329 | @@ -28,12 +28,12 @@ | |||
1330 | 28 | default_credit_account_id: account.cash | 28 | default_credit_account_id: account.cash |
1331 | 29 | company_id: base.main_company | 29 | company_id: base.main_company |
1332 | 30 | - | 30 | - |
1334 | 31 | I create the first invoice on 1st January for 150 EUR | 31 | I create the first invoice on 1st January for 150 USD |
1335 | 32 | - | 32 | - |
1336 | 33 | !record {model: account.invoice, id: account_first_invoice_jan_eur}: | 33 | !record {model: account.invoice, id: account_first_invoice_jan_eur}: |
1337 | 34 | account_id: account.a_recv | 34 | account_id: account.a_recv |
1338 | 35 | company_id: base.main_company | 35 | company_id: base.main_company |
1340 | 36 | currency_id: base.EUR | 36 | currency_id: base.USD |
1341 | 37 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 37 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
1342 | 38 | period_id: account.period_1 | 38 | period_id: account.period_1 |
1343 | 39 | invoice_line: | 39 | invoice_line: |
1344 | @@ -61,12 +61,12 @@ | |||
1345 | 61 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 61 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1346 | 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" |
1347 | 63 | - | 63 | - |
1349 | 64 | I create the second invoice on 1st February for 80 EUR | 64 | I create the second invoice on 1st February for 80 USD |
1350 | 65 | - | 65 | - |
1351 | 66 | !record {model: account.invoice, id: account_second_invoice_feb_eur}: | 66 | !record {model: account.invoice, id: account_second_invoice_feb_eur}: |
1352 | 67 | account_id: account.a_recv | 67 | account_id: account.a_recv |
1353 | 68 | company_id: base.main_company | 68 | company_id: base.main_company |
1355 | 69 | currency_id: base.EUR | 69 | currency_id: base.USD |
1356 | 70 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" | 70 | date_invoice: !eval "'%s-02-01' %(datetime.now().year)" |
1357 | 71 | period_id: account.period_1 | 71 | period_id: account.period_1 |
1358 | 72 | invoice_line: | 72 | invoice_line: |
1359 | @@ -105,7 +105,7 @@ | |||
1360 | 105 | account_id: account.cash | 105 | account_id: account.cash |
1361 | 106 | amount: 120.0 | 106 | amount: 120.0 |
1362 | 107 | company_id: base.main_company | 107 | company_id: base.main_company |
1364 | 108 | journal_id: bank_journal_EUR | 108 | journal_id: bank_journal_USD |
1365 | 109 | partner_id: base.res_partner_19 | 109 | partner_id: base.res_partner_19 |
1366 | 110 | period_id: account.period_3 | 110 | period_id: account.period_3 |
1367 | 111 | date: !eval time.strftime("%Y-03-01") | 111 | date: !eval time.strftime("%Y-03-01") |
1368 | @@ -192,7 +192,7 @@ | |||
1369 | 192 | account_id: account.cash | 192 | account_id: account.cash |
1370 | 193 | amount: 120.0 | 193 | amount: 120.0 |
1371 | 194 | company_id: base.main_company | 194 | company_id: base.main_company |
1373 | 195 | journal_id: bank_journal_EUR | 195 | journal_id: bank_journal_USD |
1374 | 196 | partner_id: base.res_partner_19 | 196 | partner_id: base.res_partner_19 |
1375 | 197 | period_id: account.period_3 | 197 | period_id: account.period_3 |
1376 | 198 | date: !eval time.strftime("%Y-04-01") | 198 | date: !eval time.strftime("%Y-04-01") |
1377 | @@ -263,7 +263,7 @@ | |||
1378 | 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)]) |
1379 | 264 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 264 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1380 | 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" |
1382 | 266 | - | 266 | - |
1383 | 267 | I check the residual amuont of Invoice2 is -10 | 267 | I check the residual amuont of Invoice2 is -10 |
1384 | 268 | - | 268 | - |
1385 | 269 | !python {model: account.invoice}: | | 269 | !python {model: account.invoice}: | |
1386 | 270 | 270 | ||
1387 | === modified file 'account_voucher/test/case4_cad_chf.yml' | |||
1388 | --- account_voucher/test/case4_cad_chf.yml 2013-10-27 12:31:04 +0000 | |||
1389 | +++ account_voucher/test/case4_cad_chf.yml 2014-05-14 12:25:54 +0000 | |||
1390 | @@ -11,33 +11,33 @@ | |||
1391 | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} | 11 | 'expense_currency_exchange_account_id': ref('account.o_expense')} |
1392 | 12 | self.write(cr, uid, ref('base.main_company'), vals) | 12 | self.write(cr, uid, ref('base.main_company'), vals) |
1393 | 13 | - | 13 | - |
1395 | 14 | I create currency CAD in OpenERP for January of 1.338800 Rate | 14 | I create currency CAD in OpenERP for January of 1.0431 Rate |
1396 | 15 | - | 15 | - |
1397 | 16 | !record {model: res.currency.rate, id: jan_cad}: | 16 | !record {model: res.currency.rate, id: jan_cad}: |
1398 | 17 | currency_id: base.CAD | 17 | currency_id: base.CAD |
1399 | 18 | name: !eval "'%s-01-01' %(datetime.now().year)" | 18 | name: !eval "'%s-01-01' %(datetime.now().year)" |
1401 | 19 | rate: 1.338800 | 19 | rate: 1.0431 |
1402 | 20 | - | 20 | - |
1404 | 21 | I create currency CAD in OpenERP for March of 2.000000 Rate | 21 | I create currency CAD in OpenERP for March of 1.7043 Rate |
1405 | 22 | - | 22 | - |
1406 | 23 | !record {model: res.currency.rate, id: mar_cad}: | 23 | !record {model: res.currency.rate, id: mar_cad}: |
1407 | 24 | currency_id: base.CAD | 24 | currency_id: base.CAD |
1408 | 25 | name: !eval "'%s-03-01' %(datetime.now().year)" | 25 | name: !eval "'%s-03-01' %(datetime.now().year)" |
1410 | 26 | rate: 2.000000 | 26 | rate: 1.7043 |
1411 | 27 | - | 27 | - |
1413 | 28 | I create currency CHF in OpenERP for January of 1.308600 Rate | 28 | I create currency CHF in OpenERP for January of 1.0196 Rate |
1414 | 29 | - | 29 | - |
1415 | 30 | !record {model: res.currency.rate, id: jan_chf}: | 30 | !record {model: res.currency.rate, id: jan_chf}: |
1416 | 31 | currency_id: base.CHF | 31 | currency_id: base.CHF |
1417 | 32 | name: !eval "'%s-01-01' %(datetime.now().year)" | 32 | name: !eval "'%s-01-01' %(datetime.now().year)" |
1419 | 33 | rate: 1.308600 | 33 | rate: 1.0196 |
1420 | 34 | - | 34 | - |
1422 | 35 | I create currency CHF in OpenERP for March of 1.250000 Rate | 35 | I create currency CHF in OpenERP for March of 0.961 Rate |
1423 | 36 | - | 36 | - |
1424 | 37 | !record {model: res.currency.rate, id: mar_chf}: | 37 | !record {model: res.currency.rate, id: mar_chf}: |
1425 | 38 | currency_id: base.CHF | 38 | currency_id: base.CHF |
1426 | 39 | name: !eval "'%s-03-01' %(datetime.now().year)" | 39 | name: !eval "'%s-03-01' %(datetime.now().year)" |
1428 | 40 | rate: 1.25000 | 40 | rate: 0.961 |
1429 | 41 | - | 41 | - |
1430 | 42 | I create a cash account with currency CHF | 42 | I create a cash account with currency CHF |
1431 | 43 | - | 43 | - |
1432 | @@ -85,7 +85,7 @@ | |||
1433 | 85 | - | 85 | - |
1434 | 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} |
1435 | 87 | - | 87 | - |
1437 | 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) |
1438 | 89 | - | 89 | - |
1439 | 90 | !python {model: account.invoice}: | | 90 | !python {model: account.invoice}: | |
1440 | 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")) |
1441 | @@ -93,7 +93,7 @@ | |||
1442 | 93 | move_line_obj = self.pool.get('account.move.line') | 93 | move_line_obj = self.pool.get('account.move.line') |
1443 | 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)]) |
1444 | 95 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 95 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1446 | 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" |
1447 | 97 | - | 97 | - |
1448 | 98 | I set the context that will be used for the encoding of all the vouchers of this file | 98 | I set the context that will be used for the encoding of all the vouchers of this file |
1449 | 99 | - | 99 | - |
1450 | @@ -124,20 +124,20 @@ | |||
1451 | 124 | voucher_id = self.browse(cr, uid, ref('account_voucher_1_case4')) | 124 | voucher_id = self.browse(cr, uid, ref('account_voucher_1_case4')) |
1452 | 125 | data = [] | 125 | data = [] |
1453 | 126 | for item in voucher_id.line_cr_ids: | 126 | for item in voucher_id.line_cr_ids: |
1456 | 127 | if item.amount_unreconciled == 186.74: | 127 | if item.amount_unreconciled == 184.26: |
1457 | 128 | data += [(item.id, 186.74)] | 128 | data += [(item.id, 184.26)] |
1458 | 129 | else: | 129 | else: |
1459 | 130 | data += [(item.id, 0.0)] | 130 | data += [(item.id, 0.0)] |
1460 | 131 | for line_id, amount in data: | 131 | for line_id, amount in data: |
1461 | 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}) |
1462 | 133 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" | 133 | assert (voucher_id.state=='draft'), "Voucher is not in draft state" |
1463 | 134 | - | 134 | - |
1465 | 135 | I check that writeoff amount computed is 13.26 | 135 | I check that writeoff amount computed is 15.74 |
1466 | 136 | - | 136 | - |
1467 | 137 | !python {model: account.voucher}: | | 137 | !python {model: account.voucher}: | |
1468 | 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'))]) |
1469 | 139 | voucher_id = self.browse(cr, uid, voucher[0]) | 139 | voucher_id = self.browse(cr, uid, voucher[0]) |
1471 | 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" |
1472 | 141 | - | 141 | - |
1473 | 142 | I confirm the voucher | 142 | I confirm the voucher |
1474 | 143 | - | 143 | - |
1475 | @@ -163,7 +163,7 @@ | |||
1476 | 163 | - | 163 | - |
1477 | 164 | I check that my currency rate difference is correct. 0 in debit with 98.78 CAD as amount_currency | 164 | I check that my currency rate difference is correct. 0 in debit with 98.78 CAD as amount_currency |
1478 | 165 | - | 165 | - |
1480 | 166 | I check that my writeoff is correct. 11.05 credit and -13.26 amount_currency | 166 | I check that my writeoff is correct. 11.05 credit and -15.74 amount_currency |
1481 | 167 | - | 167 | - |
1482 | 168 | !python {model: account.voucher}: | | 168 | !python {model: account.voucher}: | |
1483 | 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'))]) |
1484 | @@ -171,15 +171,15 @@ | |||
1485 | 171 | move_line_obj = self.pool.get('account.move.line') | 171 | move_line_obj = self.pool.get('account.move.line') |
1486 | 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)]) |
1487 | 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): |
1492 | 174 | if move_line.amount_currency == 200: | 174 | if move_line.amount_currency == 200.0: |
1493 | 175 | assert move_line.debit == 160.00, "Bank account has wrong entry." | 175 | assert move_line.debit == 208.12, "Bank account has wrong entry." |
1494 | 176 | elif move_line.amount_currency == -298.78: | 176 | elif move_line.amount_currency == -326.78: |
1495 | 177 | assert move_line.credit == 149.39, "Debtor account has wrong entry." | 177 | assert move_line.credit == 191.74, "Debtor account has wrong entry." |
1496 | 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: |
1498 | 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) |
1499 | 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) |
1502 | 181 | elif move_line.credit == 10.61: | 181 | elif move_line.credit == 16.38: |
1503 | 182 | assert move_line.amount_currency == -13.26, "Writeoff amount is wrong." | 182 | assert move_line.amount_currency == -15.74, "Writeoff amount is wrong." |
1504 | 183 | else: | 183 | else: |
1505 | 184 | assert False, "Wrong entry" | 184 | assert False, "Wrong entry" |
1506 | 185 | - | 185 | - |
1507 | 186 | 186 | ||
1508 | === modified file 'account_voucher/test/case5_suppl_usd_usd.yml' | |||
1509 | --- account_voucher/test/case5_suppl_usd_usd.yml 2013-10-27 12:31:04 +0000 | |||
1510 | +++ account_voucher/test/case5_suppl_usd_usd.yml 2014-05-14 12:25:54 +0000 | |||
1511 | @@ -1,30 +1,30 @@ | |||
1512 | 1 | - | 1 | - |
1515 | 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, |
1516 | 3 | I create a supplier invoices in USD and make the payment in USD but with another exchange rate and with a write-off | 3 | I create a supplier invoices in EUR and make the payment in EUR but with another exchange rate and with a write-off |
1517 | 4 | - | 4 | - |
1518 | 5 | I create a cash account with currency USD | 5 | I create a cash account with currency USD |
1519 | 6 | - | 6 | - |
1524 | 7 | !record {model: account.account, id: account_cash_usd_id2}: | 7 | !record {model: account.account, id: account_cash_eur_id2}: |
1525 | 8 | currency_id: base.USD | 8 | currency_id: base.EUR |
1526 | 9 | name: "cash account in usd" | 9 | name: "cash account in eur" |
1527 | 10 | code: "Xcash usd2" | 10 | code: "Xcash eur2" |
1528 | 11 | type: 'liquidity' | 11 | type: 'liquidity' |
1529 | 12 | user_type: "account.data_account_type_cash" | 12 | user_type: "account.data_account_type_cash" |
1530 | 13 | 13 | ||
1531 | 14 | - | 14 | - |
1533 | 15 | I create currency USD in OpenERP for November of 1.8 Rate | 15 | I create currency EUR in OpenERP for November of 0.9 Rate |
1534 | 16 | - | 16 | - |
1537 | 17 | !record {model: res.currency.rate, id: nov_usd}: | 17 | !record {model: res.currency.rate, id: nov_eur}: |
1538 | 18 | currency_id: base.USD | 18 | currency_id: base.EUR |
1539 | 19 | name: !eval "'%s-11-01' %(datetime.now().year)" | 19 | name: !eval "'%s-11-01' %(datetime.now().year)" |
1546 | 20 | rate: 1.8 | 20 | rate: 0.9 |
1547 | 21 | - | 21 | - |
1548 | 22 | I create currency USD in OpenERP for December of 1.5 Rate | 22 | I create currency EUR in OpenERP for December of 0.8 Rate |
1549 | 23 | - | 23 | - |
1550 | 24 | !record {model: res.currency.rate, id: dec_usd}: | 24 | !record {model: res.currency.rate, id: dec_eur}: |
1551 | 25 | currency_id: base.USD | 25 | currency_id: base.EUR |
1552 | 26 | name: !eval "'%s-12-01' %(datetime.now().year)" | 26 | name: !eval "'%s-12-01' %(datetime.now().year)" |
1554 | 27 | rate: 1.5 | 27 | rate: 0.8 |
1555 | 28 | - | 28 | - |
1556 | 29 | I set the income and expense currency accounts on the main company | 29 | I set the income and expense currency accounts on the main company |
1557 | 30 | - | 30 | - |
1558 | @@ -35,7 +35,19 @@ | |||
1559 | 35 | 'expense_currency_exchange_account_id': ref('account.o_expense')} | 35 | 'expense_currency_exchange_account_id': ref('account.o_expense')} |
1560 | 36 | self.write(cr, uid, ref('base.main_company'), vals) | 36 | self.write(cr, uid, ref('base.main_company'), vals) |
1561 | 37 | - | 37 | - |
1563 | 38 | I create a bank journal with EUR as currency | 38 | I create a bank journal with USD as currency |
1564 | 39 | - | ||
1565 | 40 | !record {model: account.journal, id: bank_journal_USD}: | ||
1566 | 41 | name: Bank Journal(USD) | ||
1567 | 42 | code: BUSD | ||
1568 | 43 | type: bank | ||
1569 | 44 | analytic_journal_id: account.sit | ||
1570 | 45 | sequence_id: account.sequence_bank_journal | ||
1571 | 46 | default_debit_account_id: account.cash | ||
1572 | 47 | default_credit_account_id: account.cash | ||
1573 | 48 | company_id: base.main_company | ||
1574 | 49 | - | ||
1575 | 50 | I create a bank journal with USD as currency | ||
1576 | 39 | - | 51 | - |
1577 | 40 | !record {model: account.journal, id: bank_journal_EUR}: | 52 | !record {model: account.journal, id: bank_journal_EUR}: |
1578 | 41 | name: Bank Journal(EUR) | 53 | name: Bank Journal(EUR) |
1579 | @@ -43,21 +55,9 @@ | |||
1580 | 43 | type: bank | 55 | type: bank |
1581 | 44 | analytic_journal_id: account.sit | 56 | analytic_journal_id: account.sit |
1582 | 45 | sequence_id: account.sequence_bank_journal | 57 | sequence_id: account.sequence_bank_journal |
1598 | 46 | default_debit_account_id: account.cash | 58 | default_debit_account_id: account_cash_eur_id2 |
1599 | 47 | default_credit_account_id: account.cash | 59 | default_credit_account_id: account_cash_eur_id2 |
1600 | 48 | company_id: base.main_company | 60 | currency: base.EUR |
1586 | 49 | - | ||
1587 | 50 | I create a bank journal with USD as currency | ||
1588 | 51 | - | ||
1589 | 52 | !record {model: account.journal, id: bank_journal_USD}: | ||
1590 | 53 | name: Bank Journal(USD) | ||
1591 | 54 | code: BUSD | ||
1592 | 55 | type: bank | ||
1593 | 56 | analytic_journal_id: account.sit | ||
1594 | 57 | sequence_id: account.sequence_bank_journal | ||
1595 | 58 | default_debit_account_id: account_cash_usd_id2 | ||
1596 | 59 | default_credit_account_id: account_cash_usd_id2 | ||
1597 | 60 | currency: base.USD | ||
1601 | 61 | company_id: base.main_company | 61 | company_id: base.main_company |
1602 | 62 | - | 62 | - |
1603 | 63 | I set the context as would do the action in supplier invoice menuitem | 63 | I set the context as would do the action in supplier invoice menuitem |
1604 | @@ -65,12 +65,12 @@ | |||
1605 | 65 | !context | 65 | !context |
1606 | 66 | 'default_type': 'in_invoice' | 66 | 'default_type': 'in_invoice' |
1607 | 67 | - | 67 | - |
1609 | 68 | I create the invoice on 1st november for 1000 USD | 68 | I create the invoice on 1st november for 1000 EUR |
1610 | 69 | - | 69 | - |
1611 | 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}: |
1612 | 71 | account_id: account.a_pay | 71 | account_id: account.a_pay |
1613 | 72 | company_id: base.main_company | 72 | company_id: base.main_company |
1615 | 73 | currency_id: base.USD | 73 | currency_id: base.EUR |
1616 | 74 | date_invoice: !eval "'%s-11-01' %(datetime.now().year)" | 74 | date_invoice: !eval "'%s-11-01' %(datetime.now().year)" |
1617 | 75 | period_id: account.period_1 | 75 | period_id: account.period_1 |
1618 | 76 | invoice_line: | 76 | invoice_line: |
1619 | @@ -89,7 +89,7 @@ | |||
1620 | 89 | - | 89 | - |
1621 | 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} |
1622 | 91 | - | 91 | - |
1624 | 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) |
1625 | 93 | - | 93 | - |
1626 | 94 | !python {model: account.invoice}: | | 94 | !python {model: account.invoice}: | |
1627 | 95 | invoice_id = self.browse(cr, uid, ref("account_supplier_invoice_november")) | 95 | invoice_id = self.browse(cr, uid, ref("account_supplier_invoice_november")) |
1628 | @@ -97,7 +97,7 @@ | |||
1629 | 97 | move_line_obj = self.pool.get('account.move.line') | 97 | move_line_obj = self.pool.get('account.move.line') |
1630 | 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)]) |
1631 | 99 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) | 99 | move_line = move_line_obj.browse(cr, uid, move_lines[0]) |
1633 | 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" |
1634 | 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" |
1635 | 102 | - | 102 | - |
1636 | 103 | I set the context that will be used for the encoding of all the vouchers of this file | 103 | I set the context that will be used for the encoding of all the vouchers of this file |
1637 | @@ -105,13 +105,13 @@ | |||
1638 | 105 | !context | 105 | !context |
1639 | 106 | 'type': 'payment' | 106 | 'type': 'payment' |
1640 | 107 | - | 107 | - |
1642 | 108 | I create the voucher of payment with values $950, journal USD | 108 | I create the voucher of payment with values $950, journal EUR |
1643 | 109 | - | 109 | - |
1644 | 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}: |
1645 | 111 | account_id: account.cash | 111 | account_id: account.cash |
1646 | 112 | amount: 950.0 | 112 | amount: 950.0 |
1647 | 113 | company_id: base.main_company | 113 | company_id: base.main_company |
1649 | 114 | journal_id: bank_journal_USD | 114 | journal_id: bank_journal_EUR |
1650 | 115 | name: 'Payment: Case Basic SUPPLIER USD/USD' | 115 | name: 'Payment: Case Basic SUPPLIER USD/USD' |
1651 | 116 | partner_id: base.res_partner_19 | 116 | partner_id: base.res_partner_19 |
1652 | 117 | period_id: account.period_12 | 117 | period_id: account.period_12 |
1653 | @@ -151,24 +151,24 @@ | |||
1654 | 151 | - | 151 | - |
1655 | 152 | I check that my creditor account is correct | 152 | I check that my creditor account is correct |
1656 | 153 | - | 153 | - |
1664 | 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. |
1665 | 155 | - | 155 | - |
1666 | 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. |
1667 | 157 | - | 157 | - |
1668 | 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) |
1669 | 159 | - | 159 | - |
1670 | 160 | I check that my writeoff is correct. 33.34€ in credit with -$50 as amount currency | 160 | I check that my writeoff is correct. 62.5€ in credit with -$50 as amount currency |
1671 | 161 | - | 161 | - |
1672 | 162 | !python {model: account.voucher}: | | 162 | !python {model: account.voucher}: | |
1673 | 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')) |
1674 | 164 | for move_line in voucher_id.move_id.line_id: | 164 | for move_line in voucher_id.move_id.line_id: |
1675 | 165 | if move_line.amount_currency == -950.00: | 165 | if move_line.amount_currency == -950.00: |
1678 | 166 | assert move_line.credit == 633.33, "Wrong bank entry." | 166 | assert move_line.credit == 1187.5, "Wrong bank entry." |
1679 | 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: |
1680 | 168 | assert move_line.amount_currency == 0.00, "Incorrect Currency Difference." | 168 | assert move_line.amount_currency == 0.00, "Incorrect Currency Difference." |
1682 | 169 | elif move_line.credit == 33.34: | 169 | elif move_line.credit == 62.5: |
1683 | 170 | assert move_line.amount_currency == -50.0, "Writeoff amount is wrong." | 170 | assert move_line.amount_currency == -50.0, "Writeoff amount is wrong." |
1685 | 171 | elif move_line.debit == 666.67: | 171 | elif move_line.debit == 1250.0: |
1686 | 172 | assert move_line.amount_currency == 1000.0, "Wrong supplier entry." | 172 | assert move_line.amount_currency == 1000.0, "Wrong supplier entry." |
1687 | 173 | else: | 173 | else: |
1688 | 174 | assert False, "Wrong entry. Unrecognized account move line" | 174 | assert False, "Wrong entry. Unrecognized account move line" |
1689 | 175 | 175 | ||
1690 | === renamed file 'account_voucher/test/case_eur_usd.yml' => 'account_voucher/test/case_usd_eur.yml' | |||
1691 | --- account_voucher/test/case_eur_usd.yml 2013-10-27 12:31:04 +0000 | |||
1692 | +++ account_voucher/test/case_usd_eur.yml 2014-05-14 12:25:54 +0000 | |||
1693 | @@ -5,45 +5,45 @@ | |||
1694 | 5 | !context | 5 | !context |
1695 | 6 | uid: 'res_users_account_voucher_manager' | 6 | uid: 'res_users_account_voucher_manager' |
1696 | 7 | - | 7 | - |
1699 | 8 | In order to check the payment with multi-currency in OpenERP, | 8 | In order to check the payment with multi-currency in OpenERP, |
1700 | 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. |
1701 | 10 | - | 10 | - |
1703 | 11 | I update the Currency USD in OpenERP for January with rate 1.200000 | 11 | I update the Currency EUR in OpenERP for January with rate 1.400000 |
1704 | 12 | - | 12 | - |
1705 | 13 | !python {model: res.currency.rate}: | | 13 | !python {model: res.currency.rate}: | |
1706 | 14 | from datetime import datetime | 14 | from datetime import datetime |
1708 | 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] |
1709 | 16 | date = '%s-01-01' %(datetime.now().year) | 16 | date = '%s-01-01' %(datetime.now().year) |
1710 | 17 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) | 17 | ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)]) |
1717 | 18 | self.write(cr, uid, ids, {'rate': 1.200000}) | 18 | self.write(cr, uid, ids, {'rate': 1.400000}) |
1718 | 19 | - | 19 | - |
1719 | 20 | I update the Currency USD in OpenERP for February with rate 1.400000 | 20 | I update the Currency EUR in OpenERP for February with rate 1.600000 |
1720 | 21 | - | 21 | - |
1721 | 22 | !record {model: res.currency.rate, id: feb_usd}: | 22 | !record {model: res.currency.rate, id: feb_eur}: |
1722 | 23 | currency_id: base.USD | 23 | currency_id: base.EUR |
1723 | 24 | name: !eval "'%s-02-01' %(datetime.now().year)" | 24 | name: !eval "'%s-02-01' %(datetime.now().year)" |
1732 | 25 | rate: 1.400000 | 25 | rate: 1.600000 |
1733 | 26 | - | 26 | - |
1734 | 27 | I create a bank account with USD as currency | 27 | I create a bank account with EUR as currency |
1735 | 28 | - | 28 | - |
1736 | 29 | !record {model: account.account, id: account_eur_usd_id}: | 29 | !record {model: account.account, id: account_usd_eur_id}: |
1737 | 30 | currency_id: base.USD | 30 | currency_id: base.EUR |
1738 | 31 | name: "Bank usd" | 31 | name: "Bank eur" |
1739 | 32 | code: "BUSD" | 32 | code: "BEUR" |
1740 | 33 | type: 'liquidity' | 33 | type: 'liquidity' |
1741 | 34 | user_type: account.data_account_type_asset | 34 | user_type: account.data_account_type_asset |
1742 | 35 | - | 35 | - |
1744 | 36 | I create a bank journal with USD as currency | 36 | I create a bank journal with EUR as currency |
1745 | 37 | - | 37 | - |
1749 | 38 | !record {model: account.journal, id: bank_journal_USD1}: | 38 | !record {model: account.journal, id: bank_journal_EUR1}: |
1750 | 39 | name: Bank Journal Test(USD) | 39 | name: Bank Journal Test(EUR) |
1751 | 40 | code: BEUSD | 40 | code: BEEUR |
1752 | 41 | type: bank | 41 | type: bank |
1753 | 42 | analytic_journal_id: account.sit | 42 | analytic_journal_id: account.sit |
1754 | 43 | sequence_id: account.sequence_bank_journal | 43 | sequence_id: account.sequence_bank_journal |
1758 | 44 | default_debit_account_id: account_eur_usd_id | 44 | default_debit_account_id: account_usd_eur_id |
1759 | 45 | default_credit_account_id: account_eur_usd_id | 45 | default_credit_account_id: account_usd_eur_id |
1760 | 46 | currency: base.USD | 46 | currency: base.EUR |
1761 | 47 | company_id: base.main_company | 47 | company_id: base.main_company |
1762 | 48 | - | 48 | - |
1763 | 49 | On the first of January, I create an invoice of 1000€ | 49 | On the first of January, I create an invoice of 1000€ |
1764 | @@ -51,7 +51,7 @@ | |||
1765 | 51 | !record {model: account.invoice, id: account_invoice_eur_usd}: | 51 | !record {model: account.invoice, id: account_invoice_eur_usd}: |
1766 | 52 | account_id: account.a_recv | 52 | account_id: account.a_recv |
1767 | 53 | company_id: base.main_company | 53 | company_id: base.main_company |
1769 | 54 | currency_id: base.EUR | 54 | currency_id: base.USD |
1770 | 55 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" | 55 | date_invoice: !eval "'%s-01-01' %(datetime.now().year)" |
1771 | 56 | period_id: account.period_1 | 56 | period_id: account.period_1 |
1772 | 57 | invoice_line: | 57 | invoice_line: |
1773 | @@ -90,7 +90,7 @@ | |||
1774 | 90 | account_id: account.cash | 90 | account_id: account.cash |
1775 | 91 | amount: 1350.0 | 91 | amount: 1350.0 |
1776 | 92 | company_id: base.main_company | 92 | company_id: base.main_company |
1778 | 93 | journal_id: bank_journal_USD1 | 93 | journal_id: bank_journal_EUR1 |
1779 | 94 | name: 'payment: Case EUR/USD' | 94 | name: 'payment: Case EUR/USD' |
1780 | 95 | partner_id: base.res_partner_19 | 95 | partner_id: base.res_partner_19 |
1781 | 96 | period_id: account.period_5 | 96 | period_id: account.period_5 |
1782 | @@ -105,17 +105,17 @@ | |||
1783 | 105 | data = [] | 105 | data = [] |
1784 | 106 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) | 106 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) |
1785 | 107 | for item in voucher.line_cr_ids: | 107 | for item in voucher.line_cr_ids: |
1788 | 108 | if item.amount_unreconciled == 1400: | 108 | if item.amount_unreconciled == 1600: |
1789 | 109 | data += [(item.id, 1400)] | 109 | data += [(item.id, 1600)] |
1790 | 110 | for line_id, amount in data: | 110 | for line_id, amount in data: |
1791 | 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}) |
1792 | 112 | assert (voucher.state=='draft'), "Voucher is not in draft state" | 112 | assert (voucher.state=='draft'), "Voucher is not in draft state" |
1793 | 113 | - | 113 | - |
1795 | 114 | I check that writeoff amount computed is -50.0 | 114 | I check that writeoff amount computed is -250.0 |
1796 | 115 | - | 115 | - |
1797 | 116 | !python {model: account.voucher}: | | 116 | !python {model: account.voucher}: | |
1798 | 117 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) | 117 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) |
1800 | 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" |
1801 | 119 | - | 119 | - |
1802 | 120 | I confirm the voucher | 120 | I confirm the voucher |
1803 | 121 | - | 121 | - |
1804 | @@ -150,9 +150,9 @@ | |||
1805 | 150 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) | 150 | voucher = self.browse(cr, uid, ref('account_voucher_eur_usd_case')) |
1806 | 151 | for move_line in voucher.move_ids: | 151 | for move_line in voucher.move_ids: |
1807 | 152 | if move_line.amount_currency == 1350: | 152 | if move_line.amount_currency == 1350: |
1811 | 153 | assert move_line.debit == 964.29,"debtor account is not correct" | 153 | assert move_line.debit == 843.75,"debtor account is not correct" |
1812 | 154 | if move_line.amount_currency == 50: | 154 | if move_line.amount_currency == 250.0: |
1813 | 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" |
1814 | 156 | if move_line.amount_currency == 0.0: | 156 | if move_line.amount_currency == 0.0: |
1815 | 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" |
1816 | 158 | - | 158 | - |
1817 | 159 | 159 | ||
1818 | === modified file 'account_voucher/test/sales_payment.yml' | |||
1819 | --- account_voucher/test/sales_payment.yml 2014-04-24 12:35:38 +0000 | |||
1820 | +++ account_voucher/test/sales_payment.yml 2014-05-14 12:25:54 +0000 | |||
1821 | @@ -9,7 +9,7 @@ | |||
1822 | 9 | !record {model: account.invoice, id: account_invoice_0}: | 9 | !record {model: account.invoice, id: account_invoice_0}: |
1823 | 10 | account_id: account.a_recv | 10 | account_id: account.a_recv |
1824 | 11 | company_id: base.main_company | 11 | company_id: base.main_company |
1826 | 12 | currency_id: base.EUR | 12 | currency_id: base.USD |
1827 | 13 | invoice_line: | 13 | invoice_line: |
1828 | 14 | - account_id: account.a_sale | 14 | - account_id: account.a_sale |
1829 | 15 | name: '[PCSC234] PC Assemble SC234' | 15 | name: '[PCSC234] PC Assemble SC234' |
1830 | @@ -44,7 +44,7 @@ | |||
1831 | 44 | !python {model: account.voucher}: | | 44 | !python {model: account.voucher}: | |
1832 | 45 | vals = {} | 45 | vals = {} |
1833 | 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) |
1835 | 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) |
1836 | 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" |
1837 | 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) |
1838 | 50 | vals = { | 50 | vals = { |
1839 | 51 | 51 | ||
1840 | === modified file 'multi_company/multi_company_demo.xml' | |||
1841 | --- multi_company/multi_company_demo.xml 2014-05-07 18:29:17 +0000 | |||
1842 | +++ multi_company/multi_company_demo.xml 2014-05-14 12:25:54 +0000 | |||
1843 | @@ -53,7 +53,7 @@ | |||
1844 | 53 | <record id="res_company_oerp_editor" model="res.company"> | 53 | <record id="res_company_oerp_editor" model="res.company"> |
1845 | 54 | <field name="partner_id" ref="res_partner_oerp_editor"/> | 54 | <field name="partner_id" ref="res_partner_oerp_editor"/> |
1846 | 55 | <field name="parent_id" ref="base.main_company"/> | 55 | <field name="parent_id" ref="base.main_company"/> |
1848 | 56 | <field name="currency_id" ref="base.EUR"/> | 56 | <field name="currency_id" ref="base.USD"/> |
1849 | 57 | <field name="name">OpenERP Editor</field> | 57 | <field name="name">OpenERP Editor</field> |
1850 | 58 | </record> | 58 | </record> |
1851 | 59 | <record id="res_company_oerp_us" model="res.company"> | 59 | <record id="res_company_oerp_us" model="res.company"> |
1852 | @@ -71,13 +71,13 @@ | |||
1853 | 71 | <record id="res_company_oerp_in" model="res.company"> | 71 | <record id="res_company_oerp_in" model="res.company"> |
1854 | 72 | <field name="partner_id" ref="res_partner_oerp_in"/> | 72 | <field name="partner_id" ref="res_partner_oerp_in"/> |
1855 | 73 | <field name="parent_id" ref="res_company_oerp_editor"/> | 73 | <field name="parent_id" ref="res_company_oerp_editor"/> |
1857 | 74 | <field name="currency_id" ref="base.EUR"/> | 74 | <field name="currency_id" ref="base.INR"/> |
1858 | 75 | <field name="name">OpenERP IN</field> | 75 | <field name="name">OpenERP IN</field> |
1859 | 76 | </record> | 76 | </record> |
1860 | 77 | <record id="res_company_odoo" model="res.company"> | 77 | <record id="res_company_odoo" model="res.company"> |
1861 | 78 | <field name="partner_id" ref="res_partner_odoo"/> | 78 | <field name="partner_id" ref="res_partner_odoo"/> |
1862 | 79 | <field name="parent_id" ref="base.main_company"/> | 79 | <field name="parent_id" ref="base.main_company"/> |
1864 | 80 | <field name="currency_id" ref="base.EUR"/> | 80 | <field name="currency_id" ref="base.USD"/> |
1865 | 81 | <field name="name">Odoo</field> | 81 | <field name="name">Odoo</field> |
1866 | 82 | </record> | 82 | </record> |
1867 | 83 | 83 | ||
1868 | @@ -407,7 +407,7 @@ | |||
1869 | 407 | </record> | 407 | </record> |
1870 | 408 | <record id="project.project_project_5" model="project.project"> | 408 | <record id="project.project_project_5" model="project.project"> |
1871 | 409 | <field name="company_id" ref="res_company_oerp_in"/> | 409 | <field name="company_id" ref="res_company_oerp_in"/> |
1873 | 410 | <field name="currency_id" ref="base.EUR"/> | 410 | <field name="currency_id" ref="base.INR"/> |
1874 | 411 | </record> | 411 | </record> |
1875 | 412 | 412 | ||
1876 | 413 | <record id="project.project_task_19" model="project.task"> | 413 | <record id="project.project_task_19" model="project.task"> |
1877 | 414 | 414 | ||
1878 | === modified file 'purchase/test/fifo_price.yml' | |||
1879 | --- purchase/test/fifo_price.yml 2013-11-28 13:33:02 +0000 | |||
1880 | +++ purchase/test/fifo_price.yml 2014-05-14 12:25:54 +0000 | |||
1881 | @@ -144,7 +144,7 @@ | |||
1882 | 144 | We will temporarily change the currency rate on the sixth of June to have the same results all year | 144 | We will temporarily change the currency rate on the sixth of June to have the same results all year |
1883 | 145 | - | 145 | - |
1884 | 146 | !record {model: res.currency.rate, id: base.rateUSDbis}: | 146 | !record {model: res.currency.rate, id: base.rateUSDbis}: |
1886 | 147 | rate: 1.2834 | 147 | rate: 1.0000 |
1887 | 148 | currency_id: base.USD | 148 | currency_id: base.USD |
1888 | 149 | name: !eval time.strftime('%Y-06-06') | 149 | name: !eval time.strftime('%Y-06-06') |
1889 | 150 | - | 150 | - |
1890 | @@ -220,10 +220,10 @@ | |||
1891 | 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")) |
1892 | 221 | picking_obj.do_transfer(context=context) | 221 | picking_obj.do_transfer(context=context) |
1893 | 222 | - | 222 | - |
1895 | 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) |
1896 | 224 | - | 224 | - |
1897 | 225 | !python {model: product.product}: | | 225 | !python {model: product.product}: | |
1899 | 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),) |
1900 | 227 | - | 227 | - |
1901 | 228 | Do a delivery of an extra 10 kg | 228 | Do a delivery of an extra 10 kg |
1902 | 229 | - | 229 | - |
1903 | @@ -252,11 +252,11 @@ | |||
1904 | 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")) |
1905 | 253 | picking_obj.do_transfer(context=context) | 253 | picking_obj.do_transfer(context=context) |
1906 | 254 | - | 254 | - |
1908 | 255 | Check rounded price is 150.0 / 1.2834 | 255 | Check rounded price is 150.0 / 1.0000 |
1909 | 256 | - | 256 | - |
1910 | 257 | !python {model: product.product}: | | 257 | !python {model: product.product}: | |
1911 | 258 | product = self.browse(cr, uid, ref("product_fifo_icecream")) | 258 | product = self.browse(cr, uid, ref("product_fifo_icecream")) |
1913 | 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)) |
1914 | 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' |
1915 | 261 | - | 261 | - |
1916 | 262 | Let us create some outs to get negative stock for a new product using the same config | 262 | Let us create some outs to get negative stock for a new product using the same config |
1917 | 263 | 263 | ||
1918 | === modified file 'purchase/test/process/edi_purchase_order.yml' | |||
1919 | --- purchase/test/process/edi_purchase_order.yml 2012-11-29 22:26:45 +0000 | |||
1920 | +++ purchase/test/process/edi_purchase_order.yml 2014-05-14 12:25:54 +0000 | |||
1921 | @@ -50,8 +50,8 @@ | |||
1922 | 50 | "__id": "base:724f9v70-dv70-1v70-8v70-701a04e25v70.EUR", | 50 | "__id": "base:724f9v70-dv70-1v70-8v70-701a04e25v70.EUR", |
1923 | 51 | "__module": "base", | 51 | "__module": "base", |
1924 | 52 | "__model": "res.currency", | 52 | "__model": "res.currency", |
1927 | 53 | "code": "EUR", | 53 | "code": "USD", |
1928 | 54 | "symbol": "€", | 54 | "symbol": "$", |
1929 | 55 | }, | 55 | }, |
1930 | 56 | "date_order": "2011-09-13", | 56 | "date_order": "2011-09-13", |
1931 | 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"], |
1932 | @@ -118,7 +118,6 @@ | |||
1933 | 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" |
1934 | 119 | bank_info = order_new.partner_id.bank_ids[0] | 119 | bank_info = order_new.partner_id.bank_ids[0] |
1935 | 120 | assert bank_info.acc_number == "Guys bank: 123477777-156113", 'Expected "Guys bank: 123477777-156113", got %s' % bank_info.acc_number | 120 | assert bank_info.acc_number == "Guys bank: 123477777-156113", 'Expected "Guys bank: 123477777-156113", got %s' % bank_info.acc_number |
1936 | 121 | |||
1937 | 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" |
1938 | 123 | assert order_new.amount_total == 350, "Amount total is not same" | 122 | assert order_new.amount_total == 350, "Amount total is not same" |
1939 | 124 | assert order_new.amount_untaxed == 350, "untaxed amount is not same" | 123 | assert order_new.amount_untaxed == 350, "untaxed amount is not same" |
1940 | @@ -151,8 +150,8 @@ | |||
1941 | 151 | "__id": "base:724f93ec-ddd0-11e0-88ec-701a04e25543.EUR", | 150 | "__id": "base:724f93ec-ddd0-11e0-88ec-701a04e25543.EUR", |
1942 | 152 | "__module": "base", | 151 | "__module": "base", |
1943 | 153 | "__model": "res.currency", | 152 | "__model": "res.currency", |
1946 | 154 | "code": "EUR", | 153 | "code": "USD", |
1947 | 155 | "symbol": "€", | 154 | "symbol": "$", |
1948 | 156 | }, | 155 | }, |
1949 | 157 | "date_order": "2011-09-13", | 156 | "date_order": "2011-09-13", |
1950 | 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"], |
1951 | @@ -219,7 +218,6 @@ | |||
1952 | 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" |
1953 | 220 | bank_info = order_new.partner_id.bank_ids[0] | 219 | bank_info = order_new.partner_id.bank_ids[0] |
1954 | 221 | assert bank_info.acc_number == "Another bank: 123477700-156113", 'Expected "Another bank: 123477700-156113", got %s' % bank_info.acc_number | 220 | assert bank_info.acc_number == "Another bank: 123477700-156113", 'Expected "Another bank: 123477700-156113", got %s' % bank_info.acc_number |
1955 | 222 | |||
1956 | 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" |
1957 | 224 | assert order_new.amount_total == 350, "Amount total is not same" | 222 | assert order_new.amount_total == 350, "Amount total is not same" |
1958 | 225 | assert order_new.amount_untaxed == 350, "untaxed amount is not same" | 223 | assert order_new.amount_untaxed == 350, "untaxed amount is not same" |
1959 | @@ -234,4 +232,4 @@ | |||
1960 | 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,) |
1961 | 235 | assert purchase_line.product_qty == 10 , "product qty is not same" | 233 | assert purchase_line.product_qty == 10 , "product qty is not same" |
1962 | 236 | else: | 234 | else: |
1963 | 237 | raise AssertionError('unknown order line: %s' % purchase_line) | ||
1964 | 238 | \ No newline at end of file | 235 | \ No newline at end of file |
1965 | 236 | raise AssertionError('unknown order line: %s' % purchase_line) | ||
1966 | 239 | 237 | ||
1967 | === modified file 'report_intrastat/test/report_intrastat_report.yml' | |||
1968 | --- report_intrastat/test/report_intrastat_report.yml 2014-04-02 16:40:53 +0000 | |||
1969 | +++ report_intrastat/test/report_intrastat_report.yml 2014-05-14 12:25:54 +0000 | |||
1970 | @@ -2,7 +2,7 @@ | |||
1971 | 2 | In order to test the PDF reports defined on an invoice, we will create a Invoice Record | 2 | In order to test the PDF reports defined on an invoice, we will create a Invoice Record |
1972 | 3 | - | 3 | - |
1973 | 4 | !record {model: account.invoice, id: test_invoice_1}: | 4 | !record {model: account.invoice, id: test_invoice_1}: |
1975 | 5 | currency_id: base.EUR | 5 | currency_id: base.USD |
1976 | 6 | company_id: base.main_company | 6 | company_id: base.main_company |
1977 | 7 | partner_id: base.res_partner_1 | 7 | partner_id: base.res_partner_1 |
1978 | 8 | state: draft | 8 | state: draft |
1979 | 9 | 9 | ||
1980 | === modified file 'sale/test/edi_sale_order.yml' | |||
1981 | --- sale/test/edi_sale_order.yml 2013-10-31 18:56:33 +0000 | |||
1982 | +++ sale/test/edi_sale_order.yml 2014-05-14 12:25:54 +0000 | |||
1983 | @@ -49,8 +49,8 @@ | |||
1984 | 49 | "__id": "base:5af12v70-dv70-1v70-bv70-701a04e25v70.EUR", | 49 | "__id": "base:5af12v70-dv70-1v70-bv70-701a04e25v70.EUR", |
1985 | 50 | "__module": "base", | 50 | "__module": "base", |
1986 | 51 | "__model": "res.currency", | 51 | "__model": "res.currency", |
1989 | 52 | "code": "EUR", | 52 | "code": "USD", |
1990 | 53 | "symbol": "€", | 53 | "symbol": "$", |
1991 | 54 | }, | 54 | }, |
1992 | 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."], |
1993 | 56 | "company_address": { | 56 | "company_address": { |
1994 | @@ -101,7 +101,6 @@ | |||
1995 | 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" |
1996 | 102 | bank_info = order_new.partner_id.bank_ids[0] | 102 | bank_info = order_new.partner_id.bank_ids[0] |
1997 | 103 | assert bank_info.acc_number == "Another bank: 032465700-156700", 'Expected "Another bank: 032465700-156700", got %s' % bank_info.acc_number | 103 | assert bank_info.acc_number == "Another bank: 032465700-156700", 'Expected "Another bank: 032465700-156700", got %s' % bank_info.acc_number |
1998 | 104 | |||
1999 | 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" |
2000 | 106 | assert order_new.amount_total == 350, "Amount total is wrong" | 105 | assert order_new.amount_total == 350, "Amount total is wrong" |
2001 | 107 | assert order_new.amount_untaxed == 350, "Untaxed amount is wrong" | 106 | assert order_new.amount_untaxed == 350, "Untaxed amount is wrong" |
2002 | @@ -135,8 +134,8 @@ | |||
2003 | 135 | "__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.EUR", | 134 | "__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.EUR", |
2004 | 136 | "__module": "base", | 135 | "__module": "base", |
2005 | 137 | "__model": "res.currency", | 136 | "__model": "res.currency", |
2008 | 138 | "code": "EUR", | 137 | "code": "USD", |
2009 | 139 | "symbol": "€", | 138 | "symbol": "$", |
2010 | 140 | }, | 139 | }, |
2011 | 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."], |
2012 | 142 | "company_address": { | 141 | "company_address": { |
2013 | 143 | 142 | ||
2014 | === modified file 'sale_crm/sale_crm_demo.xml' | |||
2015 | --- sale_crm/sale_crm_demo.xml 2013-12-13 09:40:16 +0000 | |||
2016 | +++ sale_crm/sale_crm_demo.xml 2014-05-14 12:25:54 +0000 | |||
2017 | @@ -17,7 +17,7 @@ | |||
2018 | 17 | <!-- Invoice for Direct Marketing --> | 17 | <!-- Invoice for Direct Marketing --> |
2019 | 18 | 18 | ||
2020 | 19 | <record id="test_crm_sale_invoice_1" model="account.invoice"> | 19 | <record id="test_crm_sale_invoice_1" model="account.invoice"> |
2022 | 20 | <field name="currency_id" ref="base.EUR"/> | 20 | <field name="currency_id" ref="base.USD"/> |
2023 | 21 | <field name="company_id" ref="base.main_company"/> | 21 | <field name="company_id" ref="base.main_company"/> |
2024 | 22 | <field name="partner_id" ref="base.res_partner_1"/> | 22 | <field name="partner_id" ref="base.res_partner_1"/> |
2025 | 23 | <field name="journal_id" ref="account.sales_journal"/> | 23 | <field name="journal_id" ref="account.sales_journal"/> |
2026 | @@ -65,7 +65,7 @@ | |||
2027 | 65 | <!-- Invoice for Indirect Marketing --> | 65 | <!-- Invoice for Indirect Marketing --> |
2028 | 66 | 66 | ||
2029 | 67 | <record id="test_crm_sale_invoice_2" model="account.invoice"> | 67 | <record id="test_crm_sale_invoice_2" model="account.invoice"> |
2031 | 68 | <field name="currency_id" ref="base.EUR"/> | 68 | <field name="currency_id" ref="base.USD"/> |
2032 | 69 | <field name="company_id" ref="base.main_company"/> | 69 | <field name="company_id" ref="base.main_company"/> |
2033 | 70 | <field name="partner_id" ref="base.res_partner_1"/> | 70 | <field name="partner_id" ref="base.res_partner_1"/> |
2034 | 71 | <field name="journal_id" ref="account.sales_journal"/> | 71 | <field name="journal_id" ref="account.sales_journal"/> |
- context should be pass to _get_company method. currency and set_default_ currency should use get_company_ currency.
- get_default_
- yml file should be rename.
- EDI purchase pricelist (EUR) .. why we are taking ref of eur ?