[ADD]buttons in vehicle form and change of fields name in contracts form view

bzr revid: csn@openerp.com-20121019092235-9t5f9f65ewq9c0bc
This commit is contained in:
Cedric Snauwaert
2012-10-19 11:22:35 +02:00
parent f3acf4d60e
commit e7d66873d2
2 changed files with 60 additions and 17 deletions
+26 -4
View File
@@ -252,6 +252,28 @@ class fleet_vehicle(osv.Model):
res['domain']=[('vehicle_id','=', ids[0])]
return res
def act_show_log_cost(self, cr, uid, ids, context=None):
""" This opens log view to view and add new log for this vehicle
@return: the costs log view
"""
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet','act_show_log_cost', context)
res['context'] = {
'default_vehicle_id': ids[0]
}
res['domain']=[('vehicle_id','=', ids[0])]
return res
def act_show_log_odometer(self, cr, uid, ids, context=None):
""" This opens log view to view and add new log for this vehicle
@return: the odometer log view
"""
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet','act_show_log_odometer', context)
res['context'] = {
'default_vehicle_id': ids[0]
}
res['domain']=[('vehicle_id','=', ids[0])]
return res
def _get_odometer(self, cr, uid, ids, odometer_id, arg, context):
res = dict.fromkeys(ids, False)
for record in self.browse(cr,uid,ids,context=context):
@@ -367,7 +389,7 @@ class fleet_vehicle(osv.Model):
'company_id': fields.many2one('res.company', 'Company'),
'license_plate' : fields.char('License Plate', size=32, required=True, help='License plate number of the vehicle (ie: plate number for a car)'),
'vin_sn' : fields.char('Chassis Number', size=32, required=False, help='Unique number written on the vehicle motor (VIN/SN number)'),
'driver' : fields.many2one('res.partner', 'Driver',required=False, help='Driver of the vehicle', domain="[('employee','=',True)]"),
'driver' : fields.many2one('res.partner', 'Driver',required=False, help='Driver of the vehicle'),
'model_id' : fields.many2one('fleet.vehicle.model', 'Model', required=True, help='Model of the vehicle'),
'log_fuel' : fields.one2many('fleet.vehicle.log.fuel','vehicle_id', 'Fuel Logs'),
'log_services' : fields.one2many('fleet.vehicle.log.services','vehicle_id', 'Services Logs'),
@@ -855,11 +877,11 @@ class fleet_vehicle_log_contract(osv.Model):
#'cost_type': fields.many2one('fleet.service.type', 'Service type', required=False, help='Service type purchased with this cost', domain="[('category','=','contract')]"),
'start_date' : fields.date('Start Date', required=False, help='Date when the coverage of the contract begins'),
'expiration_date' : fields.date('Expiration Date', required=False, help='Date when the coverage of the contract expirates (by default, one year after begin date)'),
'start_date' : fields.date('Contract Start Date', required=False, help='Date when the coverage of the contract begins'),
'expiration_date' : fields.date('Contract Expiration Date', required=False, help='Date when the coverage of the contract expirates (by default, one year after begin date)'),
'warning_date' : fields.function(get_warning_date,type='integer',string='Warning Date',store=False),
'insurer_id' :fields.many2one('res.partner', 'Insurer', domain="[('supplier','=',True)]"),
'insurer_id' :fields.many2one('res.partner', 'Supplier', domain="[('supplier','=',True)]"),
'purchaser_id' : fields.many2one('res.partner', 'Contractor',domain="['|',('customer','=',True),('employee','=',True)]",help='Person to which the contract is signed for'),
'ins_ref' : fields.char('Contract Reference', size=64),
'state' : fields.selection([('open', 'In Progress'), ('closed', 'Terminated')], 'Status', readonly=True, help='Choose wheter the contract is still valid or not'),
+34 -13
View File
@@ -184,8 +184,10 @@
</div>
<div class="oe_right oe_button_box">
<button name="act_show_log_contract" type="object" string="Contracts" help="show the contract for this vehicle" />
<button name="act_show_log_fuel" type="object" string="Fuel Logs" help="show the fuel logs for this vehicle" />
<button name="act_show_log_services" type="object" string="Services Logs" help="show the services logs for this vehicle" />
<button name="act_show_log_cost" type="object" string="Costs" help="show all the costs for this vehicle" />
<button name="act_show_log_services" type="object" string="Services" help="show the services logs for this vehicle" />
<button name="act_show_log_fuel" type="object" string="Fuel Logs" help="show the fuel logs for this vehicle" />
<button name="act_show_log_odometer" type="object" string="Odometer Logs" help="show the odometer logs for this vehicle" />
</div>
<group col ="2">
<group string="General Properties">
@@ -322,7 +324,7 @@
</record>
<act_window
context="{'default_vehicle_id': active_id}"
id="act_show_log_services"
name="Services Logs"
res_model="fleet.vehicle.log.services"
@@ -331,22 +333,41 @@
view_type="form"/>
<act_window
context="{'default_vehicle_id': active_id}"
id="act_show_log_fuel"
name="Fuel Logs"
res_model="fleet.vehicle.log.fuel"
src_model="fleet.vehicle"
view_mode="tree,form"
view_mode="tree,form,graph"
view_type="form"/>
<act_window
context="{'default_vehicle_id': active_id}"
id="act_show_log_contract"
name="Contract"
res_model="fleet.vehicle.log.contract"
src_model="fleet.vehicle"
view_mode="tree,form"
view_type="form"/>
<act_window
id="act_show_log_cost"
name="Costs"
res_model="fleet.vehicle.cost"
src_model="fleet.vehicle"
view_mode="tree,form,graph"
view_type="form"/>
<act_window
id="act_show_log_odometer"
name="Costs"
res_model="fleet.vehicle.odometer"
src_model="fleet.vehicle"
view_mode="tree,form,graph"
view_type="form"
/>
<record model='ir.actions.act_window' id='fleet_vehicle_act'>
@@ -383,8 +404,8 @@
<group col="2">
<group string="Contract details">
<field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
<field name="cost_type" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
<field name="amount" string="Price"/>
<field name="cost_type" string="Contract Type" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
<field name="amount" string="Invoice Amount"/>
</group>
<group string="Odometer details">
<label for="odometer"/>
@@ -396,7 +417,7 @@
</group>
<group col="2">
<group>
<field name="date" />
<field name="date" string="Invoice Date"/>
<field name="start_date" on_change="on_change_start_date(start_date)"/>
<field name="expiration_date" />
</group>
@@ -406,11 +427,11 @@
<field name="ins_ref" />
</group>
</group>
<group>
<field name="cost_ids" context="{'vehicle_id': vehicle_id}">
<tree string="Included services" version="7.0" editable="bottom">
<group string="Included services">
<field name="cost_ids" context="{'vehicle_id': vehicle_id}" nolabel="1">
<tree version="7.0" editable="bottom">
<field name="cost_type" domain="[('category','=','service')]"/>
<field name="amount" sum="Price" string="Cost" />
<field name="amount" sum="Price" string="Indicative Cost" />
</tree>
<!--<form string="Costs" version="7.0">
<sheet>