Divyesh Makwana(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-1038938-mdi into
lp:openobject-addons.
Requested reviews:
Purnendu Singh (OpenERP) (psi-tinyerp)
Related bugs:
Bug #1038938 in OpenERP Addons: "[trunk] Traceback on opening Journal Items"
https://bugs.launchpad.net/openobject-addons/+bug/1038938
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1038938-mdi/+merge/121139
Hello Sir,
I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/1038938
"Traceback on opening Journal Items".
Thanks,
Divyesh
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1038938-mdi/+merge/121139
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-1038938-mdi.
=== 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 @@
@return: Returns a list of tupples containing id, name
"""
- result = self.browse(cr, user, ids, context=context)
+ if not ids:
+ return []
+ # name_get may receive int id instead of an id list
+ if isinstance(ids, (int, long)):
+ ids = [ids]
res = []
- for rs in result:
+ for rs in self.browse(cr, user, ids, context=context):
if rs.currency:
currency = rs.currency
else:
=== 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 @@
del(data['account_tax_id'])
return data
- def convert_to_period(self, cr, uid, context=None):
+ def convert_to_int(self, cr, uid, context=None):
+ '''This function returns integer equivalent value for period and journal,
+ if it is changed to str from client-side.'''
if context is None:
context = {}
period_obj = self.pool.get('account.period')
+ journal_obj = self.pool.get('account.journal')
#check if the period_id changed in the context from client side
if context.get('period_id', False):
period_id = context.get('period_id')
if type(period_id) == str:
- ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
- context.update({
- 'period_id': ids[0]
+ ids = period_obj.search(cr, uid, [('name', '=', period_id)], context=context)
+ context.update({
+ 'period_id': ids and ids[0] or False
+ })
+ #check if the journal_id changed in the context from client side
+ if context.get('journal_id', False):
+ journal_id = context.get('journal_id')
+ if type(journal_id) == str:
+ ids = journal_obj.search(cr, uid, [('name', '=', journal_id)], context=context)
+ context.update({
+ 'journal_id': ids and ids[0] or False
})
return context
@@ -225,7 +236,7 @@
fiscal_pos_obj = self.pool.get('account.fiscal.position')
partner_obj = self.pool.get('res.partner')
currency_obj = self.pool.get('res.currency')
- context = self.convert_to_period(cr, uid, context)
+ context = self.convert_to_int(cr, uid, context=context)
# Compute simple values
data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
# Starts: Manual entry from account.move form
@@ -917,7 +928,7 @@
def view_header_get(self, cr, user, view_id, view_type, context=None):
if context is None:
context = {}
- context = self.convert_to_period(cr, user, context=context)
+ context = self.convert_to_int(cr, user, context=context)
if context.get('account_id', False):
cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))
res = cr.fetchone()
@@ -933,7 +944,7 @@
if j or p:
return j + (p and (':' + p) or '')
return False
-
+
def onchange_date(self, cr, user, ids, date, context=None):
"""
Returns a dict that contains new values and context
=== 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 @@
<group>
<field name="target_move"/>
</group>
- %s: <label string="%s"/>
- %s: <label string="%s"/>
+ <group>
+ <label string="%s"/>
+ <newline/>
+ </group>
+ <label string="%s"/>
<footer>
<button string="%s" name="action_open_window" default_focus="1" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
- </form>""" % (_('Journal'), journal_string, _('Period'), period_string, open_string)
+ </form>""" % (journal_string, period_string, open_string)
view = etree.fromstring(view.encode('utf8'))
xarch, xfields = self._view_look_dom_arch(cr, uid, view, view_id, context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp