[IMP]stock: Improved field_view_get for label string, set a button string for related...
authorMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Fri, 23 Mar 2012 11:42:55 +0000 (17:12 +0530)
committerMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Fri, 23 Mar 2012 11:42:55 +0000 (17:12 +0530)
bzr revid: mma@tinyerp.com-20120323114255-j8erd9001pd7owgy

addons/purchase/stock_view.xml
addons/stock/stock.py
addons/stock/stock_view.xml

index c25addd..39ce8cb 100644 (file)
@@ -68,8 +68,8 @@
                     <group col="8" colspan="4">
                         <filter icon="terp-check" name="available" string="Available"
                             domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
-                        <filter icon="terp-dialog-close" name="done" string="Done"
-                            domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
+                        <filter icon="terp-dialog-close" name="done" string="Received"
+                            domain="[('state','=','done')]" help="Incoming Shipments already Received"/>
                         <separator orientation="vertical"/>
                         <filter icon="terp-accessories-archiver-minus" string="Back Orders"
                             domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
index 56e1841..c2436d6 100644 (file)
@@ -19,6 +19,7 @@
 #
 ##############################################################################
 
+from lxml import etree
 from datetime import datetime
 from dateutil.relativedelta import relativedelta
 import time
@@ -1702,9 +1703,17 @@ class stock_move(osv.osv):
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
         if context is None:
             context = {}
-        type = context.get('default_picking_type', False)
+        type = context.get('default_type', False)
         res = super(stock_move, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
         if type:
+            doc = etree.XML(res['arch'])
+            if type == 'out':
+                #To Update button label in case of shipping type is out
+                if view_type == 'tree':
+                    for node in doc.xpath("//button[@string='Receive']"):
+                        node.set('string', _('Deliver'))
+                for node in doc.xpath("//group/button[@string='Process Now']"):
+                    node.set('string', _('Deliver'))
             for field in res['fields']:
                 # To update the states label according to the containing shipping type
                 if field == 'state':
@@ -1727,6 +1736,7 @@ class stock_move(osv.osv):
                                 value = _('Delivered')
                         _state.append((key,value))
                     res['fields']['state']['selection'] = _state
+                    res['arch'] = etree.tostring(doc)
         return res
 
     def _default_location_destination(self, cr, uid, context=None):
index 3133738..8236e42 100644 (file)
             <field name="arch" type="xml">
                 <search string="Search Stock Picking">
                     <group>
-                        <filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Available Pickings"/>
-                        <filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Pickings"/>
-                        <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
+                        <filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
+                        <filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Incoming Shipments Confirmed"/>
+                        <filter icon="terp-dialog-close" name="done" string="Received" domain="[('state','=','done')]" help="Incoming Shipments already Received"/>
                         <separator orientation="vertical"/>
                         <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
                         <separator orientation="vertical"/>
-                        <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Internal Pickings to invoice"/>
+                        <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Internal Shipments to invoice"/>
                         <separator orientation="vertical"/>
                         <field name="name"/>
                         <field name="address_id"/>
                     <group col="4" colspan="2">
                         <button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
                         <button name="force_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
-                        <button name="action_done" states="draft,assigned,confirmed" string="Deliver" type="object" icon="gtk-jump-to"/>
+                        <button name="action_done" states="draft,assigned,confirmed" string="Process Now" type="object" icon="gtk-jump-to"/>
                         <button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
                     </group>
                 </form>
             <field name="view_mode">tree,form</field>
             <field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
             <field name="view_id" ref="view_move_tree_reception_picking"/>
-            <field name="context" eval="'{\'default_picking_type\':\'in\', \'search_default_receive\':1, \'search_default_available\':1, \'product_receive\' : True, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_suppliers'),ref('stock_location_stock') )"/>
+            <field name="context" eval="'{\'default_type\':\'in\', \'search_default_receive\':1, \'search_default_available\':1, \'product_receive\' : True, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_suppliers'),ref('stock_location_stock') )"/>
             <field name="search_view_id" ref="view_move_search_reception_incoming_picking"/>
             <field name="help">Here you can receive individual products, no matter what purchase order or picking order they come from. You will find the list of all products you are waiting for. Once you receive an order, you can filter based on the name of the supplier or the purchase order reference. Then you can confirm all products received using the buttons on the right of each line.</field>
         </record>
             <field name="view_mode">tree,form</field>
             <field name="domain">['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','out')]</field>
             <field name="view_id" ref="view_move_tree_reception_picking"/>
-            <field name="context" eval="'{\'default_picking_type\':\'out\', \'search_default_receive\':1,\'search_default_available\':1, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_stock'),ref('stock_location_customers'))"/>
+            <field name="context" eval="'{\'default_type\':\'out\', \'search_default_receive\':1,\'search_default_available\':1, \'default_location_id\':%d, \'default_location_dest_id\':%d}' % (ref('stock_location_stock'),ref('stock_location_customers'))"/>
             <field name="search_view_id" ref="view_move_search_reception_outcoming_picking"/>
             <field name="help">You will find in this list all products you have to deliver to your customers. You can process the deliveries directly from this list using the buttons on the right of each line. You can filter the products to deliver by customer, products or sale order (using the Origin field).</field>
         </record>