← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~hirt/ocb-addons/6.1_stock_use_date_always into lp:ocb-addons/6.1

 

Etienne Hirt has proposed merging lp:~hirt/ocb-addons/6.1_stock_use_date_always into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)

For more details, see:
https://code.launchpad.net/~hirt/ocb-addons/6.1_stock_use_date_always/+merge/194646

[6.1] Improve Sorting for pickings (always make date valid use date for sorting)
-- 
https://code.launchpad.net/~hirt/ocb-addons/6.1_stock_use_date_always/+merge/194646
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~hirt/ocb-addons/6.1_stock_use_date_always into lp:ocb-addons/6.1.
=== modified file 'stock/stock.py'
--- stock/stock.py	2013-10-02 13:19:11 +0000
+++ stock/stock.py	2013-11-11 00:35:17 +0000
@@ -1512,7 +1512,7 @@
         return (res and res[0]) or False
     _name = "stock.move"
     _description = "Stock Move"
-    _order = 'date_expected desc, id'
+    _order = 'date desc, id'
     _log_create = False
 
     def action_partial_move(self, cr, uid, ids, context=None):
@@ -1705,6 +1705,8 @@
                     if frozen_fields.intersection(vals):
                         raise osv.except_osv(_('Operation forbidden'),
                                              _('Quantities, UoMs, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator)'))
+        if move.state != 'done' and vals.get('date_expected'):
+            vals['date'] = vals.get('date_expected')
         return  super(stock_move, self).write(cr, uid, ids, vals, context=context)
 
     def copy(self, cr, uid, id, default=None, context=None):

=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml	2013-10-28 11:57:54 +0000
+++ stock/stock_view.xml	2013-11-11 00:35:17 +0000
@@ -161,7 +161,7 @@
                                         states="draft,done,cancel"/>
                                     <field name="location_id"/>
                                     <field name="location_dest_id"/>
-                                    <field name="date" string="Date"/>
+                                    <field name="date" string="Date" readonly="1"/>
                                     <field name="state"  invisible="True"/>
                                 </tree>
                              </field>
@@ -348,7 +348,7 @@
                                     <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
                                     <field name="product_uom" string="UoM"/>
                                     <field name="tracking_id"/>
-                                    <field name="date"/>
+                                    <field name="date" readonly="1"/>
                                     <field name="prodlot_id" groups="base.group_extended"/>
                                     <field name="location_id"/>
                                     <field name="location_dest_id"/>
@@ -433,7 +433,7 @@
                     <field name="location_id" />
                     <field name="location_dest_id" />
                     <field name="create_date"/>
-                    <field name="date" string="Date"/>
+                    <field name="date" string="Date" readonly="1"/>
                     <field name="date_expected" string="Date Expected"/>
                     <field name="state"/>
                 </tree>
@@ -457,7 +457,7 @@
                     <field name="location_id" />
                     <field name="location_dest_id" />
                     <field name="create_date" />
-                    <field name="date" string="Date"/>
+                    <field name="date" string="Date" readonly="1"/>
                      <field name="date_expected" string="Date Expected"/>
                     <field name="state"/>
                 </tree>
@@ -766,7 +766,7 @@
                                     <group colspan="2" col="2">
                                         <separator string="Dates" colspan="2" />
                                         <field name="create_date" invisible="1"/>
-                                        <field name="date"/>
+                                        <field name="date" readonly="1"/>
                                         <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                                     </group>
 
@@ -928,7 +928,7 @@
                                         groups="base.group_extended"
                                         states="draft,assigned,confirmed"/>
                                     <field name="location_id"/>
-                                    <field name="date"/>
+                                    <field name="date" readonly="1"/>
                                     <field name="state"/>
                                     <button name="%(action_partial_move_server)d" string="Process" type="action" states="confirmed,assigned" icon="gtk-go-forward"/>
                                 </tree>
@@ -957,7 +957,7 @@
                                     <group colspan="2" col="2">
                                         <separator string="Dates" colspan="2" />
                                         <field name="create_date" invisible="1"/>
-                                        <field name="date"/>
+                                        <field name="date" readonly="1"/>
                                         <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                                     </group>
 
@@ -1177,7 +1177,7 @@
                                     <group colspan="2" col="2">
                                         <separator string="Dates" colspan="2" />
                                         <field name="create_date" invisible="1"/>
-                                        <field name="date"/>
+                                        <field name="date" readonly="1"/>
                                         <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                                     </group>
 
@@ -1393,7 +1393,7 @@
                         states="draft,assigned,confirmed,done"/>
                     <field name="location_id"/>
                     <field name="location_dest_id"/>
-                    <field name="date"/>
+                    <field name="date" readonly="1"/>
                     <field name="date_expected"/>
                     <field name="state"/>
                     <button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
@@ -1440,7 +1440,7 @@
                     <group colspan="2" col="2">
                         <separator string="Dates" colspan="2" />
                         <field name="create_date" groups="base.group_extended"/>
-                        <field name="date" groups="base.group_extended"/>
+                        <field name="date" groups="base.group_extended" readonly="1"/>
                         <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                     </group>
 
@@ -1564,7 +1564,7 @@
                         groups="base.group_extended"
                         icon="terp-stock_effects-object-colorize"
                         states="draft,assigned,confirmed,done"/>
-                    <field name="date"/>
+                    <field name="date" readonly="1"/>
                     <field name="state"/>
                     <button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
                     <button name="action_done" string="Process" type="object" states="confirmed,assigned" icon="gtk-go-forward"/>
@@ -1584,7 +1584,7 @@
                     <field name="product_id"/>
                     <field name="product_qty" />
                     <field name="product_uom" string="UoM"/>
-                    <field name="date"/>
+                    <field name="date" readonly="1"/>
                     <field name="state"/>
                     <button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
                 </tree>
@@ -1629,7 +1629,7 @@
                     <group colspan="2" col="2">
                         <separator string="Dates" colspan="2" />
                         <field name="create_date" groups="base.group_extended"/>
-                        <field name="date" groups="base.group_extended"/>
+                        <field name="date" groups="base.group_extended" readonly="1"/>
                         <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
                     </group>
 


Follow ups