[IMP]crm:make stages clickable for statusbar with stage
[odoo/odoo.git] / addons / crm / crm_lead_view.xml
index 623c20c..dc17fac 100644 (file)
@@ -2,34 +2,42 @@
 <openerp>
     <data>
 
-        <record id="actions_server_crm_unread" model="ir.actions.server">
+        <!-- Read/Unread actions -->
+        <record id="actions_server_crm_lead_unread" model="ir.actions.server">
             <field name="name">Mark unread</field>
             <field name="condition">True</field>
             <field name="type">ir.actions.server</field>
             <field name="model_id" ref="model_crm_lead"/>
             <field name="state">code</field>
-            <field name="code">object.message_mark_as_unread()</field>
+            <field name="code">self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context)</field>
         </record>
-
-        <record id="act_multi_crm_lead_mark_unread" model="ir.values">
-            <field name="name">actions_server_crm_unread</field>
-            <field name="action_id" ref="actions_server_crm_unread"/>
+        <record id="action_crm_lead_unread" model="ir.values">
+            <field name="name">action_crm_lead_unread</field>
+            <field name="action_id" ref="actions_server_crm_lead_unread"/>
+            <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_unread'))" />
             <field name="key">action</field>
             <field name="model_id" ref="model_crm_lead" />
             <field name="model">crm.lead</field>
             <field name="key2">client_action_multi</field>
         </record>
 
-<!--
-        <record id="act_multi_hr_holidays_mark_unread" model="ir.values">
-            <field name="name">Hr holidays Mark unread</field>
-            <field name="value" eval="'ir.actions.server,' + str(ref('mail.actions_server_mail_thread_unread'))" />
+        <record id="actions_server_crm_lead_read" model="ir.actions.server">
+            <field name="name">Mark read</field>
+            <field name="condition">True</field>
+            <field name="type">ir.actions.server</field>
+            <field name="model_id" ref="model_crm_lead"/>
+            <field name="state">code</field>
+            <field name="code">self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context)</field>
+        </record>
+        <record id="action_crm_lead_read" model="ir.values">
+            <field name="name">action_crm_lead_read</field>
+            <field name="action_id" ref="actions_server_crm_lead_read"/>
+            <field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_read'))" />
             <field name="key">action</field>
-            <field name="model_id" ref="hr_holidays.model_hr_holidays" />
-            <field name="model">hr_holidays</field>
+            <field name="model_id" ref="model_crm_lead" />
+            <field name="model">crm.lead</field>
             <field name="key2">client_action_multi</field>
         </record>
--->
 
         <!--
             CRM CASE STAGE
             <form string="Leads Form" version="7.0">
                 <header>
                     <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
-                            states="draft,open,pending" help="Convert to Opportunity"/>
-                    <button name="case_escalate" string="Escalate" type="object"
+                            states="draft,open,pending" help="Convert to Opportunity" class="oe_highlight"/>
+                    <button name="case_escalate" string="Escalate" type="object"  
                             states="draft,open,pending"/>
                     <button name="case_reset" string="Reset" type="object"
                             states="cancel"/>
                     <button name="case_cancel" string="Cancel" type="object"
                             states="draft,open,pending"/>
-                    <button name="message_mark_as_unread" string="Mark Unread" type="object"
-                            attrs="{'invisible':[('message_state', '==', False)]}"/>
-                    <button name="message_mark_as_read" string="Mark Read" type="object"
-                            attrs="{'invisible':[('message_state', '==', True)]}"/>
                     <field name="stage_id" widget="statusbar"
                             on_change="onchange_stage_id(stage_id)"/>
                 </header>
                             name="%(act_crm_opportunity_crm_phonecall_new)d"
                             string="Phone Calls" />
                     </div>
-
-                    <label for="name" class="oe_edit_only" string="Lead Description"/>
-                    <h1><field name="name" placeholder="Describe the lead..."/></h1>
-                    <field name="message_state"/>
-                    <newline/>
+                    <div class="oe_title">
+                        <label for="name" class="oe_edit_only" string="Lead Description"/>
+                        <h1><field name="name" placeholder="Describe the lead..."/></h1>
+                    </div>
                     <group>
                         <group>
                             <field name="user_id" />
                             </div>
                         </group>
                         <group>
-                            <field name="contact_name" />
+                            <label for="contact_name" />
+                            <div>
+                                <field name="contact_name" class="oe_inline"/>,
+                                <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline"/>
+                            </div>
                             <field name="email_from" widget="email"/>
                             <field name="function" />
-                            <field domain="[('domain', '=', 'contact')]" name="title"/>
                             <field name="phone"/>
                             <field name="mobile"/>
                             <field name="fax"/>
                     </page>
                     </notebook>
                 </sheet>
-                <footer>
-                    <field name="message_ids" widget="ThreadView"/>
-                </footer>
+                <div class="oe_chatter">
+                    <field name="message_ids" widget="mail_thread"/>
+                </div>
             </form>
         </field>
         </record>
                         </ul>
                     </t>
                     <t t-name="kanban-box">
-                        <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card">
+                        <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
                             <div class="oe_dropdown_toggle oe_dropdown_kanban">
-                                <span class="oe_e">i</span>
+                                <span class="oe_e">í</span>
                                 <ul class="oe_dropdown_menu">
                                     <li><a type="edit" >Edit...</a></li>
                                     <li><a type="delete">Delete</a></li>
                                     <field name="partner_id"/>
                                 </div>
                                 <div style="padding-left: 0.5em">
-                                    <i>
-                                        <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
-                                        <span t-attf-class="#{red || ''}">
-                                            <field name="date_action"/>
-                                        </span>
-                                        <t t-if="record.date_action.raw_value"> : </t>
-                                        <field name="title_action"/>
-                                    </i>
+                                    <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
+                                    <span t-attf-class="#{red || ''}"><field name="date_action"/></span>
+                                    <t t-if="record.date_action.raw_value"> : </t>
+                                    <field name="title_action"/>
                                 </div>
-                                <div class="oe_right">
-                                    <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
-                                    <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.7; filter:alpha(opacity=70);"/>
+                                <div class="oe_kanban_bottom_right">
+                                    <a t-if="record.priority.raw_value == 1" type="object" name="set_normal_priority" class="oe_e oe_star_on">7</a>
+                                    <a t-if="record.priority.raw_value != 1" type="object" name="set_high_priority" class="oe_e oe_star_off">7</a>
                                     <!--
                                     <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kaban_status_red</t>
                                     <span t-attf-class="oe_kanban_status #{red}"> </span>
         <field name="arch" type="xml">
             <form string="Opportunities" version="7.0">
                 <header>
-                    <button name="stage_previous" string="Previous" type="object"
-                            states="open" icon="gtk-go-back" context="{'stage_type': 'opportunity'}"/>
-                    <button name="stage_next" string="Next" type="object"  
-                            states="open" icon="gtk-go-forward" context="{'stage_type': 'opportunity'}"/>
                     <button name="case_mark_won" string="Mark Won" type="object"
-                            states="draft,open,pending"/>
-                    <button name="case_open" string="Open" type="object"
+                            states="open" class="oe_highlight"/>
+                    <button name="case_mark_won" string="Mark Won" type="object"
                             states="draft,pending"/>
                     <button name="case_escalate" string="Escalate" type="object"
-                            states="open"/>
+                            states="open" />
                     <button name="case_mark_lost" string="Mark Lost" type="object"
                             states="draft,open"/>
-                    <button name="case_reset" string="Reset to Draft" type="object"
-                            states="done,cancel"/>
                     <button name="case_cancel" string="Cancel" type="object"
                             states="draft"/>
-                    <button name="message_mark_as_unread" string="Mark Unread" type="object"
-                            attrs="{'invisible':[('message_state', '==', False)]}"/>
-                    <button name="message_mark_as_read" string="Mark Read" type="object"
-                            attrs="{'invisible':[('message_state', '==', True)]}"/>
                     <field name="stage_id" widget="statusbar"
-                            on_change="onchange_stage_id(stage_id)"/>
+                            on_change="onchange_stage_id(stage_id)" clickable="1"/>
                 </header>
                 <sheet>
                     <div class="oe_right oe_button_box">
                     <div class="oe_title">
                         <label for="name" class="oe_edit_only"/>
                         <h1><field name="name"/></h1>
-                        <newline/>
-                        <field name="message_state"/>
-                        <newline/>
-
                         <label for="planned_revenue" class="oe_edit_only"/>
                         <h2>
                             <field name="planned_revenue" class="oe_inline"/>
-                            <field name="company_currency" class="oe_edit_only oe_inline"/> at 
-                            <field name="probability" class="oe_inline"/> %% success rate
+                            <field name="company_currency" class="oe_inline"/> at 
+                            <field name="probability" class="oe_inline"/>%% success rate
                         </h2>
                     </div>
                     <group>
                                 <div>
                                     <field name="street" placeholder="Street..."/>
                                     <field name="street2"/>
-                                    <div>
-                                        <field name="zip" class="oe_inline" placeholder="ZIP"/>
-                                        <field name="city" class="oe_inline" placeholder="City"/>
+                                    <div class="address_format">
+                                        <field name="city" placeholder="City" style="width: 40%%"/>
+                                        <field name="state_id" class="oe_no_button" placeholder="State" style="width: 24%%"/>
+                                        <field name="zip" placeholder="ZIP" style="width: 34%%"/>
                                     </div>
-                                    <field name="state_id" placeholder="State"/>
                                     <field name="country_id" placeholder="Country"/>
                                 </div>
                             </group>
 
                             <group>
-                                <field name="contact_name" />
+                                <label for="contact_name" />
+                                <div>
+                                    <field name="contact_name" class="oe_inline"/>
+                                    <field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline oe_no_button"/>
+                                </div>
                                 <field name="function" />
-                                <field domain="[('domain', '=', 'contact')]" name="title"/>
                                 <field name="mobile"/>
                                 <field name="fax"/>
                             </group>
                     </page>
                     </notebook>
                 </sheet>
-                <footer>
-                    <field name="message_ids" widget="ThreadView"/>
-                </footer>
+                <div class="oe_chatter">
+                    <field name="message_ids" widget="mail_thread"/>
+                </div>
             </form>
         </field>
     </record>
                         help="Opportunities that are assigned to either me or one of the sale teams I manage" />
                 <separator orientation="vertical"/>
                 <field name="user_id"/>
-                <field name="country"/>
+                <field name="country_id"/>
                 <field name="partner_id"/>
                 <field name="section_id"
                     context="{'invisible_section': False, 'default_section_id': self}"/>