Merge lp:~elbati/account-consolidation/account_parallel_currency_7_tests into lp:~elbati/account-consolidation/adding_account_parallel_currency_7

Proposed by Lorenzo Battistini on 2013-03-27
Status: Merged
Merge reported by: Lorenzo Battistini
Merged at revision: not available
Proposed branch: lp:~elbati/account-consolidation/account_parallel_currency_7_tests
Merge into: lp:~elbati/account-consolidation/adding_account_parallel_currency_7
Diff against target: 843 lines (+688/-77)
8 files modified
account_parallel_currency/__init__.py (+0/-1)
account_parallel_currency/__openerp__.py (+8/-3)
account_parallel_currency/account.py (+27/-25)
account_parallel_currency/account_demo.xml (+504/-0)
account_parallel_currency/res_user.py (+0/-31)
account_parallel_currency/test/customer_invoice.yml (+138/-0)
account_parallel_currency/test/mapping_parallel_accounts.yml (+11/-0)
account_parallel_currency/user_view.xml (+0/-17)
To merge this branch: bzr merge lp:~elbati/account-consolidation/account_parallel_currency_7_tests
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp (community) Resubmit on 2013-04-02
Lorenzo Battistini Pending
Review via email: mp+155795@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-02.

To post a comment you must log in.
26. By Lorenzo Battistini on 2013-03-27

[ADD] automated tests for parallel accounts mapping

27. By Lorenzo Battistini on 2013-03-27

[add] customer invoice test

28. By Lorenzo Battistini on 2013-03-28

[FIX] allowing normal user to cancel moves

29. By Lorenzo Battistini on 2013-03-28

[FIX] when secondary curr is = parallel currency

30. By Lorenzo Battistini on 2013-03-28

[ADD] test for USD invoice

31. By Lorenzo Battistini on 2013-03-29

[FIX] module description

This merge proposal target branch is lp:~elbati/account-consolidation/adding_account_parallel_currency_7

If your intention is to merge both branches in lp:account-consolidation/7.0 respecting the right order, the correct way would have been to create this merge proposal against lp:account-consolidation/7.0 but to set lp:~elbati/account-consolidation/adding_account_parallel_currency_7 in the 'prerequisite branch'.

Can you resubmit this merge in this manner please?

review: Resubmit
Lorenzo Battistini (elbati) wrote :

On 04/02/2013 11:41 AM, Guewen Baconnier @ Camptocamp wrote:
> Review: Resubmit
>
> This merge proposal target branch is lp:~elbati/account-consolidation/adding_account_parallel_currency_7
>
> If your intention is to merge both branches in lp:account-consolidation/7.0 respecting the right order, the correct way would have been to create this merge proposal against lp:account-consolidation/7.0 but to set lp:~elbati/account-consolidation/adding_account_parallel_currency_7 in the 'prerequisite branch'.

