[MERGE] merge lp:~openerp-dev/openobject-addons/trunk-stock_cancel_button_fix-cha
bzr revid: cha@tinyerp.com-20120921063025-q1z0lj1ida0ew975
This commit is contained in:
commit
79a982dffe
|
@ -761,6 +761,15 @@ class stock_picking(osv.osv):
|
||||||
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||||
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 button_cancel(self, cr, uid, ids, *args):
|
||||||
|
""" Changes state of picking to cancel.
|
||||||
|
@return: True
|
||||||
|
"""
|
||||||
|
wf_service = netsvc.LocalService("workflow")
|
||||||
|
for pick in self.browse(cr, uid, ids):
|
||||||
|
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
|
||||||
|
return True
|
||||||
|
|
||||||
def draft_force_assign(self, cr, uid, ids, *args):
|
def draft_force_assign(self, cr, uid, ids, *args):
|
||||||
""" Confirms picking directly from draft state.
|
""" Confirms picking directly from draft state.
|
||||||
|
@ -1141,7 +1150,7 @@ class stock_picking(osv.osv):
|
||||||
for move in pick.move_lines:
|
for move in pick.move_lines:
|
||||||
if move.state not in ('cancel','done'):
|
if move.state not in ('cancel','done'):
|
||||||
return False
|
return False
|
||||||
if move.state=='done':
|
if move.state=='done' and not move.scrapped:
|
||||||
ok = True
|
ok = True
|
||||||
return ok
|
return ok
|
||||||
|
|
||||||
|
@ -1160,7 +1169,7 @@ class stock_picking(osv.osv):
|
||||||
if not pick.move_lines:
|
if not pick.move_lines:
|
||||||
return True
|
return True
|
||||||
for move in pick.move_lines:
|
for move in pick.move_lines:
|
||||||
if move.state == 'done':
|
if move.state == 'done' and not move.scrapped:
|
||||||
raise osv.except_osv(_('Error!'), _('You cannot cancel picking because stock move is in done state!'))
|
raise osv.except_osv(_('Error!'), _('You cannot cancel picking because stock move is in done state!'))
|
||||||
return True
|
return True
|
||||||
def unlink(self, cr, uid, ids, context=None):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -754,7 +754,7 @@
|
||||||
<button name="action_process" states="assigned" string="Confirm & Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
|
<button name="action_process" states="assigned" string="Confirm & Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight"/>
|
||||||
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund" attrs="{'invisible': ['|','|',('state','<>','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" class="oe_highlight"/>
|
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice/Refund" attrs="{'invisible': ['|','|',('state','<>','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" class="oe_highlight"/>
|
||||||
<button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action"/>
|
<button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action"/>
|
||||||
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel"/>
|
<button name="button_cancel" type="object" states="assigned,confirmed,draft" string="_Cancel"/>
|
||||||
</span>
|
</span>
|
||||||
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
|
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
|
||||||
</header>
|
</header>
|
||||||
|
|
Loading…
Reference in New Issue