[IMP] New traceability button instead of down/upstream buttons
bzr revid: jco@openerp.com-20140124163032-6g24pwusfla9z00n
This commit is contained in:
parent
2f5f6c831b
commit
49d549bb39
|
@ -69,7 +69,7 @@ This installs the module product_expiry."""),
|
|||
help="""Allows you to create and manage your packaging dimensions and types you want to be maintained in your system."""),
|
||||
'group_stock_tracking_lot': fields.boolean("Track serial number on products",
|
||||
implied_group='stock.group_tracking_lot',
|
||||
help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the upstream or downstream traceability of that product."""),
|
||||
help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the traceability of that product."""),
|
||||
'group_stock_tracking_owner': fields.boolean("Manage owner on stock",
|
||||
implied_group='stock.group_tracking_owner',
|
||||
help="""This way you can receive products attributed to a certain owner. """),
|
||||
|
|
|
@ -1162,6 +1162,45 @@ class stock_production_lot(osv.osv):
|
|||
('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'),
|
||||
]
|
||||
|
||||
def action_traceability(self, cr, uid, ids, context=None):
|
||||
""" It traces the information of a product
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary of values
|
||||
"""
|
||||
if not ids or len(ids) == 0:
|
||||
return False #TODO give warning instead
|
||||
quant_obj = self.pool.get("stock.quant")
|
||||
move_obj = self.pool.get("stock.move")
|
||||
quants = quant_obj.search(cr, uid, [('lot_id', 'in', ids)], context=context)
|
||||
moves = set()
|
||||
for quant in quant_obj.browse(cr, uid, quants, context=context):
|
||||
for move in quant.history_ids:
|
||||
moves.add(move.id)
|
||||
# import pdb
|
||||
# pdb.set_trace()
|
||||
if moves:
|
||||
# ir_model_data = self.pool.get('ir.model.data')
|
||||
# try:
|
||||
# template_id = ir_model_data.get_object_reference(cr, uid, 'stock', 'view_move_tree')[1]
|
||||
# except:
|
||||
# template_id = False
|
||||
return {
|
||||
'domain': "[('id','in',["+','.join(map(str, list(moves)))+"])]",
|
||||
'name': 'Traceability',
|
||||
'view_mode': 'tree, form',
|
||||
'view_type': 'tree',
|
||||
'res_model': 'stock.move',
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Move
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<field name="subtype_id" ref="mail.mt_comment"/>
|
||||
<field name="subject">Warehouse Management application installed!</field>
|
||||
<field name="body"><![CDATA[<p>Manage your product inventoy and stock locations: you can control stock moves history and planning,
|
||||
watch your stock valuation, and track production lots upstream and downstream (based on serial numbers).</p>]]></field>
|
||||
watch your stock valuation, and track production lots (based on serial numbers).</p>]]></field>
|
||||
</record>
|
||||
|
||||
|
||||
|
|
|
@ -191,8 +191,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Serial Number" version="7.0">
|
||||
<div class="oe_button_box oe_right">
|
||||
<button name="action_traceability" string="Upstream Traceability" type="object"/>
|
||||
<button name="action_traceability" string="Downstream Traceability" type="object"/>
|
||||
<button name="action_traceability" string="Traceability" type="object"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
|
@ -261,9 +260,9 @@
|
|||
Click to add a serial number.
|
||||
</p><p>
|
||||
This is the list of all the production lots you recorded. When
|
||||
you select a lot, you can get the upstream or downstream
|
||||
you select a lot, you can get the
|
||||
traceability of the products contained in lot. By default, the
|
||||
list is filtred on the serial numbers that are available in
|
||||
list is filtered on the serial numbers that are available in
|
||||
your warehouse but you can uncheck the 'Available' button to
|
||||
get all the lots you produced, received or delivered to
|
||||
customers.
|
||||
|
|
Loading…
Reference in New Issue