[IMP]stock: Improved field_view_get for label string, set a button string for related view

bzr revid: mma@tinyerp.com-20120323114255-j8erd9001pd7owgy
This commit is contained in:
Mayur Maheshwari (OpenERP) 2012-03-23 17:12:55 +05:30
parent 90e826397b
commit c996418b4d
3 changed files with 20 additions and 10 deletions

View 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"/>

View 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):

View File

@ -830,13 +830,13 @@
<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"/>
@ -1470,7 +1470,7 @@
<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>
@ -1739,7 +1739,7 @@
<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>
@ -1875,7 +1875,7 @@
<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>