STOCK: Fix workflow for stock
bzr revid: ced-f9a469bae79e6291c5d144d9603de21cce08c47f
This commit is contained in:
parent
c7bd4bef76
commit
4031d4a566
|
@ -388,6 +388,14 @@ class stock_picking(osv.osv):
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def cancel_assign(self, cr, uid, ids, *args):
|
||||||
|
wf_service = netsvc.LocalService("workflow")
|
||||||
|
for pick in self.browse(cr, uid, ids):
|
||||||
|
move_ids = [x.id for x in pick.move_lines]
|
||||||
|
self.pool.get('stock.move').cancel_assign(cr, uid, move_ids)
|
||||||
|
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
|
return True
|
||||||
|
|
||||||
def action_assign_wkf(self, cr, uid, ids):
|
def action_assign_wkf(self, cr, uid, ids):
|
||||||
self.write(cr, uid, ids, {'state':'assigned'})
|
self.write(cr, uid, ids, {'state':'assigned'})
|
||||||
return True
|
return True
|
||||||
|
@ -688,6 +696,10 @@ class stock_move(osv.osv):
|
||||||
self.write(cr, uid, ids, {'state' : 'assigned'})
|
self.write(cr, uid, ids, {'state' : 'assigned'})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def cancel_assign(self, cr, uid, ids, context={}):
|
||||||
|
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||||
|
return True
|
||||||
|
|
||||||
#
|
#
|
||||||
# Duplicate stock.move
|
# Duplicate stock.move
|
||||||
#
|
#
|
||||||
|
|
|
@ -461,17 +461,22 @@
|
||||||
|
|
||||||
<separator string="Move State" colspan="4"/>
|
<separator string="Move State" colspan="4"/>
|
||||||
<field name="state" select="1"/>
|
<field name="state" select="1"/>
|
||||||
|
<group>
|
||||||
|
<button name="force_assign" string="Force assignation" states="confirmed" type="object"/>
|
||||||
|
<button name="cancel_assign" string="Cancel assignation" states="assigned" type="object"/>
|
||||||
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
<group colspan="4" col="7">
|
<group colspan="4" col="7">
|
||||||
<label colspan="6"/>
|
<label colspan="6"/>
|
||||||
<button type="action" name="%(move_split)d" string="Split move lines in two"/>
|
<button type="action" name="%(move_split)d" string="Split move lines in two"/>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="4" col="7">
|
<group colspan="4" col="8">
|
||||||
<field name="state" readonly="1"/>
|
<field name="state" readonly="1"/>
|
||||||
<button name="button_confirm" string="Confirm Picking" states="draft"/>
|
<button name="button_confirm" string="Confirm Picking" states="draft"/>
|
||||||
<button name="action_assign" string="Assign Reservations" states="confirmed" type="object"/>
|
<button name="action_assign" string="Assign" states="confirmed" type="object"/>
|
||||||
<button name="force_assign" string="Force Reservations" states="confirmed" type="object"/>
|
<button name="force_assign" string="Force assignations" states="confirmed" type="object"/>
|
||||||
|
<button name="cancel_assign" string="Cancel assignations" states="assigned" type="object"/>
|
||||||
<button type="action" name="%(partial_picking)d" string="Make Picking" states="assigned"/>
|
<button type="action" name="%(partial_picking)d" string="Make Picking" states="assigned"/>
|
||||||
<button name="button_cancel" string="Cancel Picking" states="assigned,confirmed,draft"/>
|
<button name="button_cancel" string="Cancel Picking" states="assigned,confirmed,draft"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -49,6 +49,11 @@
|
||||||
<field name="act_to" ref="act_confirmed"/>
|
<field name="act_to" ref="act_confirmed"/>
|
||||||
<field name="signal">button_confirm</field>
|
<field name="signal">button_confirm</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="workflow.transition" id="trans_confirmed_assigned_back">
|
||||||
|
<field name="act_from" ref="act_assigned"/>
|
||||||
|
<field name="act_to" ref="act_confirmed"/>
|
||||||
|
<field name="condition">not test_assigned()</field>
|
||||||
|
</record>
|
||||||
<record model="workflow.transition" id="trans_confirmed_assigned">
|
<record model="workflow.transition" id="trans_confirmed_assigned">
|
||||||
<field name="act_from" ref="act_confirmed"/>
|
<field name="act_from" ref="act_confirmed"/>
|
||||||
<field name="act_to" ref="act_assigned"/>
|
<field name="act_to" ref="act_assigned"/>
|
||||||
|
|
|
@ -106,14 +106,15 @@ def _do_split(self, cr, uid, data, context):
|
||||||
price = data['form']['price%s' % move.id]
|
price = data['form']['price%s' % move.id]
|
||||||
currency = data['form']['currency%s' % move.id]
|
currency = data['form']['currency%s' % move.id]
|
||||||
|
|
||||||
new_price = currency_obj.compute(cr, uid, currency, user.company_id.currency_id.id, price)
|
if qty > 0:
|
||||||
new_std_price = ((product.standard_price * product.qty_available) + (new_price * qty))/(product.qty_available + qty)
|
new_price = currency_obj.compute(cr, uid, currency, user.company_id.currency_id.id, price)
|
||||||
product_obj.write(cr, uid, [product.id], {'standard_price': new_std_price})
|
new_std_price = ((product.standard_price * product.qty_available) + (new_price * qty))/(product.qty_available + qty)
|
||||||
|
product_obj.write(cr, uid, [product.id], {'standard_price': new_std_price})
|
||||||
|
|
||||||
for move in too_few:
|
for move in too_few:
|
||||||
if not new_picking:
|
if not new_picking:
|
||||||
new_picking = pick_obj.copy(cr, uid, pick.id, {'name' : '%s (splitted)' % pick.name, 'move_lines' : [], 'state':'draft'})
|
new_picking = pick_obj.copy(cr, uid, pick.id, {'name' : '%s (splitted)' % pick.name, 'move_lines' : [], 'state':'draft'})
|
||||||
new_obj = move_obj.copy(cr, uid, move.id, {'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty':data['form']['move%s' % move.id], 'picking_id' : new_picking, 'state': move.state, 'move_dest_id': False})
|
new_obj = move_obj.copy(cr, uid, move.id, {'product_qty' : data['form']['move%s' % move.id], 'product_uos_qty':data['form']['move%s' % move.id], 'picking_id' : new_picking, 'state': 'assigned', 'move_dest_id': False})
|
||||||
move_obj.write(cr, uid, [move.id], {'product_qty' : move.product_qty - data['form']['move%s' % move.id], 'product_uos_qty':move.product_qty - data['form']['move%s' % move.id]})
|
move_obj.write(cr, uid, [move.id], {'product_qty' : move.product_qty - data['form']['move%s' % move.id], 'product_uos_qty':move.product_qty - data['form']['move%s' % move.id]})
|
||||||
|
|
||||||
if new_picking:
|
if new_picking:
|
||||||
|
@ -126,9 +127,13 @@ def _do_split(self, cr, uid, data, context):
|
||||||
if new_picking:
|
if new_picking:
|
||||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
||||||
# Then we finish the good picking
|
# Then we finish the good picking
|
||||||
picking_toclose = new_picking or pick.id
|
if new_picking:
|
||||||
pick_obj.action_move(cr, uid, [picking_toclose])
|
pick_obj.action_move(cr, uid, [new_picking])
|
||||||
wf_service.trg_validate(uid, 'stock.picking', picking_toclose, 'button_done', cr)
|
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr)
|
||||||
|
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
|
else:
|
||||||
|
pick_obj.action_move(cr, uid, [pick.id])
|
||||||
|
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
class partial_picking(wizard.interface):
|
class partial_picking(wizard.interface):
|
||||||
|
|
Loading…
Reference in New Issue