From 308981d14e239ae74e0d59514fc7117ce3457267 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Fri, 13 Aug 2010 15:38:43 +0530 Subject: [PATCH] [FIX]: fix a problem of period_id, default value comes is str it should be in int, need improve @ client after that this code does not required bzr revid: mga@tinyerp.com-20100813100843-7hn9arrkyx0cdmct --- addons/account/account_move_line.py | 14 ++++++++++++-- addons/account/account_view.xml | 5 ----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d122da7d19e..e575fbd3f78 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -145,6 +145,18 @@ class account_move_line(osv.osv): return data def _default_get(self, cr, uid, fields, context={}): + + period_obj = self.pool.get('account.period') + + #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] + }) + # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form @@ -185,8 +197,6 @@ class account_move_line(osv.osv): if not 'move_id' in fields: #we are not in manual entry return data - period_obj = self.pool.get('account.period') - # Compute the current move move_id = False partner_id = False diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 08d042f4b59..d4c294c76a0 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -273,9 +273,6 @@ - - - @@ -287,8 +284,6 @@ - -