Merge lp:~openerp-dev/openobject-addons/trunk-bug-1038938-mdi into lp:openobject-addons

Proposed by DJ Patel (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1038938-mdi
Merge into: lp:openobject-addons
Diff against target: 108 lines (+30/-12)
3 files modified
account/account.py (+6/-2)
account/account_move_line.py (+18/-7)
account/wizard/account_move_journal.py (+6/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1038938-mdi
Reviewer Review Type Date Requested Status
Purnendu Singh (OpenERP) (community) Approve
Review via email: mp+121139@code.launchpad.net

Description of the change

Hello Sir,

I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/1038938 "Traceback on opening Journal Items".

Thanks,
Divyesh

To post a comment you must log in.
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote :

Hello Sir,

I have done the following things:

1. Traceback when click on Journal Items either from Invoicing > Customers > Journal Items or Invoicing > Suppliers > Journal Items or Invoicing > Bank and Cash > Journal Items.

2. Another traceback in def view_header_get(), due to 'journal_id' changed from the client-side into string. (Check if we can remove view_header_get() method.)

3. Improved the Journal Item Wizard's View.

Thanks,
Divyesh

Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote :

Seems ok and it fixes 3 issues:

1) First issue is fixed from by updating the name_get method of account_journal object.

2) Once the first issue is fixed there was another problem b'coz client was sending journal_ and period_ as str instead of int. So, we need to update the convert_to_int method so it will return journal and period id in integer.

3) Wizard was not showing Journal and period details in proper formate!! We updated that one also

Thanks,
Purnendu Singh

review: Approve

Unmerged revisions

7283. By DJ Patel (OpenERP)

[IMP] account : Improved the code.

7282. By DJ Patel (OpenERP)

[IMP] account : Improved the code.

7281. By DJ Patel (OpenERP)

[IMP] account : Convert the 'journal_id' from 'string' to 'integer' because it is changed from client-side .

7280. By DJ Patel (OpenERP)

[IMP] Improved the wizards view.

7279. By DJ Patel (OpenERP)

[Merge] Merge with main addons.

7278. By DJ Patel (OpenERP)

[Merge] Merge with main addons.

7277. By DJ Patel (OpenERP)

[FIX] account : Traceback on opening Journal Items.

7276. By DJ Patel (OpenERP)

[Merge] Merge with main addons.

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 2012-08-31 13:51:36 +0000
3+++ account/account.py 2012-09-06 13:15:25 +0000
4@@ -836,9 +836,13 @@
5
6 @return: Returns a list of tupples containing id, name
7 """
8- result = self.browse(cr, user, ids, context=context)
9+ if not ids:
10+ return []
11+ # name_get may receive int id instead of an id list
12+ if isinstance(ids, (int, long)):
13+ ids = [ids]
14 res = []
15- for rs in result:
16+ for rs in self.browse(cr, user, ids, context=context):
17 if rs.currency:
18 currency = rs.currency
19 else:
20
21=== modified file 'account/account_move_line.py'
22--- account/account_move_line.py 2012-08-07 11:34:14 +0000
23+++ account/account_move_line.py 2012-09-06 13:15:25 +0000
24@@ -198,17 +198,28 @@
25 del(data['account_tax_id'])
26 return data
27
28- def convert_to_period(self, cr, uid, context=None):
29+ def convert_to_int(self, cr, uid, context=None):
30+ '''This function returns integer equivalent value for period and journal,
31+ if it is changed to str from client-side.'''
32 if context is None:
33 context = {}
34 period_obj = self.pool.get('account.period')
35+ journal_obj = self.pool.get('account.journal')
36 #check if the period_id changed in the context from client side
37 if context.get('period_id', False):
38 period_id = context.get('period_id')
39 if type(period_id) == str:
40- ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
41- context.update({
42- 'period_id': ids[0]
43+ ids = period_obj.search(cr, uid, [('name', '=', period_id)], context=context)
44+ context.update({
45+ 'period_id': ids and ids[0] or False
46+ })
47+ #check if the journal_id changed in the context from client side
48+ if context.get('journal_id', False):
49+ journal_id = context.get('journal_id')
50+ if type(journal_id) == str:
51+ ids = journal_obj.search(cr, uid, [('name', '=', journal_id)], context=context)
52+ context.update({
53+ 'journal_id': ids and ids[0] or False
54 })
55 return context
56
57@@ -225,7 +236,7 @@
58 fiscal_pos_obj = self.pool.get('account.fiscal.position')
59 partner_obj = self.pool.get('res.partner')
60 currency_obj = self.pool.get('res.currency')
61- context = self.convert_to_period(cr, uid, context)
62+ context = self.convert_to_int(cr, uid, context=context)
63 # Compute simple values
64 data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
65 # Starts: Manual entry from account.move form
66@@ -917,7 +928,7 @@
67 def view_header_get(self, cr, user, view_id, view_type, context=None):
68 if context is None:
69 context = {}
70- context = self.convert_to_period(cr, user, context=context)
71+ context = self.convert_to_int(cr, user, context=context)
72 if context.get('account_id', False):
73 cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))
74 res = cr.fetchone()
75@@ -933,7 +944,7 @@
76 if j or p:
77 return j + (p and (':' + p) or '')
78 return False
79-
80+
81 def onchange_date(self, cr, user, ids, date, context=None):
82 """
83 Returns a dict that contains new values and context
84
85=== modified file 'account/wizard/account_move_journal.py'
86--- account/wizard/account_move_journal.py 2012-08-07 11:06:16 +0000
87+++ account/wizard/account_move_journal.py 2012-09-06 13:15:25 +0000
88@@ -108,14 +108,17 @@
89 <group>
90 <field name="target_move"/>
91 </group>
92- %s: <label string="%s"/>
93- %s: <label string="%s"/>
94+ <group>
95+ <label string="%s"/>
96+ <newline/>
97+ </group>
98+ <label string="%s"/>
99 <footer>
100 <button string="%s" name="action_open_window" default_focus="1" type="object" class="oe_highlight"/>
101 or
102 <button string="Cancel" class="oe_link" special="cancel"/>
103 </footer>
104- </form>""" % (_('Journal'), journal_string, _('Period'), period_string, open_string)
105+ </form>""" % (journal_string, period_string, open_string)
106
107 view = etree.fromstring(view.encode('utf8'))
108 xarch, xfields = self._view_look_dom_arch(cr, uid, view, view_id, context=context)

Subscribers

People subscribed via source and target branches

to all changes: