[IMP] BOARD,STOCK,SURVEY :Improvement in OSV wiz ,Realated Read method
bzr revid: aag@tinyerp.co.in-20110215105509-pjve7asi0r63knec
This commit is contained in:
parent
c1cd88b1d9
commit
63f66fdec1
|
@ -70,10 +70,10 @@ class board_menu_create(osv.osv_memory):
|
|||
})
|
||||
obj_menu = self.pool.get('ir.ui.menu')
|
||||
#start Loop
|
||||
for data in self.read(cr, uid, ids):
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
obj_menu.create(cr, uid, {
|
||||
'name': data.get('menu_name'),
|
||||
'parent_id': data.get('menu_parent_id'),
|
||||
'name': data.menu_name,
|
||||
'parent_id': data.menu_parent_id.id,
|
||||
'icon': 'STOCK_SELECT_COLOR',
|
||||
'action': 'ir.actions.act_window,' + str(action_id)
|
||||
}, context=context)
|
||||
|
|
|
@ -1114,7 +1114,6 @@ msgstr ""
|
|||
#: view:stock.invoice.onshipping:0
|
||||
#: view:stock.location.product:0
|
||||
#: view:stock.move:0
|
||||
#: view:stock.move.track:0
|
||||
#: view:stock.picking:0
|
||||
#: view:stock.split.into:0
|
||||
msgid "_Cancel"
|
||||
|
@ -1693,7 +1692,6 @@ msgid "Search Inventory"
|
|||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: field:stock.move.track,quantity:0
|
||||
msgid "Quantity per lot"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1920,7 +1918,6 @@ msgstr ""
|
|||
|
||||
#. module: stock
|
||||
#: model:ir.actions.act_window,name:stock.track_line_old
|
||||
#: view:stock.move.track:0
|
||||
msgid "Tracking a move"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2461,7 +2458,6 @@ msgid "If checked, products contained in child locations of selected location wi
|
|||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: field:stock.move.track,tracking_prefix:0
|
||||
msgid "Tracking prefix"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2901,7 +2897,6 @@ msgstr ""
|
|||
#: view:stock.move.consume:0
|
||||
#: view:stock.move.scrap:0
|
||||
#: view:stock.move.split:0
|
||||
#: view:stock.move.track:0
|
||||
#: view:stock.split.into:0
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
|
|
@ -21,35 +21,6 @@
|
|||
|
||||
from osv import fields, osv
|
||||
|
||||
class stock_move_track(osv.osv_memory):
|
||||
_name = "stock.move.track"
|
||||
_description = "Track moves"
|
||||
|
||||
_columns = {
|
||||
'tracking_prefix': fields.char('Tracking prefix', size=64),
|
||||
'quantity': fields.float("Quantity per lot")
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'quantity': lambda *x: 1
|
||||
}
|
||||
|
||||
def track_lines(self, cr, uid, ids, context=None):
|
||||
""" To track stock moves lines
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: An ID or list of IDs if we want more than one
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
datas = self.read(cr, uid, ids)[0]
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_obj._track_lines(cr, uid, context['active_id'], datas, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
stock_move_track()
|
||||
|
||||
class stock_move_consume(osv.osv_memory):
|
||||
_name = "stock.move.consume"
|
||||
_description = "Consume Products"
|
||||
|
|
|
@ -2,34 +2,6 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_move_track_wizard" model="ir.ui.view">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="model">stock.move.track</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Tracking a move">
|
||||
<field name="tracking_prefix" colspan="4"/>
|
||||
<field name="quantity" colspan="4"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="track_lines" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="track_line_old" model="ir.actions.act_window">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.track</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Consume, scrap move -->
|
||||
|
||||
<record id="view_stock_move_consume_wizard" model="ir.ui.view">
|
||||
|
|
|
@ -107,7 +107,7 @@ class stock_split_move_line(osv.osv_memory):
|
|||
record_id = context and context.get('active_id', False) or False
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick = pick_obj.browse(cr, uid, record_id, context=context)
|
||||
data = self.read(cr, uid, ids[0])
|
||||
data = self.read(cr, uid, ids[0], context=context)
|
||||
for move in pick.move_lines:
|
||||
quantity = data['move%s' % move.id]
|
||||
if 0 < quantity < move.product_qty:
|
||||
|
|
|
@ -61,14 +61,13 @@ class survey_browse_answer(osv.osv_memory):
|
|||
@return : Dictionary value for Open the browse answer wizard.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
record = self.read(cr, uid, ids, [])
|
||||
record = record and record[0] or {}
|
||||
if record['response_id']:
|
||||
res_id = [(record['response_id'])]
|
||||
else:
|
||||
sur_response_obj = self.pool.get('survey.response')
|
||||
res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',int(record['survey_id']))])
|
||||
context.update({'active' : True,'survey_id' : record['survey_id'], 'response_id' : res_id, 'response_no' : 0})
|
||||
sur_response_obj = self.pool.get('survey.response')
|
||||
for record in self.browse(cr, uid, ids,context=context):
|
||||
if record.response_id.id:
|
||||
res_id = record.response_id.id
|
||||
else:
|
||||
res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',record.survey_id)])[0]
|
||||
context.update({'active' : True,'survey_id' : record.survey_id, 'response_id' : [res_id], 'response_no' : 0})
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
return {
|
||||
|
|
|
@ -55,10 +55,9 @@ class survey_print(osv.osv_memory):
|
|||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for print survey form.
|
||||
"""
|
||||
|
||||
datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']}
|
||||
datas = {'ids' : self.read(cr, uid, ids, ['survey_ids'], context=context)[0]['survey_ids']}
|
||||
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\
|
||||
'page_number', 'without_pagebreak'], context)
|
||||
'page_number', 'without_pagebreak'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print'
|
||||
|
|
|
@ -59,7 +59,7 @@ class survey_print_answer(osv.osv_memory):
|
|||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\
|
||||
'page_number', 'without_pagebreak'], context)
|
||||
'page_number', 'without_pagebreak'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print.answer'
|
||||
|
|
|
@ -44,7 +44,7 @@ class survey_print_statistics(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context)
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print.statistics'
|
||||
|
|
|
@ -122,7 +122,7 @@ class survey_name_wiz(osv.osv_memory):
|
|||
search_obj = self.pool.get('ir.ui.view')
|
||||
if context is None: context = {}
|
||||
|
||||
sur_id = self.read(cr, uid, ids, [])[0]
|
||||
sur_id = self.read(cr, uid, ids, ['survey_id'], context=context)[0]
|
||||
survey_id = sur_id['survey_id']
|
||||
context.update({'survey_id': survey_id, 'sur_name_id': sur_id['id']})
|
||||
cr.execute('select count(id) from survey_history where user_id=%s\
|
||||
|
@ -133,8 +133,8 @@ class survey_name_wiz(osv.osv_memory):
|
|||
if user_limit and res >= user_limit:
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit))
|
||||
|
||||
sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids)[0]['survey_id'])
|
||||
if sur_rec['max_response_limit'] and sur_rec['max_response_limit'] <= sur_rec['tot_start_survey']:
|
||||
sur_rec = survey_obj.browse(cr,uid,ids,context=context)[0]
|
||||
if sur_rec.max_response_limit and sur_rec.max_response_limit <= sur_rec.tot_start_survey:
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance."))
|
||||
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
|
|
@ -96,7 +96,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
def action_send(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
record = self.read(cr, uid, ids, [])
|
||||
record = self.read(cr, uid, ids, [],context=context)
|
||||
survey_ids = context.get('active_ids', [])
|
||||
record = record and record[0]
|
||||
partner_ids = record['partner_ids']
|
||||
|
|
Loading…
Reference in New Issue