[IMP] stock, usability: added a help when no package, added buttons to print the delivery order/picking list on the stock.picking, removed unused deprecated fields 'pack' and 'delivery' on stock.picking.type

bzr revid: qdp-launchpad@openerp.com-20131218133306-t6auefwf81vh21l6
This commit is contained in:
Quentin (OpenERP)
2013-12-18 14:33:06 +01:00
parent b2fed7e0b2
commit b8564a7bc2
2 changed files with 29 additions and 9 deletions
+20 -7
View File
@@ -749,6 +749,7 @@ class stock_picking(osv.osv):
'pack_operation_ids': fields.one2many('stock.pack.operation', 'picking_id', string='Related Packing Operations'),
'pack_operation_exist': fields.function(_get_pack_operation_exist, type='boolean', string='Pack Operation Exists?', help='technical field for attrs in view'),
'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True),
'picking_type_code': fields.related('picking_type_id', 'code', type='char', string='Picking Type Code', help="Technical field used to display the correct label on print button in the picking view"),
'owner_id': fields.many2one('res.partner', 'Owner', help="Default Owner"),
# Used to search on pickings
@@ -786,6 +787,24 @@ class stock_picking(osv.osv):
default['pack_operation_ids'] = []
return super(stock_picking, self).copy(cr, uid, id, default, context)
def do_print_delivery(self, cr, uid, ids, context=None):
'''This function prints the delivery order'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
datas = {
'model': 'stock.picking',
'ids': ids,
}
return {'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list', 'datas': datas, 'nodestroy': True}
def do_print_picking(self, cr, uid, ids, context=None):
'''This function prints the picking list'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
datas = {
'model': 'stock.picking',
'ids': ids,
}
return {'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list.internal', 'datas': datas, 'nodestroy': True}
def action_confirm(self, cr, uid, ids, context=None):
todo = []
todo_force_assign = []
@@ -2673,7 +2692,6 @@ class stock_warehouse(osv.osv):
'warehouse_id': new_id,
'code': 'outgoing',
'sequence_id': out_seq_id,
'delivery': True,
'default_location_src_id': output_loc.id,
'default_location_dest_id': customer_loc.id,
'color': color}, context=context)
@@ -2685,7 +2703,6 @@ class stock_warehouse(osv.osv):
'default_location_src_id': wh_stock_loc.id,
'default_location_dest_id': wh_stock_loc.id,
'active': True,
'pack': False,
'color': color}, context=context)
pack_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Pack'),
@@ -2695,7 +2712,6 @@ class stock_warehouse(osv.osv):
'default_location_src_id': wh_pack_stock_loc.id,
'default_location_dest_id': output_loc.id,
'active': delivery_steps == 'pick_pack_ship',
'pack': True,
'color': color}, context=context)
pick_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Pick'),
@@ -2705,7 +2721,6 @@ class stock_warehouse(osv.osv):
'default_location_src_id': wh_stock_loc.id,
'default_location_dest_id': wh_pack_stock_loc.id,
'active': delivery_steps != 'ship_only',
'pack': False,
'color': color}, context=context)
#write picking types on WH
@@ -3579,14 +3594,12 @@ class stock_picking_type(osv.osv):
_columns = {
'name': fields.char('Name', translate=True, required=True),
'complete_name': fields.function(_get_name, type='char', string='Name'),
'pack': fields.boolean('Prefill Pack Operations', help='This picking type needs packing interface'),
'auto_force_assign': fields.boolean('Automatic Availability', help='This picking type does\'t need to check for the availability in source location.'),
'color': fields.integer('Color'),
'delivery': fields.boolean('Print delivery'),
'sequence_id': fields.many2one('ir.sequence', 'Reference Sequence', required=True),
'default_location_src_id': fields.many2one('stock.location', 'Default Source Location'),
'default_location_dest_id': fields.many2one('stock.location', 'Default Destination Location'),
'code': fields.selection([('incoming', 'Suppliers'), ('outgoing', 'Customers'), ('internal', 'Internal')], 'Picking type code', required=True),
'code': fields.selection([('incoming', 'Suppliers'), ('outgoing', 'Customers'), ('internal', 'Internal')], 'Type of Operation', required=True),
'return_picking_type_id': fields.many2one('stock.picking.type', 'Picking Type for Returns'),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', ondelete='cascade'),
'active': fields.boolean('Active'),
+9 -2
View File
@@ -757,6 +757,10 @@
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
</header>
<sheet>
<div class="oe_right oe_button_box">
<button name="do_print_delivery" string="Delivery Order" groups="stock.group_stock_user" type="object" attrs="{'invisible': ['|', ('picking_type_code', '!=', 'outgoing'), ('state', '!=', 'assigned')]}"/>
<button name="do_print_picking" string="Picking List" groups="stock.group_stock_user" type="object" attrs="{'invisible': ['|', ('picking_type_code', '=', 'outgoing'), ('state', '!=', 'assigned')]}"/>
</div>
<h1>
<field name="name" class="oe_inline" attrs="{'invisible': [('name','=','/')]}" readonly="1"/>
</h1>
@@ -810,6 +814,7 @@
<field name="move_type"/>
<field name="picking_type_id"/>
<field name="priority"/>
<field name="picking_type_code"/>
<field name="quant_reserved_exist" invisible="1"/>
</group>
<group>
@@ -1392,13 +1397,11 @@
<field name="name"/>
<field name="sequence_id"/>
<field name="warehouse_id"/>
<field name="pack"/>
</group>
<group>
<field name="code" on_change="onchange_picking_code(code)"/>
<field name="return_picking_type_id"/>
<field name="auto_force_assign"/>
<field name="delivery"/>
</group>
</group>
<separator string="Locations"/>
@@ -2027,6 +2030,10 @@
<field name="context">{}</field>
<field name="name">Packages</field>
<field name="res_model">stock.quant.package</field>
<field name="help" type="html">
<p>Packages are usually created by pack operations made on transfers and can contains several different products. You can then reuse a package to move its whole content somewhere else, or to pack it into another bigger package. A package can also be unpacked, allowing the disposal of its former content as single units again.
</p>
</field>
</record>
<menuitem id="menu_package" name="Packages" parent="menu_stock_product" action="action_package_view" groups="product.group_stock_packaging"/>