[FIX]picking_wave: fix picking wave in order to work with latest modification on wms
bzr revid: csn@openerp.com-20130729141250-f33fcd2ncmb8elh2
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
stock_picking_wave,stock.picking.wave,model_stock_picking_wave,base.group_user,1,1,1,1
|
||||
stock_picking_wave,stock.picking.wave,model_stock_picking_wave,stock.group_stock_user,1,1,1,1
|
||||
|
@@ -7,7 +7,7 @@ class stock_picking_wave(osv.osv):
|
||||
_name = "stock.picking.wave"
|
||||
_columns = {
|
||||
'name': fields.char('name', required=True, help='Name of the picking wave'),
|
||||
'resp_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'),
|
||||
'partner_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'),
|
||||
'time': fields.float('Time', help='Time it will take to perform the wave'),
|
||||
'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'),
|
||||
'capacity': fields.float('Capacity', help='The capacity of the transport used to get the goods'),
|
||||
@@ -16,49 +16,17 @@ class stock_picking_wave(osv.osv):
|
||||
|
||||
def confirm_picking(self, cr, uid, ids, context=None):
|
||||
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
|
||||
self.pool.get('stock.picking').wave_confirm_picking(cr, uid, picking_todo, context=context)
|
||||
self.pool.get('stock.picking').action_done(cr, uid, picking_todo, context=context)
|
||||
return True
|
||||
|
||||
def cancel_picking(self, cr, uid, ids, context=None):
|
||||
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
|
||||
self.pool.get('stock.picking').wave_cancel_picking(cr, uid, picking_todo, context=context)
|
||||
self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context)
|
||||
return True
|
||||
|
||||
|
||||
class stock_picking(osv.osv):
|
||||
_inherit = "stock.picking"
|
||||
_columns = {
|
||||
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', help='Picking wave associated to this picking'),
|
||||
}
|
||||
|
||||
def wave_confirm_picking(self, cr, uid, ids, context=None):
|
||||
"""Set all stocks moves associated to this picking to done state and if picking is in draft,
|
||||
advance workflow to confirmed (which mean that it will afterwards automatically go to done)
|
||||
"""
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for picking in self.browse(cr, uid, ids, context=context):
|
||||
if picking.state == 'draft':
|
||||
workflow.trg_validate(uid, 'stock.picking', picking.id, 'button_confirm', cr)
|
||||
|
||||
moves_todo = move_obj.search(cr, uid, [('picking_id', 'in', ids)], context=context)
|
||||
move_obj.action_done(cr, uid, moves_todo, context=context)
|
||||
return True
|
||||
|
||||
def wave_cancel_picking(self, cr, uid, ids, context=None):
|
||||
"""Cancel the pickings and all stock move associated
|
||||
"""
|
||||
for id in ids:
|
||||
workflow.trg_validate(uid, 'stock.picking', id, 'button_cancel', cr)
|
||||
return True
|
||||
|
||||
class stock_picking_in(osv.osv):
|
||||
_inherit = "stock.picking.in"
|
||||
_columns = {
|
||||
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', help='Picking wave associated to this picking'),
|
||||
}
|
||||
|
||||
class stock_picking_out(osv.osv):
|
||||
_inherit = "stock.picking.out"
|
||||
_columns = {
|
||||
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', help='Picking wave associated to this picking'),
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="resp_id"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<label for="capacity"/>
|
||||
@@ -35,8 +35,8 @@
|
||||
<field name="invoice_state"/>
|
||||
<field name="stock_journal_id" widget="selection"/>
|
||||
<field name="state"/>
|
||||
<button name="wave_confirm_picking" string="Confirm picking" type="object" icon="gtk-apply" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
|
||||
<button name="wave_cancel_picking" string="Cancel picking" type="object" icon="gtk-cancel" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
|
||||
<button name="action_done" string="Confirm picking" type="object" icon="gtk-apply" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
|
||||
<button name="action_cancel" string="Cancel picking" type="object" icon="gtk-cancel" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</sheet>
|
||||
@@ -51,7 +51,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock Picking Waves">
|
||||
<field name="name"/>
|
||||
<field name="resp_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="capacity"/>
|
||||
<field name="capacity_uom"/>
|
||||
<field name="time" widget="float_time"/>
|
||||
|
||||
Reference in New Issue
Block a user