[IMP] improved error message, constraints must allways propose a solution
[odoo/odoo.git] / addons / hr_recruitment / hr_recruitment_view.xml
index fd95929..69a7c10 100644 (file)
@@ -17,7 +17,7 @@
         <field name="view_type">form</field>
         <field name="view_id" ref="crm.crm_case_categ_tree-view"/>
         <field name="domain">[('object_id.model', '=', 'hr.applicant')]</field>
-        <field name="context">{'object_id':'hr.applicant'}</field>
+        <field name="context" eval="{'object_id': ref('model_hr_applicant')}"/>
     </record>
     # ------------------------------------------------------
     # Stage
@@ -89,7 +89,8 @@
                     <field name="user_id"/>
                     <field name="survey" invisible="1"/>
                     <button name="action_print_survey" string="Interview" type="object" icon="gtk-print" attrs="{'readonly':[('survey','=',False)]}"/>
-                    <button name="%(survey.action_view_survey_question_message)d" string="Answer" type="action" icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant', 'cur_id' :active_id}" attrs="{'readonly':[('survey','=',False)]}" groups="base.group_extended"/>
+                    <button name="%(survey.action_view_survey_question_message)d" string="Answer" type="action" icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}" attrs="{'readonly':[('survey','=',False)]}" groups="base.group_extended"/>
+                    <field name="response" invisible="1"/>
                     <newline/>
                     <field name="date_action"/>
                     <field name="title_action"/>
                         </group>
                         <group col="2" colspan="2">
                             <separator colspan="2" string="Qualification"/>
-                            <!-- <field name="type_id" domain="[('object_id.model', '=', 'hr.applicant')]"/>-->
-                            <field name="type_id" widget="selection"/>
+                            <field name="type_id"/>
                             <field name="priority" string="Appreciation"/>
                             <field name="source_id"/>
                             <field name="reference"/>
                         </group>
                         <separator colspan="4" string="Status"/>
                         <group col="8" colspan="4">
-                            <field name="state"/>
+                            <field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
                             <button name="case_cancel" string="Refuse" states="draft,open,pending" type="object" icon="gtk-cancel"/>
                             <button name="case_open" string="In Progress" states="draft,pending" type="object" icon="gtk-go-forward"/>
                             <button name="case_pending" string="Pending" states="open" type="object" icon="gtk-media-pause"/>
                        <group colspan="4">
                            <field colspan="4" name="email_cc" string="Global CC" widget="char"/>
                        </group>
-                       <field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
+                       <field name="message_ids" colspan="4" nolabel="1" mode="tree" readonly="1">
                             <tree string="History">
                                 <field name="display_text" string="History Information"/>
-                                <field name="history" invisible="1"/>
+                                <field name="email_from" invisible="1"/>
                                 <button
-                                    string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
-                                    name="%(crm.action_crm_send_mail)d"
-                                    context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
+                                    string="Reply" attrs="{'invisible': [('email_from', '=', False)]}"
+                                    name="%(mail.action_email_compose_message_wizard)d"
+                                    context="{'mail.compose.message.mode':'reply', 'message_id':active_id}"
                                     icon="terp-mail-replied" type="action" />
                             </tree>
-                            <form string="History">
-                                <group col="4" colspan="4">
-                                    <field name="email_from"/>
-                                    <field name="date"/>
-                                    <field name="email_to" widget="char" size="512"/>
-                                    <field name="email_cc" widget="char" size="512"/>
-                                    <field name="name" colspan="4" widget="char" size="512"/>
-                                    <field name="history" invisible="1"/>
-                                </group>
-                                <notebook colspan="4">
-                                    <page string="Details">
-                                        <group attrs="{'invisible': [('history', '!=', True)]}">
-                                            <field name="description" colspan="4" nolabel="1" height="250"/>
-                                            <button colspan="4"
-                                                string="Reply"
-                                                name="%(crm.action_crm_send_mail)d"
-                                                context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
-                                                icon="terp-mail-replied" type="action" />
-                                        </group>
-                                        <group attrs="{'invisible': [('history', '=', True)]}">
-                                            <field name="display_text" colspan="4" nolabel="1"  height="250"/>
-                                        </group>
-                                    </page>
-                                    <page string="Attachments">
-                                        <field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
-                                    </page>
-                                </notebook>
-                            </form>
                         </field>
-                         <button string="Add Internal Note"
+                        <button string="Add Internal Note"
                                 name="%(crm.action_crm_add_note)d"
                                 context="{'model': 'crm.lead' }"
                                 icon="terp-document-new" type="action" />
                         <button string="Send New Email"
-                           name="%(crm.action_crm_send_mail)d"
-                           context="{'mail':'new', 'model': 'hr.applicant'}"
-                           icon="terp-mail-message-new" type="action" />
+                            name="%(mail.action_email_compose_message_wizard)d"
+                            icon="terp-mail-message-new" type="action"/>
                  </page>
                  <page string="Notes">
                      <field name="description" nolabel="1" colspan="4"/>
         <field name="type">search</field>
         <field name="arch" type="xml">
             <search string="Search Jobs">
-               <filter icon="terp-check" string="Current"
-                   domain="[('state','in',('draft','open'))]"
-                   help="All new and in progress jobs"
-                   name="current"
-               />
-               <separator orientation="vertical"/>
-               <filter icon="terp-document-new" string="New"
+               <filter icon="terp-document-new" string="New" name="filter_new" 
                    domain="[('state','=','draft')]"
                    help="All Initial Jobs"
                />
