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
=== modified file 'account/account.py'
--- account/account.py 2012-08-31 13:51:36 +0000
+++ account/account.py 2012-09-06 13:15:25 +0000
@@ -836,9 +836,13 @@
836836
837 @return: Returns a list of tupples containing id, name837 @return: Returns a list of tupples containing id, name
838 """838 """
839 result = self.browse(cr, user, ids, context=context)839 if not ids:
840 return []
841 # name_get may receive int id instead of an id list
842 if isinstance(ids, (int, long)):
843 ids = [ids]
840 res = []844 res = []
841 for rs in result:845 for rs in self.browse(cr, user, ids, context=context):
842 if rs.currency:846 if rs.currency:
843 currency = rs.currency847 currency = rs.currency
844 else:848 else:
845849
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py 2012-08-07 11:34:14 +0000
+++ account/account_move_line.py 2012-09-06 13:15:25 +0000
@@ -198,17 +198,28 @@
198 del(data['account_tax_id'])198 del(data['account_tax_id'])
199 return data199 return data
200200
201 def convert_to_period(self, cr, uid, context=None):201 def convert_to_int(self, cr, uid, context=None):
202 '''This function returns integer equivalent value for period and journal,
203 if it is changed to str from client-side.'''
202 if context is None:204 if context is None:
203 context = {}205 context = {}
204 period_obj = self.pool.get('account.period')206 period_obj = self.pool.get('account.period')
207 journal_obj = self.pool.get('account.journal')
205 #check if the period_id changed in the context from client side208 #check if the period_id changed in the context from client side
206 if context.get('period_id', False):209 if context.get('period_id', False):
207 period_id = context.get('period_id')210 period_id = context.get('period_id')
208 if type(period_id) == str:211 if type(period_id) == str:
209 ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])212 ids = period_obj.search(cr, uid, [('name', '=', period_id)], context=context)
210 context.update({213 context.update({
211 'period_id': ids[0]214 'period_id': ids and ids[0] or False
215 })
216 #check if the journal_id changed in the context from client side
217 if context.get('journal_id', False):
218 journal_id = context.get('journal_id')
219 if type(journal_id) == str:
220 ids = journal_obj.search(cr, uid, [('name', '=', journal_id)], context=context)
221 context.update({
222 'journal_id': ids and ids[0] or False
212 })223 })
213 return context224 return context
214225
@@ -225,7 +236,7 @@
225 fiscal_pos_obj = self.pool.get('account.fiscal.position')236 fiscal_pos_obj = self.pool.get('account.fiscal.position')
226 partner_obj = self.pool.get('res.partner')237 partner_obj = self.pool.get('res.partner')
227 currency_obj = self.pool.get('res.currency')238 currency_obj = self.pool.get('res.currency')
228 context = self.convert_to_period(cr, uid, context)239 context = self.convert_to_int(cr, uid, context=context)
229 # Compute simple values240 # Compute simple values
230 data = super(account_move_line, self).default_get(cr, uid, fields, context=context)241 data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
231 # Starts: Manual entry from account.move form242 # Starts: Manual entry from account.move form
@@ -917,7 +928,7 @@
917 def view_header_get(self, cr, user, view_id, view_type, context=None):928 def view_header_get(self, cr, user, view_id, view_type, context=None):
918 if context is None:929 if context is None:
919 context = {}930 context = {}
920 context = self.convert_to_period(cr, user, context=context)931 context = self.convert_to_int(cr, user, context=context)
921 if context.get('account_id', False):932 if context.get('account_id', False):
922 cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))933 cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))
923 res = cr.fetchone()934 res = cr.fetchone()
@@ -933,7 +944,7 @@
933 if j or p:944 if j or p:
934 return j + (p and (':' + p) or '')945 return j + (p and (':' + p) or '')
935 return False946 return False
936947
937 def onchange_date(self, cr, user, ids, date, context=None):948 def onchange_date(self, cr, user, ids, date, context=None):
938 """949 """
939 Returns a dict that contains new values and context950 Returns a dict that contains new values and context
940951
=== modified file 'account/wizard/account_move_journal.py'
--- account/wizard/account_move_journal.py 2012-08-07 11:06:16 +0000
+++ account/wizard/account_move_journal.py 2012-09-06 13:15:25 +0000
@@ -108,14 +108,17 @@
108 <group>108 <group>
109 <field name="target_move"/>109 <field name="target_move"/>
110 </group>110 </group>
111 %s: <label string="%s"/>111 <group>
112 %s: <label string="%s"/>112 <label string="%s"/>
113 <newline/>
114 </group>
115 <label string="%s"/>
113 <footer>116 <footer>
114 <button string="%s" name="action_open_window" default_focus="1" type="object" class="oe_highlight"/>117 <button string="%s" name="action_open_window" default_focus="1" type="object" class="oe_highlight"/>
115 or118 or
116 <button string="Cancel" class="oe_link" special="cancel"/>119 <button string="Cancel" class="oe_link" special="cancel"/>
117 </footer>120 </footer>
118 </form>""" % (_('Journal'), journal_string, _('Period'), period_string, open_string)121 </form>""" % (journal_string, period_string, open_string)
119122
120 view = etree.fromstring(view.encode('utf8'))123 view = etree.fromstring(view.encode('utf8'))
121 xarch, xfields = self._view_look_dom_arch(cr, uid, view, view_id, context=context)124 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: