Improvement on delivery grid tree view

bzr revid: hmo@tinyerp.com-20080920115120-ew4uk5vu4r10yk3h
This commit is contained in:
Harshad Modi 2008-09-20 17:21:20 +05:30
parent fec257ca0a
commit 959c926ae5
3 changed files with 3 additions and 9 deletions

View File

@ -34,13 +34,7 @@ from tools.translate import _
class delivery_carrier(osv.osv):
_name = "delivery.carrier"
_description = "Carrier and delivery grids"
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
res = super(delivery_carrier,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
if not context.get('order_id',False) and view_type=='tree':
res['fields']['price'].update({'invisible':"True"})
return res
_description = "Carrier and delivery grids"
def get_price(self, cr, uid, ids, field_name, arg=None, context={}):
res={}

View File

@ -12,7 +12,7 @@
<tree string="Carrier">
<field name="name"/>
<field name="partner_id"/>
<field name="price"/>
<field name="price" invisible="'order_id' not in context"/>
</tree>
</field>
</record>

View File

@ -37,7 +37,7 @@ from tools.translate import _
delivery_form = """<?xml version="1.0"?>
<form string="Create deliveries">
<separator colspan="4" string="Delivery Method" />
<field name="carrier_id" context="{'order_id':active_id}"/>
<field name="carrier_id"/>
</form>
"""