[ADD]solved conflicts and add working buttons in vehicle view to show log

bzr revid: csn@openerp.com-20120927074817-g1t6oxf0dt3d5o1l
This commit is contained in:
Cedric Snauwaert 2012-09-27 09:48:17 +02:00
parent c88f379ea0
commit 545e3c98c3
2 changed files with 22 additions and 7 deletions

View File

@ -75,7 +75,7 @@ class fleet_vehicle(osv.Model):
return dict(res)
def action_showLog(self, cr, uid, ids, context=None):
def act_show_log(self, cr, uid, ids, context=None):
""" This opens log view to view and add new log for this vehicle
@return:
"""
@ -89,11 +89,13 @@ class fleet_vehicle(osv.Model):
#print vehicle.registration
#print logids
#print logids.type
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet','fleet_vehicle_log_act', context)
category = self.pool.get('ir.model.data').get_object(cr, uid, 'fleet', 'fleet_vehicle_form', context)
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet','act_show_log', context)
#return res
#res['context'] = {
# 'default_type': 'log',
#}
res['context'] = {
'default_vehicle_id': ids[0]#'Corsa',#category and category.id or False,
}
res['domain']=[('vehicle_id','=', ids[0])]
return res
_name = 'fleet.vehicle'

View File

@ -74,14 +74,17 @@
<field name="arch" type="xml">
<form string="Vehicle" version="7.0">
<sheet>
<div class="oe_right oe_button_box">
<button name="action_showLog" type="object" string="show logs" help="show different logs for this vehicle" domain="['name','=','name']"/>
<div class="oe_right oe_button_box">
<button name="act_show_log" type="object" string="show logs" help="show different logs for this vehicle" />
</div>
<field name="image" widget='image'/>
<group>
<field name="model_id" />
<field name="registration" />
</group>
<group col="2">
<group>
<field name="vin_sn" />
@ -237,6 +240,16 @@
</field>
</record>
<act_window
context="{'default_vehicle_id': active_id}"
id="act_show_log"
name="Logs"
res_model="fleet.vehicle.log.services"
src_model="fleet.vehicle"
view_mode="tree,form"
view_type="form"/>
<record model='ir.actions.act_window' id='fleet_vehicle_act'>
<field name="name">Vehicles</field>
<field name="res_model">fleet.vehicle</field>