[ADD]correction to contract and service view following the pad

bzr revid: csn@openerp.com-20121004121256-o9givbda7jjhl6go
This commit is contained in:
Cedric Snauwaert 2012-10-04 14:12:56 +02:00
parent 845a97a3df
commit 1d69dcb10f
2 changed files with 43 additions and 28 deletions

View File

@ -669,6 +669,25 @@ class fleet_vehicle_log_contract(osv.Model):
_inherits = {'fleet.vehicle.cost': 'cost_id'}
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
if not ids:
return []
reads = self.browse(cr, uid, ids, context=context)
res = []
for record in reads:
if record.vehicle_id.name:
name = str(record.vehicle_id.name)
if record.cost_type.name:
name = name+ ' / '+ str(record.cost_type.name)
res.append((record.id, name))
return res
def _vehicle_contract_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
res = self.name_get(cr, uid, ids, context=context)
return dict(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):
@ -748,7 +767,7 @@ class fleet_vehicle_log_contract(osv.Model):
_name = 'fleet.vehicle.log.contract'
_order='state,expiration_date'
_columns = {
'name' : fields.function(_vehicle_contract_name_get_fnc, type="text", string='Name', store=True),
#'name' : fields.char('Name',size=64),
'date' :fields.date('Contract Date',help='Date when the contract has been signed'),

View File

@ -355,6 +355,7 @@
<group string="Contract details">
<field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
<field name="cost_type" required="1" domain="[('category','=','contract')]"/>
<field name="amount" string="Price"/>
</group>
<group string="Odometer details">
<label for="odometer"/>
@ -378,21 +379,21 @@
</group>
<group>
<field name="costs" context="{'vehicle_id': vehicle_id}">
<tree string="Costs" version="7.0">
<field name="cost_type" />
<field name="amount" />
<tree string="Costs" version="7.0" editable="bottom">
<field name="cost_type"/>
<field name="amount" string="Cost" />
</tree>
<form string="Costs" version="7.0">
<!--<form string="Costs" version="7.0">
<sheet>
<group>
<field name="cost_type" />
<field name="amount" />
</group>
</sheet>
</form>
</form>-->
</field>
<field name="amount" />
</group>
<group string="Terms and Conditions">
<field name="notes" nolabel="1" placeholder="Write here all other information relative to this contract" />
@ -414,7 +415,7 @@
<field name="expiration_date" />
<field name="warning_date" invisible="1"/>
<field name="insurer_id" />
<field name="amount" />
<field name="amount"/>
<field name="notes" />
</tree>
@ -582,35 +583,19 @@
<form string="Services Logs" version="7.0">
<sheet>
<group col="2">
<group string="Vehicle Details">
<group string="Services Details">
<field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
<field name="cost_type" domain="[('category','=','contract')]"/>
<field name="cost_type" domain="[('category','=','contract')]" required="1"/>
<field name="amount" string="Price"/>
</group>
<group string="Odometer Details">
<label for="odometer"/>
<div>
<field name="odometer" class="oe_inline"/>
<field name="odometer" string="value" class="oe_inline"/>
<field name="odometer_unit" class="oe_inline"/>
</div>
</group>
</group>
<group string="Service Details">
<field name="service_ids">
<tree string="Services" version="7.0">
<field name="cost_type" />
<field name="amount" />
</tree>
<form string="Services" version="7.0">
<sheet>
<group>
<field name="cost_type" />
<field name="amount" />
</group>
</sheet>
</form>
</field>
<field name="amount" />
</group>
<group col="2">
<group string="Additional Details">
<field name="date" />
@ -619,6 +604,17 @@
<field name="inv_ref" />
</group>
</group>
<group string="Service Details">
<field name="service_ids">
<tree string="Services" version="7.0" editable="bottom">
<field name="cost_type" />
<field name="amount" string="Cost"/>
</tree>
</field>
</group>
<group string="Notes">
<field nolabel="1" name="notes" />
</group>