[FIX]Contract service type marked as services for category

bzr revid: dle@openerp.com-20121025112443-e63z1ox0kr4jpqci
This commit is contained in:
Denis Ledoux dle@openerp.com 2012-10-25 13:24:43 +02:00
parent d8beadf48b
commit 62ce9fbaaf
4 changed files with 19 additions and 24 deletions

View File

@ -42,11 +42,6 @@
<field name="category">service</field>
</record>
<record id="type_service_service_4" model="fleet.service.type">
<field name="name">Insurances</field>
<field name="category">service</field>
</record>
<record id="type_service_service_5" model="fleet.service.type">
<field name="name">Summer tires</field>
<field name="category">service</field>
@ -387,17 +382,17 @@
<field name="category">service</field>
</record>
<record id="type_service_55" model="fleet.service.type">
<field name="name">Insurance</field>
<field name="category">service</field>
<record id="type_contract_omnium" model="fleet.service.type">
<field name="name">Omnium</field>
<field name="category">contract</field>
</record>
<record id="type_service_56" model="fleet.service.type">
<record id="type_contract_leasing" model="fleet.service.type">
<field name="name">Leasing</field>
<field name="category">service</field>
<field name="category">contract</field>
</record>
<record id="type_service_57" model="fleet.service.type">
<record id="type_contract_repairing" model="fleet.service.type">
<field name="name">Repairing</field>
<field name="category">both</field>
</record>

View File

@ -978,7 +978,7 @@
<field name="amount">0</field>
<field name="cost_generated">20</field>
<field name="cost_frequency">daily</field>
<field name="cost_subtype" ref="type_service_56"/>
<field name="cost_subtype" ref="type_contract_leasing"/>
<field name="date" eval="time.strftime('%Y-01-01')" />
<field name="start_date" eval="time.strftime('%Y-01-01')" />
<field name="expiration_date" eval="(DateTime.now() + timedelta(5)).strftime('%Y-%m-%d')" />
@ -1016,7 +1016,7 @@
<field name="amount">0</field>
<field name="cost_generated">150</field>
<field name="cost_frequency">weekly</field>
<field name="cost_subtype" ref="type_service_56"/>
<field name="cost_subtype" ref="type_contract_leasing"/>
<field name="date" eval="time.strftime('%Y-01-01')" />
<field name="start_date" eval="time.strftime('%Y-01-01')" />
<field name="expiration_date" eval="(DateTime.now() + timedelta(-1)).strftime('%Y-%m-%d')" />
@ -1054,7 +1054,7 @@
<field name="amount">0</field>
<field name="cost_generated">400</field>
<field name="cost_frequency">monthly</field>
<field name="cost_subtype" ref="type_service_56"/>
<field name="cost_subtype" ref="type_contract_leasing"/>
<field name="date" eval="time.strftime('%Y-01-01')"/>
<field name="start_date" eval="time.strftime('%Y-01-01')" />
<field name="expiration_date" eval="time.strftime('%Y-12-31')" />
@ -1092,7 +1092,7 @@
<field name="amount">0</field>
<field name="cost_generated">4000</field>
<field name="cost_frequency">yearly</field>
<field name="cost_subtype" ref="type_service_56"/>
<field name="cost_subtype" ref="type_contract_leasing"/>
<field name="date" eval="time.strftime('%Y-01-01')" />
<field name="start_date" eval="time.strftime('%Y-01-01')" />
<field name="expiration_date" eval="time.strftime('%Y-12-31')" />
@ -1130,7 +1130,7 @@
<field name="amount">17000</field>
<field name="cost_generated">0</field>
<field name="cost_frequency">no</field>
<field name="cost_subtype" ref="type_service_56"/>
<field name="cost_subtype" ref="type_contract_leasing"/>
<field name="date" eval="time.strftime('2012-01-01')" />
<field name="start_date" eval="time.strftime('2012-01-01')" />
<field name="expiration_date" eval="time.strftime('2016-12-31')" />

View File

@ -43,7 +43,7 @@ class fleet_vehicle_cost(osv.Model):
'name' : fields.function(_cost_name_get_fnc, type="char", string='Name', store=True),
#'name' : fields.char('Name',size=32),
'vehicle_id': fields.many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this fuel log'),
'cost_subtype': fields.many2one('fleet.service.type', 'Cost type', required=False, help='Cost type purchased with this cost'),
'cost_subtype': fields.many2one('fleet.service.type', 'Type', required=False, help='Cost type purchased with this cost'),
'amount': fields.float('Total Price'),
'cost_type' : fields.selection([('contract', 'Contract'),('services','Services'),('fuel','Fuel'),('other','Other')], 'Category of the cost', help='For internal purpose only',required=True),
'parent_id': fields.many2one('fleet.vehicle.cost', 'Parent', required=False, help='Parent cost to this current cost'),
@ -1061,8 +1061,8 @@ class fleet_vehicle_log_contract(osv.Model):
'odometer' : fields.function(_get_odometer,fnct_inv=_set_odometer,type='char',string='Odometer Value',store=False,help='Odometer measure of the vehicle at the moment of this log'),
'odometer_unit': fields.related('vehicle_id','odometer_unit',type="char",string="Unit",store=False, readonly=True),
'cost_amount': fields.related('cost_id','amount',type="float",string="Amount",store=True, readonly=True),
'cost_generated': fields.float('Recuring Costs Amount',help="Costs paid at regular intervals, depending on the cost frequency. If the cost frequency is set to unique, the cost will be logged at the start date"),
'cost_frequency': fields.selection([('no','No'),('daily', 'Daily'),('weekly','Weekly'),('monthly','Monthly'),('yearly','Yearly')], 'Cost Frequency', help='Frequency of the costs',required=True),
'cost_generated': fields.float('Recurring Cost Amount',help="Costs paid at regular intervals, depending on the cost frequency. If the cost frequency is set to unique, the cost will be logged at the start date"),
'cost_frequency': fields.selection([('no','No'),('daily', 'Daily'),('weekly','Weekly'),('monthly','Monthly'),('yearly','Yearly')], 'Recurring Cost Frequency', help='Frequency of the recuring cost',required=True),
'generated_cost_ids' : fields.one2many('fleet.vehicle.cost', 'contract_id', 'Generated Costs',ondelete='cascade'),
}
_defaults = {
@ -1071,7 +1071,7 @@ class fleet_vehicle_log_contract(osv.Model):
'start_date' : time.strftime('%Y-%m-%d'),
'state':'open',
'expiration_date' : lambda self,cr,uid,ctx: self.compute_next_year_date(time.strftime('%Y-%m-%d')),
'cost_frequency' : 'no',
}
def copy(self, cr, uid, id, default=None, context=None):

View File

@ -376,7 +376,7 @@
<group col="2">
<group string="Contract details">
<field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
<field name="cost_subtype" string="Contract Type" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
<field name="cost_subtype" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
<field name="amount" string="Activation Cost"/>
<label for="cost_generated"/>
<div>
@ -409,7 +409,7 @@
<group>
<field name="cost_ids" context="{'vehicle_id': vehicle_id}" nolabel="1">
<tree version="7.0" editable="bottom">
<field name="cost_subtype" domain="[('category','=','service')]"/>
<field name="cost_subtype" string="Service" domain="[('category','=','service')]"/>
<field name="amount" sum="Price" string="Indicative Cost" />
</tree>
</field>
@ -451,13 +451,13 @@
<field name="arch" type="xml">
<tree string="Contract logs" version="7.0" colors="orange:warning_date>0 and warning_date&lt;15;red:warning_date==0;grey:state=='closed'">
<field name="vehicle_id" />
<field name="cost_subtype" />
<field name="cost_subtype"/>
<field name="state" />
<field name="start_date" />
<field name="expiration_date" />
<field name="warning_date" invisible="1"/>
<field name="insurer_id" />
<field name="amount" string="Activation Costs" help="Costs paid the day of the contract realization. The costb will be logged at the invoice date"/>
<field name="amount" string="Activation Cost"/>
<field name="cost_generated"/>
<field name="cost_frequency"/>
<field name="notes" />