[MERGE] branch with fix of traceability on stock.production.lot

bzr revid: qdp-launchpad@openerp.com-20140127125050-fx162fj5lx62taqe
This commit is contained in:
Quentin (OpenERP)
2014-01-27 13:50:50 +01:00
4 changed files with 33 additions and 6 deletions
+1 -1
View File
@@ -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. """),
+28
View File
@@ -1164,6 +1164,34 @@ 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 lots
@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
"""
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):
moves |= {move.id for move in quant.history_ids}
if moves:
return {
'domain': "[('id','in',["+','.join(map(str, list(moves)))+"])]",
'name': _('Traceability'),
'view_mode': 'tree,form',
'view_type': 'form',
'context': {'tree_view_ref': 'stock.view_move_tree'},
'res_model': 'stock.move',
'type': 'ir.actions.act_window',
}
return False
# ----------------------------------------------------
# Move
+1 -1
View File
@@ -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>
+3 -4
View File
@@ -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" attrs="{'invisible': [('quant_ids','=',[])]}"/>
</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.