[FIX] sale: Question:119827 : Corrected Workflow.

bzr revid: uco@tinyerp.com-20100901091308-zx5m4q5388cczcvs
This commit is contained in:
uco (Open ERP) 2010-09-01 14:43:08 +05:30
parent b7b6a70769
commit d91be1e908
3 changed files with 30 additions and 18 deletions

View File

@ -33,14 +33,8 @@ class StockMove(osv.osv):
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
default = default or {}
default['procurements'] = []
return super(StockMove, self).copy(cr, uid, id, default, context)
def _action_explode(self, cr, uid, move, context={}):
""" Explodes pickings.
@param move: Stock moves
@ -152,17 +146,6 @@ StockMove()
class StockPicking(osv.osv):
_inherit = 'stock.picking'
def test_finnished(self, cursor, user, ids):
wf_service = netsvc.LocalService("workflow")
res = super(StockPicking, self).test_finnished(cursor, user, ids)
for picking in self.browse(cursor, user, ids):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res
#
# Explode picking by replacing phantom BoMs
#

View File

@ -60,6 +60,21 @@ class mrp_property(osv.osv):
'composition': lambda *a: 'min',
}
mrp_property()
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns= {
'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
default = default or {}
default['procurements'] = []
return super(StockMove, self).copy(cr, uid, id, default, context)
StockMove()
class procurement_order(osv.osv):
"""
Procurement Orders
@ -471,6 +486,21 @@ class procurement_order(osv.osv):
procurement_order()
class StockPicking(osv.osv):
_inherit = 'stock.picking'
def test_finnished(self, cursor, user, ids):
wf_service = netsvc.LocalService("workflow")
res = super(StockPicking, self).test_finnished(cursor, user, ids)
for picking in self.browse(cursor, user, ids):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res
StockPicking()
class stock_warehouse_orderpoint(osv.osv):
"""

View File

@ -697,7 +697,6 @@ class sale_order(osv.osv):
for proc_id in proc_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
if picking_id:
wf_service = netsvc.LocalService("workflow")