[IMP] picking wave improvements

bzr revid: qdp-launchpad@openerp.com-20130801155239-5gxvuk111n7zic0x
This commit is contained in:
Quentin (OpenERP) 2013-08-01 17:52:39 +02:00
commit 4abe6782e2
3 changed files with 33 additions and 10 deletions

View File

@ -4,6 +4,7 @@ from openerp.tools.translate import _
class stock_picking_wave(osv.osv): class stock_picking_wave(osv.osv):
_name = "stock.picking.wave" _name = "stock.picking.wave"
_order = "name desc"
_columns = { _columns = {
'name': fields.char('name', required=True, help='Name of the picking wave'), 'name': fields.char('name', required=True, help='Name of the picking wave'),
'partner_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'), 'partner_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'),
@ -11,7 +12,7 @@ class stock_picking_wave(osv.osv):
'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'), 'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'),
'capacity': fields.float('Capacity', help='The capacity of the transport used to get the goods'), 'capacity': fields.float('Capacity', help='The capacity of the transport used to get the goods'),
'capacity_uom': fields.many2one('product.uom', 'Unit of Measure', help='The Unity Of Measure of the transport capacity'), 'capacity_uom': fields.many2one('product.uom', 'Unit of Measure', help='The Unity Of Measure of the transport capacity'),
'state': fields.selection([('in_progress', 'Running'), ('done', 'Done')], required=True), 'state': fields.selection([('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], required=True),
} }
_defaults = { _defaults = {
'name': '/', 'name': '/',
@ -24,7 +25,8 @@ class stock_picking_wave(osv.osv):
def cancel_picking(self, cr, uid, ids, context=None): def cancel_picking(self, cr, uid, ids, context=None):
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context) picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
return self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context) self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context)
return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
def print_picking(self, cr, uid, ids, context=None): def print_picking(self, cr, uid, ids, context=None):
''' '''

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Sequences for picking wave -->
<record id="seq_type_picking_wave" model="ir.sequence.type">
<field name="name">Picking Wave</field>
<field name="code">picking.wave</field>
</record>
<record id="seq_picking_wave" model="ir.sequence">
<field name="name">Picking Wave</field>
<field name="code">picking.wave</field>
<field name="prefix">Wave/</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
</data>
</openerp>

View File

@ -7,21 +7,20 @@
<form string="Stock Picking Waves" version="7.0"> <form string="Stock Picking Waves" version="7.0">
<header> <header>
<button name="done" states="in_progress" string="Done" type="object" class="oe_highlight"/> <button name="done" states="in_progress" string="Done" type="object" class="oe_highlight"/>
<field name="state" widget="statusbar"/> <button name="cancel_picking" string="Cancel" type="object" states="in_progress"/>
<field name="state" widget="statusbar" statusbar_visible="in_progress,done"/>
</header> </header>
<sheet> <sheet>
<div class="oe_right oe_button_box"> <div class="oe_right oe_button_box">
<button name="confirm_picking" string="Confirm all pickings" type="object"/>
<button name="cancel_picking" string="Cancel all pickings" type="object"/>
<button name="print_picking" string="Print all internal pickings" type="object" context="{'report':'stock.picking.list.internal'}"/> <button name="print_picking" string="Print all internal pickings" type="object" context="{'report':'stock.picking.list.internal'}"/>
<button name="print_picking" string="Print all in/out pickings" type="object" context="{'report':'stock.picking.list'}"/> <button name="print_picking" string="Print all in/out pickings" type="object" context="{'report':'stock.picking.list'}"/>
<button name="confirm_picking" string="Confirm all pickings" type="object"/>
</div> </div>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="name" class="oe_inline" readonly="1"/> <field name="name" class="oe_inline" readonly="1"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="partner_id"/> <field name="partner_id"/>
@ -35,9 +34,7 @@
<field name="time" widget="float_time"/> <field name="time" widget="float_time"/>
</group> </group>
</group> </group>
<separator string="Pickings"/> <separator string="Pickings"/>
<field name="picking_ids" widget="many2many"> <field name="picking_ids" widget="many2many">
<tree> <tree>
<field name="name"/> <field name="name"/>
@ -60,12 +57,13 @@
<field name="name">picking.wave.tree</field> <field name="name">picking.wave.tree</field>
<field name="model">stock.picking.wave</field> <field name="model">stock.picking.wave</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Stock Picking Waves"> <tree string="Stock Picking Waves" colors="black:state in ('in_progress','done');grey: state=='cancel'">
<field name="name"/> <field name="name"/>
<field name="partner_id"/> <field name="partner_id"/>
<field name="capacity"/> <field name="capacity"/>
<field name="capacity_uom"/> <field name="capacity_uom"/>
<field name="time" widget="float_time"/> <field name="time" widget="float_time"/>
<field name="state"/>
</tree> </tree>
</field> </field>
</record> </record>
@ -75,7 +73,13 @@
<field name="model">stock.picking.wave</field> <field name="model">stock.picking.wave</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Search Picking Waves"> <search string="Search Picking Waves">
<filter name="in_progress" string="In progress" domain="[('state','=','in_progress')]" help="Picking Waves not finished"/> <field name="name" string="Picking Wave"/>
<filter name="in_progress" string="In Progress" domain="[('state','=', 'in_progress')]" help="Picking Waves not finished"/>
<field name="partner_id"/>
<group expand="0" string="Group By...">
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>