[ADD] button to open the reservation move

This commit is contained in:
Guewen Baconnier
2013-09-05 15:09:14 +02:00
parent 6025d1e906
commit 3f83830efc
3 changed files with 21 additions and 5 deletions

View File

@@ -31,10 +31,10 @@
Stock Reserve
=============
Allows to create stock reservation on a product or a selection of
products. The reservations can be monitored and lifted on the product
view. Each reservation can have a validity date, once reached, the
reservation is automatically lifted.
Allows to create stock reservation on a product.
Each reservation can have a validity date, once passed, the reservation
is automatically lifted.
""",
'depends': ['stock',

View File

@@ -19,8 +19,8 @@
#
##############################################################################
from openerp.osv import orm, fields
from openerp.tools.translate import _
class stock_reservation(orm.Model):
@@ -137,3 +137,17 @@ class stock_reservation(orm.Model):
if not product_id or product_qty <= 0.0:
return {'value': {'product_qty': 0.0}}
return {}
def open_move(self, cr, uid, ids, context=None):
assert len(ids) == 1, "1 ID expected, got %r" % ids
reserv = self.read(cr, uid, ids[0], ['move_id'], context=context,
load='_classic_write')
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
get_ref = mod_obj.get_object_reference
__, action_id = get_ref(cr, uid, 'stock', 'action_move_form2')
action = act_obj.read(cr, uid, action_id, context=context)
action['name'] = _('Reservation Move')
action['domain'] = str([('id', '=', reserv['move_id'])])
return action

View File

@@ -15,6 +15,8 @@
string="Release"
class="oe_highlight"
states="assigned,confirmed,done"/>
<button name="open_move" type="object"
string="View Reservation Move"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,done"/>
</header>