-               <filter icon="terp-camera_test" string="In Progress"
+               <filter icon="terp-camera_test" string="In Progress" name="filter_inprogress"
                    domain="[('state','=','open')]"
                    help="Open Jobs"
                />
                <field name="partner_name" filter_domain="['|','|',('name','ilike',self),('partner_name','ilike',self),('email_from','ilike',self)]" string="Subject / Applicant"/>
                <field name="job_id" widget="selection"/>
                <field name="user_id">
-                    <filter domain="[('user_id','=',False)]" help="Unassigned Recruitments" icon="terp-personal-" separator="1"/>
+                    <filter domain="[('user_id','=',False)]" help="Unassigned Recruitments" icon="terp-personal-" />
                </field>
                <newline/>
-                <group expand="0" string="Group By..." colspan="11" col="20">
+                <group expand="0" string="Group By...">
                     <filter string="Responsible" icon="terp-personal" domain="[]"  context="{'group_by':'user_id'}"/>
                     <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
                     <separator orientation="vertical"/>
         </field>
     </record>
 
+    <!-- hr Applicant Kanban View -->
 
+    <record model="ir.ui.view" id="hr_kanban_view_applicant">
+        <field name="name">Hr Applicants kanban</field>
+        <field name="model">hr.applicant</field>
+        <field name="type">kanban</field>
+        <field name="arch" type="xml">
+            <kanban default_group_by="stage_id">
+                <field name="color"/>
+                <field name="state"/>
+                <field name="priority"/>
+                <field name="survey"/>
+                <field name="user_id"/>
+                <field name="user_email"/>
+                <templates>
+                    <t t-name="partner-infos">
+                        <div t-if="record.partner_phone.raw_value">
+                            Phone: <field name="partner_phone"/>
+                        </div>
+                        <div t-if="record.partner_mobile.raw_value">
+                            Mobile: <field name="partner_mobile"/>
+                        </div>
+                    </t>
+                    <t t-name="kanban-box">
+                        <t t-if="record.priority.raw_value == 1" t-set="border">oe_kanban_color_red</t>
+                        <div t-attf-class="#{kanban_color(record.color.raw_value)} #{border || ''}">
+                            <div class="oe_kanban_box oe_kanban_color_border">
+                                <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
+                                <tr>
+                                    <td align="left" valign="middle" class="oe_kanban_title" tooltip="partner-infos">
+                                        <field name="partner_name"/>
+                                        <t t-if="!record.partner_name.raw_value">
+                                            <field name="email_from"/>
+                                        </t>
+                                    </td>
+                                    <td valign="top" width="22"><img t-att-src="kanban_gravatar(record.user_email.value, 22)" class="oe_kanban_gravatar" t-att-title="record.user_id.value"/></td>
+                                </tr>
+                                </table>
+                                <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
+                                    <div class="oe_kanban_right">
+                                        <span class="oe_kanban_highlight">
+                                            <t t-set="priority" t-value="record.priority.raw_value || 5"/>
+                                            <a type="object" name="set_priority" args="['3']" t-if="priority gt 3">
+                                                <img src="/web/static/src/img/icons/star-off.png" width="16" height="16"/>
+                                            </a>
+                                            <a type="object" name="set_priority" args="['5']" t-if="priority lte 3">
+                                                <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16"/>
+                                            </a>
+                                            <a type="object" name="set_priority" args="['2']">
+                                                <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16"/>
+                                            </a>
+                                            <a type="object" name="set_priority" args="['1']">
+                                                <img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16"/>
+                                            </a>
+                                        </span>
+                                    </div>
+
+                                    <field name="job_id"/>
+                                    <t t-if="!record.job_id.raw_value">
+                                        <field name="name"/>
+                                    </t>
+
+                                    <div class="oe_kanban_clear" style="padding-top: 4px"/>
+
+                                    <div t-if="record.type_id.raw_value or record.source_id.raw_value">
+                                        <span t-if="record.type_id.raw_value" class="oe_kanban_highlight oe_kanban_button" style="font-size: 100%%">
+                                            <field name="type_id"/>
+                                        </span>
+                                        <span t-if="record.source_id.raw_value" class="oe_kanban_highlight oe_kanban_button" style="font-size: 100%%">
+                                            <field name="source_id"/>
+                                        </span>
+                                    </div>
+                                    <div t-if="record.date_action.raw_value or record.title_action.raw_value">
+                                        <i t-if="record.date_action.raw_value"><field name="date_action"/> :</i> <field name="title_action"/>
+                                    </div>
+                                </div>
+                                <div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
+                                    <div class="oe_kanban_left">
+                                        <a string="Edit" icon="gtk-edit" type="edit"/>
+                                        <a string="Delete" icon="gtk-close" type="delete"/>
+                                        <a string="Change Color" icon="color-picker" type="color" name="color"/>
+                                        <a string="Send New Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action"/>
+                                        <a string="Add Internal Note" name="%(crm.action_crm_add_note)d" context="{'model': 'crm.lead' }" icon="terp-document-new" type="action"/>
+                                        <a string="Schedule Meeting" name="action_makeMeeting" type="object" icon="stock_calendar"/>
+                                        <a t-if="record.survey.raw_value" name="action_print_survey" type="object" string="Print Interview" icon="gtk-print" />
+                                    </div>
+                                    <div class="oe_kanban_right">
+                                        <a name="case_open" string="In Progress" states="draft,pending" type="object" icon="kanban-apply"/>
+                                        <a name="case_pending" string="Pending" states="draft,open" type="object" icon="kanban-pause"/>
+                                    </div>
+                                    <br class="oe_kanban_clear"/>
+                                </div>
+                            </div>
+                        </div>
+                    </t>
+                </templates>
+            </kanban>
+        </field>
+    </record>
     # ------------------------------------------------------
     # HR Job
     # ------------------------------------------------------