2 bugfixes on mrp_repair module:
* There's a problem with the packing created from the finished repair: I have packing in Available state, and also packing line in Available state. Then I have buttons for validating my packing. When I do it, the packing line change in DONE state, that's ok, but the packing stay in Available state, with same button (Packing done and Cancel). The packing state should also change state into DONE and no button should be available (like a normal packing) * On the repair form, when I fill in the Lot number field, it should return the LAST move in DONE state. Currently, it simply returns the Last move... bzr revid: qdp@tinyerp.com-20081202132628-ghtcvgu79si7khm7
This commit is contained in:
parent
a98cbcf770
commit
6dd72363ae
|
@ -204,14 +204,14 @@ class mrp_repair(osv.osv):
|
|||
}
|
||||
|
||||
def get_last_move(lst_move):
|
||||
while lst_move.move_dest_id and lst_move.state == 'done':
|
||||
while lst_move.move_dest_id and lst_move.move_dest_id and lst_move.move_dest_id.picking_id.state == 'done':
|
||||
lst_move = lst_move.move_dest_id
|
||||
return lst_move
|
||||
|
||||
move_id = move_ids[0]
|
||||
move = get_last_move(self.pool.get('stock.move').browse(cr, uid, move_id))
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id)
|
||||
date = move.date_planned
|
||||
date = move.picking_id.date_done
|
||||
limit = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') + RelativeDateTime(months=product.warranty)
|
||||
return {'value': {
|
||||
'location_id': move.location_dest_id.id,
|
||||
|
@ -381,13 +381,15 @@ class mrp_repair(osv.osv):
|
|||
|
||||
picking = self.pool.get('stock.picking').create(cr, uid, {
|
||||
'origin': repair.name,
|
||||
'state': 'assigned',
|
||||
'state': 'draft',
|
||||
'move_type': 'one',
|
||||
'address_id': repair.address_id and repair.address_id.id or False,
|
||||
'note': repair.internal_notes,
|
||||
'invoice_state': 'none',
|
||||
'type': 'out', # FIXME delivery ?
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr)
|
||||
|
||||
move_id = self.pool.get('stock.move').create(cr, uid, {
|
||||
'name': repair.name,
|
||||
|
|
Loading…
Reference in New Issue