Thank you Guewen

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_parallel_currency/__init__.py'
2--- account_parallel_currency/__init__.py 2013-02-08 17:13:05 +0000
3+++ account_parallel_currency/__init__.py 2013-03-29 10:52:21 +0000
4@@ -21,4 +21,3 @@
5 import account
6 import res_company
7 import wizard
8-import res_user
9
10=== modified file 'account_parallel_currency/__openerp__.py'
11--- account_parallel_currency/__openerp__.py 2013-03-05 10:15:56 +0000
12+++ account_parallel_currency/__openerp__.py 2013-03-29 10:52:21 +0000
13@@ -32,7 +32,7 @@
14 A 'Parallel Account Mapping' wizard is provided. It is intended to be run when the same chart of account is used for the parallel companies. It allows to automatically map the 'master' account to 'parallel' accounts, based on account code.
15
16 When posting new journal entries, the system checks the configured parallel accounts and automatically generates the parallel entries.
17-For each user, it is possible to configure a 'parallel user' (that should be associated to a dummy parent company), used to carry out the parallel registrations. This allows to keep the companies separate, so that users of the master company don't see secondary company data (e.g. currencies and journals) but the system uses his parallel user in order to perform the parallel registrations.
18+This is achieved keeping the companies separate, so that users of the master company don't see secondary company data (e.g. currencies and journals) but the system uses the super user in order to perform the parallel registrations.
19 """,
20 'author': 'Agile Business Group',
21 'website': 'http://www.agilebg.com',
22@@ -42,10 +42,15 @@
23 'account_view.xml',
24 'company_view.xml',
25 'wizard/do_mapping.xml',
26- 'user_view.xml',
27 'security/security.xml',
28 ],
29- "demo" : [],
30+ "demo" : [
31+ 'account_demo.xml',
32+ ],
33+ 'test': [
34+ 'test/mapping_parallel_accounts.yml',
35+ 'test/customer_invoice.yml',
36+ ],
37 "active": False,
38 "installable": True
39 }
40
41=== modified file 'account_parallel_currency/account.py'
42--- account_parallel_currency/account.py 2013-03-26 14:03:45 +0000
43+++ account_parallel_currency/account.py 2013-03-29 10:52:21 +0000
44@@ -127,7 +127,7 @@
45
46 def button_cancel(self, cr, uid, ids, context=None):
47 res = super(account_move, self).button_cancel(cr, uid, ids, context=context)
48- for move in self.browse(cr, uid, ids, context=context):
49+ for move in self.browse(cr, SUPERUSER_ID, ids, context=context):
50 for parallel_move in move.parallel_move_ids:
51 parallel_move.button_cancel(context=context)
52 parallel_move.unlink(context=context)
53@@ -184,9 +184,7 @@
54 curr_pool = self.pool.get('res.currency')
55 user_pool = self.pool.get('res.users')
56 company_pool = self.pool.get('res.company')
57- user = user_pool.browse(cr, uid, uid, context=context)
58- if user.parallel_user_id:
59- uid = user.parallel_user_id.id
60+ uid = SUPERUSER_ID
61 for move in self.browse(cr, uid, ids, context=context):
62 if move.state == 'posted':
63 new_move_lines = []
64@@ -246,27 +244,31 @@
65 parallel_sec_curr_iso_code = line.company_id.currency_id.name
66 amount = line.debit or ( - line.credit)
67
68- # search parallel currency by ISO code and parallel company
69- parallel_secondary_curr_ids = curr_pool.search(cr, uid, [
70- ('name', '=', parallel_sec_curr_iso_code),
71- ('company_id', '=', parallel_account.company_id.id),
72- ], context=context)
73-
74- if len(parallel_secondary_curr_ids) == 0:
75- raise orm.except_orm(_('Error !'), _('Currency %s does not exist in company %s !')
76- % (parallel_sec_curr_iso_code, parallel_account.company_id.name))
77- if len(parallel_secondary_curr_ids) > 1:
78- raise orm.except_orm(_('Error !'), _('Too many currencies %s for company %s !')
79- % (parallel_sec_curr_iso_code, parallel_account.company_id.name))
80-
81- # compute parallel base amount from document currency, using move date
82- context.update({'date': line.date})
83- parallel_base_amount = curr_pool.compute(cr, uid, parallel_secondary_curr_ids[0],
84- parallel_account.company_id.currency_id.id, amount,
85- context=context)
86-
87- new_line_values['amount_currency'] = amount or False
88- new_line_values['currency_id'] = parallel_secondary_curr_ids[0]
89+ parallel_base_amount = amount
90+ if parallel_sec_curr_iso_code != parallel_account.company_id.currency_id.name:
91+ # only if parallel company currency is != master move currency
92+ # search parallel currency by ISO code and parallel company
93+ parallel_secondary_curr_ids = curr_pool.search(cr, uid, [
94+ ('name', '=', parallel_sec_curr_iso_code),
95+ ('company_id', '=', parallel_account.company_id.id),
96+ ], context=context)
97+
98+ if len(parallel_secondary_curr_ids) == 0:
99+ raise orm.except_orm(_('Error !'), _('Currency %s does not exist in company %s !')
100+ % (parallel_sec_curr_iso_code, parallel_account.company_id.name))
101+ if len(parallel_secondary_curr_ids) > 1:
102+ raise orm.except_orm(_('Error !'), _('Too many currencies %s for company %s !')
103+ % (parallel_sec_curr_iso_code, parallel_account.company_id.name))
104+
105+ # compute parallel base amount from document currency, using move date
106+ context.update({'date': line.date})
107+ parallel_base_amount = curr_pool.compute(cr, uid, parallel_secondary_curr_ids[0],
108+ parallel_account.company_id.currency_id.id, amount,
109+ context=context)
110+
111+ new_line_values['amount_currency'] = amount
112+ new_line_values['currency_id'] = parallel_secondary_curr_ids[0]
113+
114 new_line_values['debit'] = 0.0
115 new_line_values['credit'] = 0.0
116 if parallel_base_amount > 0:
117
118=== added file 'account_parallel_currency/account_demo.xml'
119--- account_parallel_currency/account_demo.xml 1970-01-01 00:00:00 +0000
120+++ account_parallel_currency/account_demo.xml 2013-03-29 10:52:21 +0000
121@@ -0,0 +1,504 @@
122+<?xml version="1.0" encoding="utf-8"?>
123+<openerp>
124+ <data>
125+
126+ <!--
127+ Parallel company
128+ -->
129+
130+ <record id="parallel_company" model="res.company">
131+ <field name="name" >Parallel company</field>
132+ <field name="currency_id" ref="base.CHF"></field>
133+ </record>
134+
135+ <record id="base.main_company" model="res.company">
136+ <field name="parallel_company_ids" eval="[(6,0,[ref('parallel_company')])]"></field>
137+ </record>
138+
139+ <!--
140+ currencies
141+ -->
142+
143+ <record id="USD" model="res.currency">
144+ <field name="name">USD</field>
145+ <field name="symbol">$</field>
146+ <field name="rounding">0.01</field>
147+ <field name="accuracy">4</field>
148+ <field name="position">before</field>
149+ <field name="company_id" ref="parallel_company"/>
150+ </record>
151+ <record id="rateUSD" model="res.currency.rate">
152+ <field name="rate">1.2834</field>
153+ <field name="currency_id" ref="USD"/>
154+ <field eval="time.strftime('%Y-01-01')" name="name"/>
155+ </record>
156+ <record id="CHF" model="res.currency">
157+ <field name="name">CHF</field>
158+ <field name="symbol">CHF</field>
159+ <field name="rounding">0.01</field>
160+ <field name="accuracy">4</field>
161+ <field name="company_id" ref="parallel_company"/>
162+ </record>
163+ <record id="rateCHF" model="res.currency.rate">
164+ <field name="rate">1.3086</field>
165+ <field name="currency_id" ref="CHF"/>
166+ <field eval="time.strftime('%Y-01-01')" name="name"/>
167+ </record>
168+ <record id="EUR" model="res.currency">
169+ <field name="name">EUR</field>
170+ <field name="symbol">€</field>
171+ <field name="rounding">0.01</field>
172+ <field name="accuracy">4</field>
173+ <field name="company_id" ref="parallel_company"/>
174+ </record>
175+ <record id="rateEUR" model="res.currency.rate">
176+ <field name="currency_id" ref="EUR" />
177+ <field eval="time.strftime('%Y-01-01')" name="name"/>
178+ <field name="rate">1.0</field>
179+ </record>
180+
181+ <!--
182+ Journal
183+ -->
184+
185+ <record id="parallel_sales_journal" model="account.journal">
186+ <field name="name">Parallel Sales Journal - (test)</field>
187+ <field name="code">PSAJ</field>
188+ <field name="type">sale</field>
189+ <field name="company_id" ref="parallel_company"/>
190+ </record>
191+ <record id="account.sales_journal" model="account.journal">
192+ <field name="parallel_journal_ids" eval="[(6,0,[ref('parallel_sales_journal')])]"></field>
193+ </record>
194+
195+ <!--
196+ Fiscal year
197+ -->
198+
199+ <record id="data_fiscalyear" model="account.fiscalyear">
200+ <field eval="'Fiscal Year X '+time.strftime('%Y')" name="name"/>
201+ <field eval="'FY'+time.strftime('%Y')" name="code"/>
202+ <field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
203+ <field eval="time.strftime('%Y')+'-12-31'" name="date_stop"/>
204+ <field name="company_id" ref="parallel_company"/>
205+ </record>
206+
207+ <!--
208+ Fiscal Periods
209+ -->
210+
211+ <record id="period_1" model="account.period">
212+ <field eval="'01/'+time.strftime('%Y')" name="code"/>
213+ <field eval="'X 01/'+time.strftime('%Y')" name="name"/>
214+ <field eval="True" name="special"/>
215+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
216+ <field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
217+ <field eval="time.strftime('%Y')+'-01-31'" name="date_stop"/>
218+ <field name="company_id" ref="parallel_company"/>
219+ </record>
220+ <record id="period_2" model="account.period">
221+ <field eval="'02/'+time.strftime('%Y')" name="code"/>
222+ <field eval="'X 02/'+time.strftime('%Y')" name="name"/>
223+ <field eval="True" name="special"/>
224+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
225+ <field eval="time.strftime('%Y')+'-02-01'" name="date_start"/>
226+ <!-- for the last day of February, we have to compute the day before March 1st -->
227+ <field eval="(DateTime.today().replace(month=3, day=1) - timedelta(days=1)).strftime('%Y-%m-%d')" name="date_stop"/>
228+ <field name="company_id" ref="parallel_company"/>
229+ </record>
230+ <record id="period_3" model="account.period">
231+ <field eval="'03/'+time.strftime('%Y')" name="code"/>
232+ <field eval="'X 03/'+time.strftime('%Y')" name="name"/>
233+ <field eval="True" name="special"/>
234+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
235+ <field eval="time.strftime('%Y')+'-03-01'" name="date_start"/>
236+ <field eval="time.strftime('%Y')+'-03-31'" name="date_stop"/>
237+ <field name="company_id" ref="parallel_company"/>
238+ </record>
239+ <record id="period_4" model="account.period">
240+ <field eval="'04/'+time.strftime('%Y')" name="code"/>
241+ <field eval="'X 04/'+time.strftime('%Y')" name="name"/>
242+ <field eval="True" name="special"/>
243+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
244+ <field eval="time.strftime('%Y')+'-04-01'" name="date_start"/>
245+ <field eval="time.strftime('%Y')+'-04-30'" name="date_stop"/>
246+ <field name="company_id" ref="parallel_company"/>
247+ </record>
248+ <record id="period_5" model="account.period">
249+ <field eval="'05/'+time.strftime('%Y')" name="code"/>
250+ <field eval="'X 05/'+time.strftime('%Y')" name="name"/>
251+ <field eval="True" name="special"/>
252+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
253+ <field eval="time.strftime('%Y')+'-05-01'" name="date_start"/>
254+ <field eval="time.strftime('%Y')+'-05-31'" name="date_stop"/>
255+ <field name="company_id" ref="parallel_company"/>
256+ </record>
257+ <record id="period_6" model="account.period">
258+ <field eval="'06/'+time.strftime('%Y')" name="code"/>
259+ <field eval="'X 06/'+time.strftime('%Y')" name="name"/>
260+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
261+ <field eval="True" name="special"/>
262+ <field eval="time.strftime('%Y')+'-06-01'" name="date_start"/>
263+ <field eval="time.strftime('%Y')+'-06-30'" name="date_stop"/>
264+ <field name="company_id" ref="parallel_company"/>
265+ </record>
266+ <record id="period_7" model="account.period">
267+ <field eval="'07/'+time.strftime('%Y')" name="code"/>
268+ <field eval="'X 07/'+time.strftime('%Y')" name="name"/>
269+ <field eval="True" name="special"/>
270+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
271+ <field eval="time.strftime('%Y')+'-07-01'" name="date_start"/>
272+ <field eval="time.strftime('%Y')+'-07-31'" name="date_stop"/>
273+ <field name="company_id" ref="parallel_company"/>
274+ </record>
275+ <record id="period_8" model="account.period">
276+ <field eval="'08/'+time.strftime('%Y')" name="code"/>
277+ <field eval="'X 08/'+time.strftime('%Y')" name="name"/>
278+ <field eval="True" name="special"/>
279+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
280+ <field eval="time.strftime('%Y')+'-08-01'" name="date_start"/>
281+ <field eval="time.strftime('%Y')+'-08-31'" name="date_stop"/>
282+ <field name="company_id" ref="parallel_company"/>
283+ </record>
284+ <record id="period_9" model="account.period">
285+ <field eval="'09/'+time.strftime('%Y')" name="code"/>
286+ <field eval="'X 09/'+time.strftime('%Y')" name="name"/>
287+ <field eval="True" name="special"/>
288+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
289+ <field eval="time.strftime('%Y')+'-09-01'" name="date_start"/>
290+ <field eval="time.strftime('%Y')+'-09-30'" name="date_stop"/>
291+ <field name="company_id" ref="parallel_company"/>
292+ </record>
293+ <record id="period_10" model="account.period">
294+ <field eval="'10/'+time.strftime('%Y')" name="code"/>
295+ <field eval="'X 10/'+time.strftime('%Y')" name="name"/>
296+ <field eval="True" name="special"/>
297+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
298+ <field eval="time.strftime('%Y')+'-10-01'" name="date_start"/>
299+ <field eval="time.strftime('%Y')+'-10-31'" name="date_stop"/>
300+ <field name="company_id" ref="parallel_company"/>
301+ </record>
302+ <record id="period_11" model="account.period">
303+ <field eval="'11/'+time.strftime('%Y')" name="code"/>
304+ <field eval="'X 11/'+time.strftime('%Y')" name="name"/>
305+ <field eval="True" name="special"/>
306+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
307+ <field eval="time.strftime('%Y')+'-11-01'" name="date_start"/>
308+ <field eval="time.strftime('%Y')+'-11-30'" name="date_stop"/>
309+ <field name="company_id" ref="parallel_company"/>
310+ </record>
311+ <record id="period_12" model="account.period">
312+ <field eval="'12/'+time.strftime('%Y')" name="code"/>
313+ <field eval="'X 12/'+time.strftime('%Y')" name="name"/>
314+ <field eval="True" name="special"/>
315+ <field name="fiscalyear_id" ref="data_fiscalyear"/>
316+ <field eval="time.strftime('%Y')+'-12-01'" name="date_start"/>
317+ <field eval="time.strftime('%Y')+'-12-31'" name="date_stop"/>
318+ <field name="company_id" ref="parallel_company"/>
319+ </record>
320+
321+ <!--
322+ Chart of Accounts
323+ -->
324+
325+ <record id="chart0" model="account.account">
326+ <field name="company_id" ref="parallel_company"/>
327+ <field name="code">X0</field>
328+ <field name="name">Chart For Automated Tests</field>
329+ <field name="type">view</field>
330+ <field name="user_type" ref="account.data_account_type_view"/>
331+ </record>
332+
333+ <!-- Balance Sheet -->
334+
335+ <record id="bal" model="account.account">
336+ <field name="company_id" ref="parallel_company"/>
337+ <field name="code">X1</field>
338+ <field name="name">Balance Sheet - (test)</field>
339+ <field ref="chart0" name="parent_id"/>
340+ <field name="type">view</field>
341+ <field name="user_type" ref="account.data_account_type_view"/>
342+ </record>
343+
344+ <record model="account.account" id="assets_view">
345+ <field name="company_id" ref="parallel_company"/>
346+ <field name="name">Assets - (test)</field>
347+ <field name="code">X10</field>
348+ <field name="type">view</field>
349+ <field name="user_type" ref="account.data_account_type_asset"/>
350+ <field name="reconcile" eval="False"/>
351+ <field name="parent_id" ref="bal"/>
352+ </record>
353+
354+ <record id="fas" model="account.account">
355+ <field name="company_id" ref="parallel_company"/>
356+ <field name="code">X100</field>
357+ <field name="name">Fixed Assets - (test)</field>
358+ <field ref="assets_view" name="parent_id"/>
359+ <field name="type">view</field>
360+ <field name="user_type" ref="account.data_account_type_asset"/>
361+ </record>
362+
363+ <record id="xfa" model="account.account">
364+ <field name="company_id" ref="parallel_company"/>
365+ <field name="code">X1000</field>
366+ <field name="name">Fixed Asset Account - (test)</field>
367+ <field ref="fas" name="parent_id"/>
368+ <field name="type">other</field>
369+ <field name="user_type" ref="account.data_account_type_asset"/>
370+ </record>
371+
372+ <record id="nca" model="account.account">
373+ <field name="company_id" ref="parallel_company"/>
374+ <field name="code">X101</field>
375+ <field name="name">Net Current Assets - (test)</field>
376+ <field ref="assets_view" name="parent_id"/>
377+ <field name="type">view</field>
378+ <field name="user_type" ref="account.data_account_type_asset"/>
379+ </record>
380+
381+ <record id="cas" model="account.account">
382+ <field name="company_id" ref="parallel_company"/>
383+ <field name="code">X1100</field>
384+ <field name="name">Current Assets - (test)</field>
385+ <field ref="nca" name="parent_id"/>
386+ <field name="type">view</field>
387+ <field name="user_type" ref="account.data_account_type_asset"/>
388+ </record>
389+
390+ <record id="stk" model="account.account">
391+ <field name="company_id" ref="parallel_company"/>
392+ <field name="code">X11001</field>
393+ <field name="name">Purchased Stocks - (test)</field>
394+ <field ref="cas" name="parent_id"/>
395+ <field name="type">other</field>
396+ <field name="user_type" ref="account.data_account_type_asset"/>
397+ </record>
398+
399+ <record id="a_recv" model="account.account">
400+ <field name="company_id" ref="parallel_company"/>
401+ <field name="code">X11002</field>
402+ <field name="name">Debtors - (test)</field>
403+ <field ref="cas" name="parent_id"/>
404+ <field name="type">receivable</field>
405+ <field eval="True" name="reconcile"/>
406+ <field name="user_type" ref="account.data_account_type_receivable"/>
407+ </record>
408+
409+ <record id="ova" model="account.account">
410+ <field name="company_id" ref="parallel_company"/>
411+ <field name="code">X11003</field>
412+ <field name="name">Output VAT - (test)</field>
413+ <field ref="cas" name="parent_id"/>
414+ <field name="type">other</field>
415+ <field name="user_type" ref="account.data_account_type_asset"/>
416+ </record>
417+
418+ <record id="bnk" model="account.account">
419+ <field name="company_id" ref="parallel_company"/>
420+ <field name="code">X11004</field>
421+ <field name="name">Bank Current Account - (test)</field>
422+ <field ref="cas" name="parent_id"/>
423+ <field name="type">liquidity</field>
424+ <field name="user_type" ref="account.data_account_type_asset"/>
425+ </record>
426+
427+ <record id="cash" model="account.account">
428+ <field name="company_id" ref="parallel_company"/>
429+ <field name="code">X11005</field>
430+ <field name="name">Cash - (test)</field>
431+ <field ref="cas" name="parent_id"/>
432+ <field name="type">liquidity</field>
433+ <field name="user_type" ref="account.data_account_type_asset"/>
434+ </record>
435+
436+ <record id="o_income" model="account.account">
437+ <field name="company_id" ref="parallel_company"/>
438+ <field name="code">X11006</field>
439+ <field name="name">Opening Income - (test)</field>
440+ <field ref="cas" name="parent_id"/>
441+ <field name="type">other</field>
442+ <field name="user_type" ref="account.data_account_type_income"/>
443+ </record>
444+ <record id="usd_bnk" model="account.account">
445+ <field name="company_id" ref="parallel_company"/>
446+ <field name="code">X11007</field>
447+ <field name="name">USD Bank Account - (test)</field>
448+ <field ref="cas" name="parent_id"/>
449+ <field name="type">liquidity</field>
450+ <field name="user_type" ref="account.data_account_type_asset"/>
451+ <field name="currency_id" ref="base.USD"/>
452+ </record>
453+
454+ <record model="account.account" id="liabilities_view">
455+ <field name="company_id" ref="parallel_company"/>
456+ <field name="name">Liabilities - (test)</field>
457+ <field name="code">X11</field>
458+ <field name="type">view</field>
459+ <field name="user_type" ref="account.data_account_type_liability"/>
460+ <field name="reconcile" eval="False"/>
461+ <field name="parent_id" ref="bal"/>
462+ </record>
463+
464+ <record id="cli" model="account.account">
465+ <field name="company_id" ref="parallel_company"/>
466+ <field name="code">X110</field>
467+ <field name="name">Current Liabilities - (test)</field>
468+ <field ref="liabilities_view" name="parent_id"/>
469+ <field name="type">view</field>
470+ <field name="user_type" ref="account.data_account_type_liability"/>
471+ </record>
472+
473+ <record id="a_pay" model="account.account">
474+ <field name="company_id" ref="parallel_company"/>
475+ <field name="code">X1111</field>
476+ <field name="name">Creditors - (test)</field>
477+ <field ref="cli" name="parent_id"/>
478+ <field name="type">payable</field>
479+ <field eval="True" name="reconcile"/>
480+ <field name="user_type" ref="account.data_account_type_payable"/>
481+ </record>
482+
483+ <record id="iva" model="account.account">
484+ <field name="company_id" ref="parallel_company"/>
485+ <field name="code">X1112</field>
486+ <field name="name">Input VAT - (test)</field>
487+ <field ref="cli" name="parent_id"/>
488+ <field name="type">other</field>
489+ <field name="user_type" ref="account.data_account_type_liability"/>
490+ </record>
491+
492+ <record id="rsa" model="account.account">
493+ <field name="company_id" ref="parallel_company"/>
494+ <field name="code">X1113</field>
495+ <field name="name">Reserve and Profit/Loss - (test)</field>
496+ <field ref="cli" name="parent_id"/>
497+ <field name="type">other</field>
498+ <field name="user_type" ref="account.data_account_type_liability"/>
499+ </record>
500+
501+ <record id="o_expense" model="account.account">
502+ <field name="company_id" ref="parallel_company"/>
503+ <field name="code">X1114</field>
504+ <field name="name">Opening Expense - (test)</field>
505+ <field ref="cli" name="parent_id"/>
506+ <field name="type">other</field>
507+ <field name="user_type" ref="account.data_account_type_expense"/>
508+ </record>
509+
510+ <!-- Profit and Loss -->
511+
512+ <record id="gpf" model="account.account">
513+ <field name="company_id" ref="parallel_company"/>
514+ <field name="code">X2</field>
515+ <field name="name">Profit and Loss - (test)</field>
516+ <field ref="chart0" name="parent_id"/>
517+ <field name="type">view</field>
518+ <field name="user_type" ref="account.data_account_type_view"/>
519+ </record>
520+
521+ <record model="account.account" id="income_view">
522+ <field name="company_id" ref="parallel_company"/>
523+ <field name="name">Income - (test)</field>
524+ <field name="code">X20</field>
525+ <field name="type">view</field>
526+ <field name="user_type" ref="account.data_account_type_income"/>
527+ <field name="reconcile" eval="False"/>
528+ <field name="parent_id" ref="gpf"/>
529+ </record>
530+
531+ <record model="account.account" id="income_fx_income">
532+ <field name="company_id" ref="parallel_company"/>
533+ <field name="name">Foreign Exchange Gain - (test)</field>
534+ <field name="code">X201</field>
535+ <field name="type">other</field>
536+ <field name="user_type" ref="account.data_account_type_income"/>
537+ <field name="reconcile" eval="False"/>
538+ <field name="parent_id" ref="income_view"/>
539+ </record>
540+
541+ <record id="rev" model="account.account">
542+ <field name="company_id" ref="parallel_company"/>
543+ <field name="code">X200</field>
544+ <field name="name">Revenue - (test)</field>
545+ <field ref="income_view" name="parent_id"/>
546+ <field name="type">view</field>
547+ <field name="user_type" ref="account.data_account_type_income"/>
548+ </record>
549+
550+ <record id="a_sale" model="account.account">
551+ <field name="company_id" ref="parallel_company"/>
552+ <field name="code">X2001</field>
553+ <field name="name">Product Sales - (test)</field>
554+ <field ref="rev" name="parent_id"/>
555+ <field name="type">other</field>
556+ <field name="user_type" ref="account.data_account_type_income"/>
557+ </record>
558+
559+ <record model="account.account" id="expense_view">
560+ <field name="company_id" ref="parallel_company"/>
561+ <field name="name">Expense - (test)</field>
562+ <field name="code">X21</field>
563+ <field name="type">view</field>
564+ <field name="user_type" ref="account.data_account_type_expense"/>
565+ <field name="reconcile" eval="False"/>
566+ <field name="parent_id" ref="gpf"/>
567+ </record>
568+
569+
570+ <record id="cos" model="account.account">
571+ <field name="company_id" ref="parallel_company"/>
572+ <field name="code">X210</field>
573+ <field name="name">Cost of Sales - (test)</field>
574+ <field ref="expense_view" name="parent_id"/>
575+ <field name="type">view</field>
576+ <field name="user_type" ref="account.data_account_type_expense"/>
577+ </record>
578+
579+ <record id="cog" model="account.account">
580+ <field name="company_id" ref="parallel_company"/>
581+ <field name="code">X2100</field>
582+ <field name="name">Cost of Goods Sold - (test)</field>
583+ <field ref="cos" name="parent_id"/>
584+ <field name="type">other</field>
585+ <field name="user_type" ref="account.data_account_type_expense"/>
586+ </record>
587+
588+ <record id="ovr" model="account.account">
589+ <field name="company_id" ref="parallel_company"/>
590+ <field name="code">X211</field>
591+ <field name="name">Overheads - (test)</field>
592+ <field ref="expense_view" name="parent_id"/>
593+ <field name="type">view</field>
594+ <field name="user_type" ref="account.data_account_type_expense"/>
595+ </record>
596+
597+ <record id="a_expense" model="account.account">
598+ <field name="company_id" ref="parallel_company"/>
599+ <field name="code">X2110</field>
600+ <field name="name">Expenses - (test)</field>
601+ <field ref="ovr" name="parent_id"/>
602+ <field name="type">other</field>
603+ <field name="user_type" ref="account.data_account_type_expense"/>
604+ </record>
605+
606+ <record model="account.account" id="income_fx_expense">
607+ <field name="company_id" ref="parallel_company"/>
608+ <field name="name">Foreign Exchange Loss - (test)</field>
609+ <field name="code">X2111</field>
610+ <field name="type">other</field>
611+ <field name="user_type" ref="account.data_account_type_expense"/>
612+ <field name="reconcile" eval="False"/>
613+ <field name="parent_id" ref="ovr"/>
614+ </record>
615+
616+ <record id="a_salary_expense" model="account.account">
617+ <field name="company_id" ref="parallel_company"/>
618+ <field name="code">X2112</field>
619+ <field name="name">Salary Expenses - (test)</field>
620+ <field ref="ovr" name="parent_id"/>
621+ <field name="type">other</field>
622+ <field name="user_type" ref="account.data_account_type_expense"/>
623+ </record>
624+ </data>
625+</openerp>
626
627=== removed file 'account_parallel_currency/res_user.py'
628--- account_parallel_currency/res_user.py 2013-03-05 10:15:56 +0000
629+++ account_parallel_currency/res_user.py 1970-01-01 00:00:00 +0000
630@@ -1,31 +0,0 @@
631-# -*- coding: utf-8 -*-
632-##############################################################################
633-#
634-# Copyright (C) 2012-2013 Agile Business Group sagl
635-# (<http://www.agilebg.com>)
636-# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
637-#
638-# This program is free software: you can redistribute it and/or modify
639-# it under the terms of the GNU Affero General Public License as published
640-# by the Free Software Foundation, either version 3 of the License, or
641-# (at your option) any later version.
642-#
643-# This program is distributed in the hope that it will be useful,
644-# but WITHOUT ANY WARRANTY; without even the implied warranty of
645-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
646-# GNU Affero General Public License for more details.
647-#
648-# You should have received a copy of the GNU Affero General Public License
649-# along with this program. If not, see <http://www.gnu.org/licenses/>.
650-#
651-##############################################################################
652-
653-from openerp.osv import fields, orm
654-from osv import fields
655-
656-class res_users(orm.Model):
657- _inherit = "res.users"
658-
659- _columns = {
660- 'parallel_user_id':fields.many2one('res.users', 'Parallel User', help="Used for parallel registration. Associate it to a dummy parent company"),
661- }
662
663=== added directory 'account_parallel_currency/test'
664=== added file 'account_parallel_currency/test/customer_invoice.yml'
665--- account_parallel_currency/test/customer_invoice.yml 1970-01-01 00:00:00 +0000
666+++ account_parallel_currency/test/customer_invoice.yml 2013-03-29 10:52:21 +0000
667@@ -0,0 +1,138 @@
668+-
669+ In order to test account invoice I create a new customer invoice
670+-
671+ I will create bank detail
672+-
673+ !record {model: res.partner.bank, id: res_partner_bank_0}:
674+ state: bank
675+ company_id: base.main_company
676+ partner_id: base.main_partner
677+ acc_number: 123456789
678+ footer: True
679+ bank: base.res_bank_1
680+ bank_name: Reserve
681+-
682+ I create a customer invoice
683+-
684+ !record {model: account.invoice, id: account_invoice_customer0, view: account.invoice_form}:
685+ payment_term: account.account_payment_term_advance
686+ partner_bank_id: res_partner_bank_0
687+ journal_id: account.sales_journal
688+ partner_id: base.res_partner_3
689+ reference_type: none
690+ name: 'Test Customer Invoice'
691+ invoice_line:
692+ - product_id: product.product_product_5
693+ quantity: 10.0
694+-
695+ I manually assign tax on invoice
696+-
697+ !python {model: account.invoice.tax}: |
698+ amt = self.amount_change(cr, uid, [], 50.0, ref('base.EUR'), ref('base.main_company'), False)
699+ base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.EUR'), ref('base.main_company'), False)
700+ invoice_tax_line = {
701+ 'name': 'Test Tax for Customer Invoice',
702+ 'manual': 1,
703+ 'base': base_amt['value']['base_amount'],
704+ 'amount': amt['value']['tax_amount'],
705+ 'account_id': ref('account.ova'),
706+ 'invoice_id': ref("account_invoice_customer0"),
707+ }
708+ tax = self.create(cr, uid, invoice_tax_line)
709+ assert tax, "Tax has not been assigned correctly"
710+
711+-
712+ I check that Initially customer invoice is in the "Draft" state
713+-
714+ !assert {model: account.invoice, id: account_invoice_customer0}:
715+ - state == 'draft'
716+-
717+ I confirm invoice by clicking on validate button
718+-
719+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
720+-
721+ I check that the invoice state is "Open"
722+-
723+ !assert {model: account.invoice, id: account_invoice_customer0}:
724+ - state == 'open'
725+
726+-
727+ I check moves attached to the invoice
728+-
729+ !python {model: account.invoice}: |
730+ acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
731+ assert acc_id.move_id, "Move not created for open invoice"
732+ assert acc_id.move_id.parallel_move_ids, "Parallel move not created for open invoice"
733+ for parallel_move in acc_id.move_id.parallel_move_ids:
734+ for line in parallel_move.line_id:
735+ if line.account_id.id == ref("a_sale"):
736+ assert line.credit == 11777.40, "CHF Product Sales must be 11777.40"
737+ assert line.amount_currency == -9000.0, "EUR Product Sales must be -9000.0"
738+ assert line.currency_id.id == ref("EUR"), "Secondary currency must be EUR"
739+
740+-
741+ I create a customer CHF invoice
742+-
743+ !record {model: account.invoice, id: account_invoice_customer1, view: account.invoice_form}:
744+ partner_bank_id: res_partner_bank_0
745+ journal_id: account.sales_journal
746+ partner_id: base.res_partner_3
747+ reference_type: none
748+ name: 'Test Customer CHF Invoice'
749+ currency_id: base.CHF
750+ invoice_line:
751+ - product_id: product.product_product_5
752+ quantity: 1.0
753+ price_unit: 100.0
754+
755+-
756+ I confirm invoice by clicking on validate button
757+-
758+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer1}
759+
760+-
761+ I check moves attached to the invoice
762+-
763+ !python {model: account.invoice}: |
764+ acc_id=self.browse(cr, uid, ref("account_invoice_customer1"))
765+ assert acc_id.move_id, "Move not created for open invoice"
766+ assert acc_id.move_id.parallel_move_ids, "Parallel move not created for open invoice"
767+ for parallel_move in acc_id.move_id.parallel_move_ids:
768+ for line in parallel_move.line_id:
769+ if line.account_id.id == ref("a_sale"):
770+ assert line.credit == 100.0, "CHF Product Sales must be 100.0"
771+ assert not line.amount_currency, "amount_currency must be empty"
772+ assert not line.currency_id, "currency_id must be empty"
773+
774+-
775+ I create a customer USD invoice
776+-
777+ !record {model: account.invoice, id: account_invoice_customer2, view: account.invoice_form}:
778+ journal_id: account.sales_journal
779+ partner_id: base.res_partner_3
780+ reference_type: none
781+ name: 'Test Customer USD Invoice'
782+ currency_id: base.USD
783+ invoice_line:
784+ - product_id: product.product_product_5
785+ quantity: 1.0
786+ price_unit: 100.0
787+
788+-
789+ I confirm invoice by clicking on validate button
790+-
791+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer2}
792+
793+-
794+ I check moves attached to the invoice
795+-
796+ !python {model: account.invoice}: |
797+ acc_id=self.browse(cr, uid, ref("account_invoice_customer2"))
798+ assert acc_id.move_id, "Move not created for open invoice"
799+ assert acc_id.move_id.parallel_move_ids, "Parallel move not created for open invoice"
800+ for parallel_move in acc_id.move_id.parallel_move_ids:
801+ for line in parallel_move.line_id:
802+ if line.account_id.id == ref("a_sale"):
803+ assert line.credit == 101.96, "USD Product Sales must be 101.96"
804+ assert line.amount_currency == -100.0, "USD Product Sales must be -100.0"
805+ assert line.currency_id.id == ref("USD"), "Secondary currency must be USD"
806
807=== added file 'account_parallel_currency/test/mapping_parallel_accounts.yml'
808--- account_parallel_currency/test/mapping_parallel_accounts.yml 1970-01-01 00:00:00 +0000
809+++ account_parallel_currency/test/mapping_parallel_accounts.yml 2013-03-29 10:52:21 +0000
810@@ -0,0 +1,11 @@
811+-
812+ I create the mapping wizard
813+-
814+ !record {model: account.parallel.mapping, id: account_parallel_mapping_0}:
815+ remove_old_mapping: True
816+
817+-
818+ I click on do mapping
819+-
820+ !python {model: account.parallel.mapping}: |
821+ self.do_mapping(cr, uid, [ref("account_parallel_mapping_0")])
822
823=== removed file 'account_parallel_currency/user_view.xml'
824--- account_parallel_currency/user_view.xml 2013-02-11 09:03:12 +0000
825+++ account_parallel_currency/user_view.xml 1970-01-01 00:00:00 +0000
826@@ -1,17 +0,0 @@
827-<?xml version="1.0" encoding="UTF-8"?>
828-<openerp>
829- <data>
830- <record id="view_users_form" model="ir.ui.view">
831- <field name="name">res.users.form</field>
832- <field name="model">res.users</field>
833- <field name="inherit_id" ref="base.view_users_form"></field>
834- <field name="arch" type="xml">
835- <page string="Access Rights" position="inside">
836- <group string="Parallel Currency" groups="base.group_multi_company">
837- <field name="parallel_user_id" />
838- </group>
839- </page>
840- </field>
841- </record>
842- </data>
843-</openerp>

Subscribers

People subscribed via source and target branches

to all changes: