mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[ADD] button to open the reservation move
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user