Merge lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara into lp:openobject-addons

Proposed by Ashvin Rathod (OpenERP)
Status: Merged
Merged at revision: 4705
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara
Merge into: lp:openobject-addons
Diff against target: 38 lines (+12/-4)
1 file modified
account/account.py (+12/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-684119-ara
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Ashvin Rathod (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+54660@code.launchpad.net

Description of the change

Hello,

FIX: #684119 Account chart wizard does not check if generated account code for bank journal exsits

Thanks,
ara

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

you have two same code it should be common for both try and except

review: Needs Fixing
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

hello,

I have improved code as you describe above.

Thanks,
ara

review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2011-03-29 14:30:31 +0000
3+++ account/account.py 2011-03-30 06:20:56 +0000
4@@ -2924,15 +2924,22 @@
5 ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
6
7 current_num = 1
8+ valid = True
9 for line in obj_multi.bank_accounts_id:
10 #create the account_account for this bank journal
11 tmp = line.acc_name
12 dig = obj_multi.code_digits
13 if ref_acc_bank.code:
14- try:
15- new_code = str(int(ref_acc_bank.code.ljust(dig,'0')) + current_num)
16- except:
17- new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)),'0')) + str(current_num)
18+ while valid:
19+ try:
20+ new_code = str(int(ref_acc_bank.code.ljust(dig, '0')) + current_num)
21+ except:
22+ new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num)
23+ ids = obj_acc.search(cr, uid, [('code', '=', new_code)])
24+ if not ids:
25+ valid = False
26+ else:
27+ current_num += 1
28 vals = {
29 'name': tmp,
30 'currency_id': line.currency_id and line.currency_id.id or False,
31@@ -2965,6 +2972,7 @@
32 vals_journal['default_debit_account_id'] = acc_cash_id
33 obj_journal.create(cr, uid, vals_journal)
34 current_num += 1
35+ valid = True
36
37 #create the properties
38 property_obj = self.pool.get('ir.property')

Subscribers

People subscribed via source and target branches

to all changes: