[MERGE]: with trunk
[odoo/odoo.git] / addons / crm / crm_lead_view.xml
index df6a4a0..08d7b33 100644 (file)
             <field name="model">crm.case.stage</field>
             <field name="arch" type="xml">
                 <search string="Stage Search">
-                    <field name="name" string="Stage Name"/>
-                    <field name="state"/>
+                    <field name="name"/>
                     <field name="type"/>
+                    <field name="sequence"/>
+                    <field name="probability"/>
                 </search>
             </field>
         </record>
             <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" class="oe_highlight"/>
-                    <button name="case_reset" string="Reset" type="object"
-                            states="cancel"/>
-                    <button name="case_cancel" string="Cancel Case" type="object"
-                            states="draft,open,pending"/>
+                            attrs="{'invisible': [('probability', '=', 100)]}"
+                            help="Convert to Opportunity" class="oe_highlight"/>
                     <field name="stage_id" widget="statusbar" clickable="True"
                             domain="['&amp;', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"
                             on_change="onchange_stage_id(stage_id)"/>
                             <field name="phone"/>
                             <field name="mobile"/>
                             <field name="fax"/>
-                            <!--
-                            This should be integrated in Open Chatter
-                            <button string="Mail"
-                                name="%(mail.action_email_compose_message_wizard)d"
-                                icon="terp-mail-message-new" type="action" colspan="1"/>
-                            -->
                         </group>
                         <group>
                             <field name="user_id" on_change="on_change_user(user_id, context)"
                                 <field name="section_id"/>
                                 <button name="case_escalate" string="Escalate"
                                         type="object" class="oe_link"
-                                        attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
+                                        attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
                             </div>
                             <field name="type" invisible="1"/>
                         </group>
                                 <field name="company_id"
                                     groups="base.group_multi_company"
                                     widget="selection" colspan="2"/>
-                                <field name="state" groups="base.group_no_one"/>
                             </group>
                             <group string="Mailings">
                                 <field name="opt_out"/>
                             </group>
                             <group string="Misc">
+                                <field name="probability" groups="base.group_no_one"/>
                                 <field name="active"/>
                                 <field name="referred"/>
                             </group>
             <field name="name">Leads</field>
             <field name="model">crm.lead</field>
             <field name="arch" type="xml">
-                <tree string="Leads" fonts="bold:message_unread==True" colors="grey:state in ('cancel', 'done')">
+                <tree string="Leads" fonts="bold:message_unread==True" colors="grey:probability == 100">
                     <field name="date_deadline" invisible="1"/>
                     <field name="create_date"/>
                     <field name="name"/>
                     <field name="user_id" invisible="1"/>
                     <field name="partner_id" invisible="1"/>
                     <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/>
-                    <field name="state" invisible="1"/>
+                    <field name="probability" invisible="1"/>
                     <field name="type_id" invisible="1"/>
                     <field name="referred" invisible="1"/>
                     <field name="channel_id" invisible="1"/>
             <field name="model">crm.lead</field>
             <field name="arch" type="xml">
                 <kanban default_group_by="stage_id">
-                    <field name="state" groups="base.group_no_one"/>
                     <field name="stage_id"/>
                     <field name="color"/>
                     <field name="priority"/>
                     <field name="create_date"/>
                     <field name="country_id" context="{'invisible_country': False}"/>
                     <separator/>
-                    <filter string="Open" name="open" domain="[('state','!=','cancel')]" help="Open Leads"/>
-                    <filter string="Dead" name="dead" domain="[('state','=','cancel')]"/>
+                    <filter string="Open" name="open" domain="[('user_id', '!=', 'False'), ('probability', '!=', 100)]" help="Open and Assigned Leads"/>
+                    <filter string="Dead" name="dead" domain="[('probability', '=', '0'), ('stage_id.sequence', '!=', 1)]"/>
                     <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/>
-                    <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/>
                     <filter string="Assigned to Me"
                             domain="[('user_id','=',uid)]" context="{'invisible_section': False}"
                             help="Leads that are assigned to me"/>
                     <filter string="Assigned to My Team(s)"
                             domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
                             help="Leads that are assigned to any sales teams I am member of" groups="base.group_multi_salesteams"/>
+                    <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/>
                     <separator />
                     <filter string="Available for mass mailing"
                             name='not_opt_out' domain="[('opt_out', '=', False)]"
             <field name="arch" type="xml">
                 <form string="Opportunities" version="7.0">
                     <header>
-                        <button name="case_mark_won" string="Mark Won" type="object"
-                                states="draft,open,pending" class="oe_highlight"/>
-                        <button name="case_mark_lost" string="Mark Lost" type="object"
-                                states="draft,open" class="oe_highlight"/>
-                        <field name="stage_id" widget="statusbar" clickable="True"/>
+                        <button name="case_mark_won" string="Mark Won" type="object" class="oe_highlight"
+                                attrs="{'invisible': [('probability', '=', 100)]}"/>
+                        <button name="case_mark_lost" string="Mark Lost" type="object" class="oe_highlight"/>
+                        <field name="stage_id" widget="statusbar" clickable="True"
+                                domain="['&amp;', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/>
                     </header>
                     <sheet>
                         <div class="oe_right oe_button_box">
-                            <button string="Schedule/Log Call"
-                                name="%(opportunity2phonecall_act)d"
-                                type="action"/>
-                            <button string="Meeting"
+                            <button string="Schedule/Log Call" type="action"
+                                name="%(opportunity2phonecall_act)d"/>
+                            <button string="Meeting" type="object"
                                 name="action_makeMeeting"
-                                type="object"
                                 context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
                         </div>
                         <div class="oe_title">
                                 <label for="section_id" groups="base.group_multi_salesteams"/>
                                 <div groups="base.group_multi_salesteams">
                                     <field name="section_id" widget="selection"/>
-                                    <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
+                                    <button name="case_escalate" string="Escalate" type="object" class="oe_link"
+                                            attrs="{'invisible': ['|', ('section_id','=',False), ('probability', '=', 100)]}"/>
                                 </div>
                             </group>
                             <group>
                                     <field name="day_open" groups="base.group_no_one"/>
                                     <field name="day_close" groups="base.group_no_one"/>
                                     <field name="referred"/>
-                                    <field name="state" invisible="1"/>
                                     <field name="type" invisible="1"/>
                                 </group>
                                 <group string="References">
             <field name="name">Opportunities Tree</field>
             <field name="model">crm.lead</field>
             <field name="arch" type="xml">
-                <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:state in ('cancel', 'done');red:date_deadline and (date_deadline &lt; current_date)">
+                <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:probability == 100;red:date_deadline and (date_deadline &lt; current_date)">
                     <field name="date_deadline" invisible="1"/>
                     <field name="create_date"/>
                     <field name="name" string="Opportunity"/>
                     <field name="referred" invisible="1"/>
                     <field name="priority" invisible="1"/>
                     <field name="message_unread" invisible="1"/>
-                    <field name="state" invisible="1"/>
+                    <field name="probability" invisible="1"/>
+                    <field name="write_date" invisible="1"/>
                 </tree>
             </field>
         </record>
                     <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/>
                     <field name="user_id"/>
                     <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
+                    <field name="stage_id"/>
+                    <field name="probability"/>
                     <separator/>
-                    <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/>
-                    <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/>
-                    <filter string="Won" name="won" domain="[('state','=','done')]"/>
-                    <filter string="Lost" name="lost" domain="[('state','=','cancel')]"/>
+                    <filter string="New" name="new" domain="[('probability', '=', 0), ('stage_id.sequence', '=', 1)]" help="New Opportunities"/>
+                    <filter string="Won" name="won" domain="[('probability', '=', 100)]"/>
+                    <filter string="Lost" name="lost" domain="[('probability', '=',0), ('stage_id.sequence, '!=', 1')]"/>
                     <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/>
                     <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/>
                     <filter string="My Opportunities" name="assigned_to_me"
                         <filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
                         <filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
                         <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
+                        <filter string="Last Update Month"  icon="terp-go-month"
+                            domain="[]" context="{'group_by':'write_date'}"/>
                     </group>
                     <group string="Display">
                         <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
             <field name="state">code</field>
             <field name="code">
                 if context.get('active_model') == 'crm.lead' and context.get('active_ids'):
-                    self.case_cancel(cr, uid, context['active_ids'], context=context)
+                    self.case_mark_lost(cr, uid, context['active_ids'], context=context)
             </field>
             <field name="groups_id" eval="[(4,ref('base.group_sale_salesman'))]"/>
         </record>