[FIX] crm: fixed on_change_user that was crashing because
[odoo/odoo.git] / addons / fleet / fleet_view.xml
index bed4cd8..4d0e629 100644 (file)
@@ -8,17 +8,35 @@
                 <form string="Model" version="7.0">
                     <sheet>
                         <field name="image_medium" widget='image' class="oe_left oe_avatar"/>
-                        <group col="2">
-                            <group>
-                                <field name="brand" on_change="on_change_brand(brand)"/>
-                            </group>
-                            <group>
-                                <field name="modelname" />   
-                            </group>
-                        </group>
+                        <div class="oe_title">
+                            <label for="modelname" class="oe_edit_only"/>
+                            <h1>
+                                <field name="modelname" />
+                            </h1>
+                            <label for="brand" class="oe_edit_only"/>
+                            <h2>
+                                <field name="brand_id" on_change="on_change_brand(brand_id)"/>
+                            </h2>
+                        </div>
                         <notebook>
                             <page string="Vendors">
-                                <field name="vendors" widget="many2many_kanban"/>
+                                <field name="vendors" widget="many2many_kanban">
+                                    <kanban quick_create="false" create="true">
+                                        <field name="name"/>
+                                        <templates>
+                                            <t t-name="kanban-box">
+                                                <div style="position: relative">
+                                                    <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
+                                                    <div class="oe_module_vignette">
+                                                        <div class="oe_module_desc">
+                                                            <field name="name"/>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            </t>
+                                        </templates>
+                                    </kanban>
+                                </field>
                             </page>
                         </notebook>
                     </sheet>
             <field name="model">fleet.vehicle.model</field>
             <field name="arch" type="xml">
                 <tree string="Models" version="7.0">
-                    <field name="brand" />
+                    <field name="brand_id" />
                     <field name="modelname" />
                 </tree>
             </field>
         </record>
 
+        <record model='ir.ui.view' id='fleet_vehicle_model_search'>
+            <field name="name">fleet.vehicle.model.search</field>
+            <field name="model">fleet.vehicle.model</field>
+            <field name="arch" type="xml">
+                <search string="Vehicles costs" >
+                    <field name="brand_id" />
+                    <group expand="1" string="Group By...">
+                        <filter name="groupby_brand" context="{'group_by' : 'brand_id'}" string="Brand"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
         <record model='ir.actions.act_window' id='fleet_vehicle_model_act'>
             <field name="name">Vehicle Model</field>
             <field name="res_model">fleet.vehicle.model</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
+            <field name="context">{"search_default_groupby_brand" : True,}</field>
             <field name="help" type="html">
               <p class="oe_view_nocontent_create">
                 Click to create a new model.
         </record>
 
         <record model='ir.actions.act_window' id='fleet_vehicle_state_act'>
-            <field name="name">States of Vehicle</field>
+            <field name="name">Vehicle Status</field>
             <field name="res_model">fleet.vehicle.state</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
             </field>
         </record>
 
-        <menuitem name="Fleet" id="menu_root" sequence="70" />
-        <menuitem name="Configuration" parent="menu_root" id="fleet_configuration" sequence="3" />
+        <menuitem name="Fleet" id="menu_root" sequence="110" groups="group_fleet_user"/>
+        <menuitem name="Configuration" parent="menu_root" id="fleet_configuration" sequence="3" groups="group_fleet_manager"/>
         <menuitem action="fleet_vehicle_model_act" parent="fleet_configuration" id="fleet_vehicle_model_menu" groups="base.group_no_one"/>
         <menuitem action="fleet_vehicle_model_brand_act" parent="fleet_configuration" id="fleet_vehicle_model_brand_menu" groups="base.group_no_one"/>
-        <menuitem action="fleet_vehicle_state_act" parent="fleet_configuration" id="fleet_vehicle_state_menu" />
+        <menuitem action="fleet_vehicle_state_act" parent="fleet_configuration" id="fleet_vehicle_state_menu" groups="group_fleet_manager"/>
 
         <record model='ir.ui.view' id='fleet_vehicle_form'>
             <field name="name">fleet.vehicle.form</field>
             <field name="arch" type="xml">
                 <form string="Vehicle" version="7.0">
                     <header>
-                        <field name="state"  widget="statusbar" clickable="True" />
+                        <field name="state_id"  widget="statusbar" clickable="True" />
                     </header>
                     <sheet> 
                         <field name="image_medium" widget='image' class="oe_left oe_avatar"/> 
                         </div>
                         <div class="oe_right oe_button_box">
                             <button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_contract_act'}" string="Contracts" help="show the contract 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_cost" type="object" string="Costs" help="show all the costs for this vehicle" groups="fleet.group_fleet_manager"/>
                             <button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_services_act'}" string="Services" help="show the services logs for this vehicle" />
                             <button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_fuel_act'}" string="Fuel Logs" help="show the fuel logs for this vehicle" />
                             <button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_odometer_act'}" string="Odometer Logs" help="show the odometer logs for this vehicle" />
                         </div> 
                         <group col="2" string="General Properties">
                             <group >
-                                <field name="driver" />
+                                <field name="driver_id" />
                                 <field name="location" />
                                 <field name="vin_sn" />
                                 <field name="company_id" groups="base.group_multi_company"/>
                 <tree string="Vehicle" version="7.0" colors="orange:contract_renewal_due_soon and not contract_renewal_overdue;red:contract_renewal_overdue">
                     <field name="license_plate" />
                     <field name="model_id" />
-                    <field name="driver" />
+                    <field name="driver_id" />
                     <field name="vin_sn" />
                     <field name="acquisition_date" />
-                    <field name="state"/>
+                    <field name="state_id"/>
                     <field name="odometer" />
                     <field name="odometer_unit" />
                     <field name="contract_renewal_due_soon" invisible="1"/>
             <field name="arch" type="xml">
                 <search string="All vehicles">
                     <field name="name" filter_domain="['|', ('name','ilike',self), ('license_plate','ilike',self)]" string="Vehicle"/>
-                    <field name="driver"/>
+                    <field name="driver_id"/>
                     <field name="tag_ids"/>
                     <field name="location"/>
-                    <field name="state" />
-                    <field name="state" />
+                    <field name="state_id" />
                     <filter name="alert_true" domain="['|',('contract_renewal_due_soon','=',True),('contract_renewal_overdue','=',True)]" string="Has Alert(s)"/>
                </search>
             </field>
                 <kanban>
                     <field name="license_plate" />
                     <field name="model_id" />
-                    <field name="driver" />
+                    <field name="driver_id" />
                     <field name="location" />
-                    <field name="state" />
+                    <field name="state_id" />
 
                     <field name="image" />
                     <field name="tag_ids" />
                                     
                                     <ul>
                                         <li>
-                                            <t t-if="record.driver.raw_value"><field name="driver"/></t>
+                                            <t t-if="record.driver_id.raw_value"><field name="driver_id"/></t>
                                         </li>
                                         <li>
                                             <t t-if="record.location.raw_value"><field name="location"/></t>
                                         
                                     </ul>
 
-                                    <div class="oe_kanban_partner_categories">
-                                        <span class="oe_kanban_list_many2many">
-                                            <div modifiers="{}" name="tag_ids" class="oe_form_field oe_tags" model="fleet.vehicle.tag" t-att-data="record.tag_ids.raw_value" />
-                                        </span>
-                                    </div>
-
+                                    <field name="tag_ids"/>
                                 </div>
                             </div>
                         </t>
             </field>
         </record>
 
-        <menuitem name="Vehicles" parent="menu_root" id="fleet_vehicles" sequence="2" />
-        <menuitem action="fleet_vehicle_act" parent="fleet_vehicles" id="fleet_vehicle_menu" />
+        <menuitem name="Vehicles" parent="menu_root" id="fleet_vehicles" sequence="2" groups="group_fleet_user"/>
+        <menuitem action="fleet_vehicle_act" parent="fleet_vehicles" id="fleet_vehicle_menu" groups="group_fleet_user"/>
 
 
 
             <field name="arch" type="xml">
                 <form string="Contract logs" version="7.0">
                     <header>
-                        <button modifiers="{'invisible': [['state', '=', 'closed']]}" name="contract_close" states="open" type="object" class="oe_highlight" string="Terminate Contract"/>
-                        <button modifiers="{'invisible': [['state', '=', 'closed']]}" name="contract_close" states="toclose" type="object" class="oe_highlight" string="Terminate Contract"/>
-                        <button modifiers="{'invisible': [['state', 'not in', ['closed']]]}" name="contract_open" states="closed" type="object" class="oe_highlight" string="Set Contract In Progress"/>
-                        <button class="oe_highlight" name="act_renew_contract" type="object" string="Renew Contract" help="Create a new contract automatically with all the same informations except for the date that will start at the end of current contract" />
+                        <button modifiers="{'invisible': [['state', '=', 'closed']]}" name="contract_close" states="open" type="object" class="oe_highlight" string="Terminate Contract" groups="fleet.group_fleet_manager"/>
+                        <button modifiers="{'invisible': [['state', '=', 'closed']]}" name="contract_close" states="toclose" type="object" class="oe_highlight" string="Terminate Contract" groups="fleet.group_fleet_manager"/>
+                        <button modifiers="{'invisible': [['state', 'not in', ['closed']]]}" name="contract_open" states="closed" type="object" class="oe_highlight" string="Set Contract In Progress" groups="fleet.group_fleet_manager"/>
+                        <button class="oe_highlight" name="act_renew_contract" type="object" string="Renew Contract" help="Create a new contract automatically with all the same informations except for the date that will start at the end of current contract" groups="fleet.group_fleet_manager"/>
                         <field name="state" widget="statusbar" />
                     </header>
                     <sheet>
                         <group col="2">
                             <group string="Contract details">
                                 <field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
-                                <field name="cost_subtype" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
+                                <field name="cost_subtype_id" required="1" domain="['|',('category','=','contract'),('category','=','both')]"/>
                                 <field name="amount" string="Activation Cost"/>
                                 <label for="cost_generated"/>
                                 <div>
                                 <group>
                                     <field name="cost_ids" context="{'vehicle_id': vehicle_id}" nolabel="1" on_change="on_change_indic_cost(cost_ids)">
                                         <tree version="7.0" editable="bottom">
-                                            <field name="cost_subtype" string="Service" domain="[('category','=','service')]"/>
+                                            <field name="cost_subtype_id" string="Service" domain="[('category','=','service')]"/>
                                             <field name="amount" sum="Price" string="Indicative Cost" />
                                         </tree>
                                     </field>
                     <field name="expiration_date" />
                     <field name="days_left" invisible="1"/>
                     <field name="vehicle_id" />
-                    <field name="cost_subtype"/>
+                    <field name="cost_subtype_id"/>
                     <field name="insurer_id" />
                     <field name="amount" string="Activation Cost"/>
                     <field name="cost_generated"/>
             </field>
         </record>
 
-        <menuitem action="fleet_vehicle_log_contract_act" parent="fleet_vehicles" id="fleet_vehicle_log_contract_menu" />
+        <menuitem action="fleet_vehicle_log_contract_act" parent="fleet_vehicles" id="fleet_vehicle_log_contract_menu" groups="group_fleet_user"/>
 
        <record model='ir.ui.view' id='fleet_vehicle_odometer_form'>
             <field name="name">fleet.vehicle.odometer.form</field>
             </field>
         </record>
 
-        <menuitem action="fleet_vehicle_odometer_act" parent="fleet_vehicles" id="fleet_vehicle_odometer_menu" />
+        <menuitem action="fleet_vehicle_odometer_act" parent="fleet_vehicles" id="fleet_vehicle_odometer_menu" groups="group_fleet_user"/>
 
         <record model='ir.ui.view' id='fleet_vehicle_log_fuel_form'>
             <field name="name">fleet.vehicle.log.fuel.form</field>
             </field>
         </record>
 
-        <menuitem action="fleet_vehicle_log_fuel_act" parent="fleet_vehicles" id="fleet_vehicle_log_fuel_menu" />
+        <menuitem action="fleet_vehicle_log_fuel_act" parent="fleet_vehicles" id="fleet_vehicle_log_fuel_menu" groups="group_fleet_user"/>
 
 
         <record model='ir.ui.view' id='fleet_vehicle_log_services_form'>
                         <group col="2">
                             <group string="Services Details">
                                 <field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/>
-                                <field name="cost_subtype" string="Service Type" domain="['|',('category','=','service'),('category','=','both')]" required="1"/>
+                                <field name="cost_subtype_id" string="Service Type" domain="['|',('category','=','service'),('category','=','both')]" required="1"/>
                                 <field name="amount" string="Price"/>
                             </group>
                             <group string="Odometer Details">
                         <group string="Included Services">
                             <field name="cost_ids" nolabel="1">
                                 <tree string="Included Services" version="7.0" editable="bottom">
-                                    <field name="cost_subtype" string="Service" domain="[('category','=','service')]"/>
+                                    <field name="cost_subtype_id" string="Service" domain="[('category','=','service')]"/>
                                     <field name="amount" sum="Price" string="Cost"/>
                                 </tree>
                             </field>
                 <tree string="Services Logs">
                     <field name="date" />
                     <field name="vehicle_id" />
-                    <field name="cost_subtype"/>
+                    <field name="cost_subtype_id"/>
                     <field name="purchaser_id"/>
                     <field name="vendor_id" />
                     <field name="inv_ref" />
             </field>
         </record>
 
-        <menuitem action="fleet_vehicle_log_services_act" parent="fleet_vehicles" id="fleet_vehicle_log_services_menu" />
+        <menuitem action="fleet_vehicle_log_services_act" parent="fleet_vehicles" id="fleet_vehicle_log_services_menu" groups="group_fleet_user"/>
 
         <record model='ir.ui.view' id='fleet_vehicle_service_types_tree'>
             <field name="name">fleet.service.type.tree</field>
                     <field name="date"/>
                     <field name="vehicle_id" />
                     <field name="cost_type"/>
-                    <field name="cost_subtype"/>
+                    <field name="cost_subtype_id"/>
                     <field name="amount" sum="Total Cost"/>
                     <field name="parent_id" invisible="1" />
                     <field name="year" invisible="1"/>
             <field name="arch" type="xml">
                 <search string="Vehicles costs" >
                     <field name="vehicle_id" />
-                    <field name="cost_subtype"/>
+                    <field name="cost_subtype_id"/>
                     <field name="year"/>
                     <field name="date"/>
                     <field name="parent_id"/>
                         <filter name="groupby_year" context="{'group_by' : 'year'}" string="Year"/>
                         <filter name="groupby_date" context="{'group_by' : 'date'}" string="Date"/>
                         <filter name="groupby_cost_type" context="{'group_by' : 'cost_type'}" string="Cost Type"/>
-                        <filter name="groupby_cost_subtype" context="{'group_by' : 'cost_subtype'}" string="Cost Subtype"/>
+                        <filter name="groupby_cost_subtype_id" context="{'group_by' : 'cost_subtype_id'}" string="Cost Subtype"/>
                         <filter name="groupby_vehicle_id" context="{'group_by' : 'vehicle_id'}" string="Vehicle"/>
                         <filter name="groupby_parent_id" context="{'group_by' : 'parent_id'}" string="Parent"/>
                     </group>
                         <group col="2" string="Cost Details">
                             <group>
                                 <field name="vehicle_id" />
-                                <field name="cost_subtype"/>
+                                <field name="cost_subtype_id"/>
                                 <field name="amount"/>
                             </group>
                             <group>
             </field>
         </record>
 
-        <menuitem action="fleet_vehicle_costs_act" parent="fleet_vehicles" id="fleet_vehicle_costs_menu" />
+        <menuitem action="fleet_vehicle_costs_act" parent="fleet_vehicles" id="fleet_vehicle_costs_menu" groups="group_fleet_manager"/>
 <!--    
         <record model='ir.ui.view' id='fleet_hr_employee_form'>
             <field name="name">fleet.hr.employee.form</field>