[IMP] stock: work around web client being a moron by pre-creating stock.partial.picking object before opening picking wizard
Web client can't handle editing o2ms (with or without default values) if the object containing the o2m doesn't exist yet bzr revid: xmo@openerp.com-20110114124950-hgh9h8nibh9jsj61
This commit is contained in:
parent
858fdc9a40
commit
1d5bb22c6f
|
@ -657,20 +657,21 @@ class stock_picking(osv.osv):
|
|||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
|
||||
}
|
||||
def action_process(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
partial_id = self.pool.get("stock.partial.picking").create(
|
||||
cr, uid, {}, context=dict(context, active_ids=ids))
|
||||
return {
|
||||
'name':_("Products to Process"),
|
||||
'view_mode': 'form',
|
||||
'view_id': False,
|
||||
'view_type': 'form',
|
||||
'res_model': 'stock.partial.picking',
|
||||
'res_id': partial_id,
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'new',
|
||||
'domain': '[]',
|
||||
'context': {
|
||||
'active_id': ids[0],
|
||||
'active_ids':ids
|
||||
}
|
||||
'context': dict(context, active_ids=ids)
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
|
@ -757,25 +758,14 @@ class stock_picking(osv.osv):
|
|||
""" Validates picking directly from draft state.
|
||||
@return: True
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self.draft_force_assign(cr, uid, ids)
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
move_ids = [x.id for x in pick.move_lines]
|
||||
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||
context.update({'active_ids':ids})
|
||||
return {
|
||||
'name': 'Make Picking',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'stock.partial.picking',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True,
|
||||
'context':context
|
||||
}
|
||||
return self.action_process(
|
||||
cr, uid, ids, context=context)
|
||||
def cancel_assign(self, cr, uid, ids, *args):
|
||||
""" Cancels picking and moves.
|
||||
@return: True
|
||||
|
|
Loading…
Reference in New Issue