modif on receive packing : run wizard on 'Fill From Unreceived Products' button
bzr revid: hmo@tinyerp.com-20080827054458-790urn35yd88vdj2
This commit is contained in:
parent
89e9245937
commit
1acc901937
|
@ -1189,32 +1189,15 @@ product_product()
|
|||
# get confirm or assign stock move lines of partner and put in current picking.
|
||||
class stock_picking_move_wizard(osv.osv_memory):
|
||||
_name='stock.picking.move.wizard'
|
||||
def _get_picking(self,cr, uid, ctx):
|
||||
if 'action_id' in ctx:
|
||||
def _get_picking(self,cr, uid, ctx):
|
||||
if ctx.get('action_id',False):
|
||||
return ctx['action_id']
|
||||
return False
|
||||
def _get_move_lines(self,cr,uid,ctx):
|
||||
move_obj=self.pool.get('stock.move')
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
if ctx.get('action_id',False):
|
||||
picking=picking_obj.browse(cr,uid,[ctx['action_id']])
|
||||
if picking and len(picking):
|
||||
if picking[0].address_id:
|
||||
move_line_ids=move_obj.search(cr,uid,[('state','in',['confirmed','assigned']),('address_id','=',picking[0].address_id.id)])
|
||||
else:
|
||||
move_line_ids=move_obj.search(cr,uid,[('state','in',['confirmed','assigned'])])
|
||||
print move_line_ids
|
||||
move_lines=move_obj.read(cr,uid,move_line_ids)
|
||||
#res=[]
|
||||
#for move_line in move_lines:
|
||||
# res.append((0,0,move_line))
|
||||
return [{'move_ids':(0,0,move_lines)}]
|
||||
return []
|
||||
return False
|
||||
def _get_picking_address(self,cr,uid,ctx):
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
if ctx.get('action_id',False):
|
||||
picking=picking_obj.browse(cr,uid,[ctx['action_id']])[0]
|
||||
return picking.address_id and picking.address_id.id or False
|
||||
picking=picking_obj.browse(cr,uid,[ctx['action_id']])[0]
|
||||
return picking.address_id and picking.address_id.id or False
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -417,7 +417,39 @@
|
|||
<field name="view_id" ref="view_warehouse_tree"/>
|
||||
</record>
|
||||
<menuitem action="action_warehouse_form" id="menu_action_warehouse_form" parent="menu_stock_configuration"/>
|
||||
|
||||
|
||||
==============================
|
||||
Wizard to Fill From Unreceived Products
|
||||
===============================
|
||||
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
|
||||
<field name="name">stock.picking.move.wizard.form</field>
|
||||
<field name="model">stock.picking.move.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Move Lines">
|
||||
<field name="address_id" invisible="True"/>
|
||||
<field name="picking_id" invisible="True"/>
|
||||
<field domain="[('picking_id','<>',picking_id),('state','in',['confirmed','assigned'])]" name="move_ids" select="1"/><newline/>
|
||||
<group colspan="4">
|
||||
<button special="cancel" string="Cancel"/>
|
||||
<button name="action_move" string="Add" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="act_stock_picking_move_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Fill From Unreceived Products</field>
|
||||
<field name="res_model">stock.picking.move.wizard</field>
|
||||
<field name="src_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="auto_refresh" eval="1"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'action_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
|
||||
=============================
|
||||
Packing
|
||||
=============================
|
||||
|
@ -891,7 +923,7 @@
|
|||
</field>
|
||||
<group col="7" colspan="4">
|
||||
<label colspan="5"/>
|
||||
<button name="llk" string="Fill From Unreceived Products" type="action"/>
|
||||
<button name="%(act_stock_picking_move_wizard)d" string="Fill From Unreceived Products" type="action"/>
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" readonly="1"/>
|
||||
|
@ -1179,32 +1211,7 @@
|
|||
<field name="name">Products</field>
|
||||
<field eval="'ir.actions.act_window,%d'%act_product_location_open" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
|
||||
<field name="name">stock.picking.move.wizard.form</field>
|
||||
<field name="model">stock.picking.move.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Move Lines">
|
||||
<field name="address_id" invisible="True"/>
|
||||
<field name="picking_id" invisible="True"/>
|
||||
<field domain="[('picking_id','<>',picking_id),('address_id','=',address_id),('state','in',['confirmed','assigned'])]" name="move_ids" select="1"/><newline/>
|
||||
<group colspan="4">
|
||||
<button special="cancel" string="Cancel"/>
|
||||
<button name="action_move" string="Add" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Fill From Unreceived Products"
|
||||
context="{'action_id': active_id}"
|
||||
res_model="stock.picking.move.wizard"
|
||||
src_model="stock.picking"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
id="act_stock_picking_move_wizard"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</terp>
|
||||
|
|
Loading…
Reference in New Issue