Jiten (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-social-hr_recruitment-jra into 
lp:~openerp-dev/openobject-addons/trunk-social-jra.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-social-hr_recruitment-jra/+merge/96092
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-social-hr_recruitment-jra/+merge/96092
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-social-hr_recruitment-jra into 
lp:~openerp-dev/openobject-addons/trunk-social-jra.
=== modified file 'crm/crm.py'
--- crm/crm.py	2012-03-06 10:50:17 +0000
+++ crm/crm.py	2012-03-06 11:02:33 +0000
@@ -258,6 +258,7 @@
             data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
         return {'value': data}
 
+<<<<<<< TREE
     def _case_opportunity_meeting_notification(self, cr, uid, ids, context=None):
         return True
 
@@ -283,6 +284,30 @@
         return True
 
     def case_open(self, cr, uid, ids, context=None):
+=======
+    def _case_opportunity_meeting_notification(self, cr, uid, ids, context=None):
+        return True
+
+    def _case_open_notification(self, case, context=None):
+        return True
+
+    def _case_close_notification(self, case, context=None):
+        return True
+
+    def _case_cancel_notification(self, case, context=None):
+        return True
+
+    def _case_pending_notification(self, case, context=None):
+        return True
+
+    def _case_escalate_notification(self, case, context=None):
+        return True
+
+    def _case_phonecall_notification(self, case, action, context=None):
+        return True
+
+    def case_open(self, cr, uid, ids, context=None):
+>>>>>>> MERGE-SOURCE
         """Opens Case
         :param ids: List of case Ids
         """

=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2012-03-06 10:50:17 +0000
+++ crm/crm_lead.py	2012-03-06 11:02:33 +0000
@@ -271,6 +271,7 @@
     def stage_find_won(self, cr, uid, section_id):
         return self.stage_find_percent(cr, uid, 100.0, section_id)
 
+<<<<<<< TREE
     def _case_reset_notification(self,  cr, uid, ids, context=None):
         for lead in self.browse(cr, uid, ids, context=context):
             if lead.type == 'lead':
@@ -361,6 +362,90 @@
                 stage_id = self.stage_find(cr, uid, lead.section_id.id or False, [('sequence','>',0)])
                 if stage_id:
                     self.stage_set(cr, uid, [lead.id], stage_id)
+=======
+    def _case_create_notification(self, cr, uid, ids, context=None):
+        for obj in self.browse(cr, uid, ids, context=context):
+            self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
+            if obj.type=="opportunity" and obj.state=="draft":
+                message = _("Opportunity is <b>created</b>.")
+            elif obj.type=="lead" :
+                message = _("Lead is <b>created</b>.")
+            else:
+                message = _("The case has been <b>created</b>.")
+            self.message_append_note(cr, uid, ids, _('System notification'),
+                        message, type='notification', need_action_user_id=obj.user_id.id, context=context)
+        return True
+
+    def _case_open_notification(self, lead, context=None):
+        if lead.state != 'draft' and lead.state != 'pending':
+            return False
+        if lead.type == 'lead':
+            message = _("The lead has been <b>opened</b>.")
+        elif lead.type == 'opportunity':
+            message = _("The opportunity has been <b>opened</b>.")
+        else:
+            message = _("The case has been <b>opened</b>.")
+        lead.message_append_note('' ,message, need_action_user_id=lead.user_id.id)
+
+    def _case_close_notification(self, lead, context=None):
+        lead[0].message_mark_done(context)
+        if lead[0].type == 'lead':
+            message = _("The lead has been <b>closed</b>.")
+        elif lead[0].type == 'opportunity':
+            message = _("The opportunity has been <b>closed</b>.")
+        else:
+            message = _("The case has been <b>closed</b>.")
+        lead[0].message_append_note('' ,message)
+
+    def _case_mark_lost_notification(self, lead, context=None):
+        lead.message_mark_done(context)
+        message = _("The opportunity has been <b>marked as lost</b>.")
+        lead.message_append_note('' ,message)
+
+    def _case_mark_won_notification(self, lead, context=None):
+        lead.message_mark_done(context)
+        message = _("The opportunity has been <b>won</b>.")
+        lead.message_append_note('' ,message)
+
+    def _case_cancel_notification(self, lead, context=None):
+        lead[0].message_mark_done(context)
+        if lead[0].type == 'lead':
+            message = _("The lead has been <b>cancelled</b>.")
+        elif lead[0].type == 'opportunity':
+            message = _("The opportunity has been <b>cancelled</b>.")
+        lead[0].message_append_note('' ,message)
+
+    def _case_pending_notification(self, case, context=None):
+        if case[0].type == 'lead':
+            message = _("The lead is <b>pending</b>.")
+        elif case[0].type == 'opportunity':
+            message = _("The opportunity is <b>pending</b>.")
+        case[0].message_append_note('' ,message)
+
+    def _case_escalate_notification(self, case, context=None):
+        message = _("The lead is <b>escalated</b>.")
+        case.message_append_note('' ,message)
+
+    def _case_phonecall_notification(self, cr, uid, ids, case, phonecall, action, context=None):
+        for obj in phonecall.browse(cr, uid, ids, context=context):
+            if action == "schedule" :
+                message = _("<b>%s a call</b> for the %s.") % (action, obj.date)
+            else :
+                message = _("<b>%s a call</b>.") % (action)
+            case.message_append_note('', message)
+            if action == "schedule" :
+                phonecall.message_append_note(cr, uid, ids, '', message, need_action_user_id=obj.user_id.id)
+
+    def case_open(self, cr, uid, ids, context=None):
+        res = super(crm_lead, self).case_open(cr, uid, ids, context)
+        for lead in self.browse(cr, uid, ids, context=context):
+            value = {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}
+            self.write(cr, uid, [lead.id], value)
+            if lead.type == 'opportunity' and not lead.stage_id:
+                stage_id = self.stage_find(cr, uid, lead.section_id.id or False, [('sequence','>',0)])
+                if stage_id:
+                    self.stage_set(cr, uid, [lead.id], stage_id)
+>>>>>>> MERGE-SOURCE
         return res
 
     def case_close(self, cr, uid, ids, context=None):
@@ -913,13 +998,28 @@
             # change probability of lead(s) if required by stage
             if not vals.get('probability') and stage.on_change:
                 vals['probability'] = stage.probability
+<<<<<<< TREE
+=======
+            text = _("Changed Stage to: %s") % stage.name
+
+>>>>>>> MERGE-SOURCE
             for case in self.browse(cr, uid, ids, context=context):
                 if case.type == 'lead' or context.get('stage_type') == 'lead':
+<<<<<<< TREE
                     message = _("The stage of lead has been changed to <b>%s</b>.") % (stage.name)
                     case.message_append_note('', message)
+=======
+                    message = _("The stage of lead has been changed to <b>%s</b>.") % (stage.name)
+                    case.message_append_note(text, message)
+>>>>>>> MERGE-SOURCE
                 elif case.type == 'opportunity':
+<<<<<<< TREE
                     message = _("The stage of opportunity has been changed to <b>%s</b>.") % (stage.name)
                     case.message_append_note('', message)
+=======
+                    message = _("The stage of opportunity has been changed to <b>%s</b>.") % (stage.name)
+                    case.message_append_note(text, message)
+>>>>>>> MERGE-SOURCE
 
         return super(crm_lead,self).write(cr, uid, ids, vals, context)
 

=== modified file 'crm/crm_meeting.py'
--- crm/crm_meeting.py	2012-03-06 10:50:17 +0000
+++ crm/crm_meeting.py	2012-03-06 11:02:33 +0000
@@ -80,6 +80,7 @@
         'user_id': lambda self, cr, uid, ctx: uid,
     }
 
+<<<<<<< TREE
     def create(self, cr, uid, vals, context=None):
         obj_id = super(crm_meeting, self).create(cr, uid, vals, context=context)
         self._case_opportunity_meeting_notification(cr, uid, [obj_id], context=context)
@@ -122,6 +123,24 @@
         meeting.message_append_note('' ,message, need_action_user_id=meeting.user_id.id)
 
     def case_open(self, cr, uid, ids, context=None):
+=======
+    def create(self, cr, uid, vals, context=None):
+        obj_id = super(crm_meeting, self).create(cr, uid, vals, context=context)
+        self._case_opportunity_meeting_notification(cr, uid, [obj_id], context=context)
+        return obj_id
+
+    def _case_opportunity_meeting_notification(self, cr, uid, ids, context=None):
+        lead_obj = self.pool.get('crm.lead')
+
+        for obj in self.browse(cr, uid, ids, context=context):
+            if(obj.opportunity_id.id):
+                newid = obj.opportunity_id.id
+                message = _("<b>scheduled for meeting</b> %s.") % (obj.date)
+                for lead in lead_obj.browse(cr, uid, [newid], context=context):
+                    lead.message_append_note('', message)
+
+    def case_open(self, cr, uid, ids, *args):
+>>>>>>> MERGE-SOURCE
         """Confirms meeting
         @param self: The object pointer
         @param cr: the current row, from the database cursor,

=== modified file 'crm/crm_phonecall.py'
--- crm/crm_phonecall.py	2012-03-06 09:18:55 +0000
+++ crm/crm_phonecall.py	2012-03-06 11:02:33 +0000
@@ -78,11 +78,18 @@
         'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
     }
 
+<<<<<<< TREE
     def create(self, cr, uid, vals, context=None):
         obj_id = super(crm_phonecall, self).create(cr, uid, vals, context=context)
         self.open_notification(cr, uid, [obj_id], context)
         return obj_id
 
+=======
+    def create(self, cr, uid, vals, context=None):
+        obj_id = super(crm_phonecall, self).create(cr, uid, vals, context=context)
+        return obj_id
+
+>>>>>>> MERGE-SOURCE
     def _get_default_state(self, cr, uid, context=None):
         if context and context.get('default_state', False):
             return context.get('default_state')
@@ -147,7 +154,11 @@
     def case_reset(self, cr, uid, ids, context=None):
         """Resets case as Todo
         """
+<<<<<<< TREE
         res = super(crm_phonecall, self).case_reset(cr, uid, ids, context)
+=======
+        res = super(crm_phonecall, self).case_reset(cr, uid, ids, args)
+>>>>>>> MERGE-SOURCE
         self.write(cr, uid, ids, {'duration': 0.0, 'state':'open'})
         self.open_notification(cr, uid, ids, context)
         return res

=== modified file 'hr_recruitment/hr_recruitment.py'
--- hr_recruitment/hr_recruitment.py	2011-12-31 07:57:20 +0000
+++ hr_recruitment/hr_recruitment.py	2012-03-06 11:02:33 +0000
@@ -171,7 +171,6 @@
         'partner_mobile': fields.char('Mobile', size=32),
         'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
         'department_id': fields.many2one('hr.department', 'Department'),
-        'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
         'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
         'response': fields.integer("Response"),
         'reference': fields.char('Refered By', size=128),
@@ -181,6 +180,7 @@
         'day_close': fields.function(_compute_day, string='Days to Close', \
                                 multi='day_close', type="float", store=True),
         'color': fields.integer('Color Index'),
+        'emp_id': fields.many2one('hr.employee', 'employee'),
         'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
     }
 
@@ -391,31 +391,66 @@
         self.message_append_dict(cr, uid, ids, msg, context=context)
         return res
 
-    def case_open(self, cr, uid, ids, *args):
-        """
-        @param self: The object pointer
-        @param cr: the current row, from the database cursor,
-        @param uid: the current user’s ID for security checks,
-        @param ids: List of case's Ids
-        @param *args: Give Tuple Value
-        """
-        res = super(hr_applicant, self).case_open(cr, uid, ids, *args)
+    def _case_open_notification(self, case, context=None):
+        message = _("Changed Status to <b>In Progress<b>.")
+        case.message_append_note('' ,message, type='notification')
+        return True
+
+    def _case_close_notification(self, case, context=None):
+        case[0].message_mark_done(context)
+        if case[0].emp_id:
+            message = _("Applicant is <b>Hired</b> and employee created.")
+            case[0].message_append_note('' ,message, type='notification')
+        else:
+            message = _("Applicant is <b>Hired</b>.")
+            case[0].message_append_note('' ,message, type='notification')
+        return True
+
+    def _case_cancel_notification(self, case, context=None):
+        case[0].message_mark_done(context=context)
+        message = _("Applicant is <b>Cancelled<b>.")
+        case[0].message_append_note('' ,message, type="notification")
+        return True
+
+    def _case_pending_notification(self, case, context=None):
+        message = _("Changed Status to <b>Pending<b>.")
+        case[0].message_append_note('' ,message, type='notification')
+        return True
+
+    def _case_reset_notification(self, cr, uid, ids, context=None):
+        for obj in self.browse(cr, uid, ids, context=context):
+            self.message_append_note(cr, uid, ids, _('System notification'),
+                        _("Changed Status to <b>New<b>."), type='notification', need_action_user_id=obj.user_id.id, context=context)
+        return True
+
+    def create_notificate(self, cr, uid, ids, context=None):
+        for obj in self.browse(cr, uid, ids, context=context):
+            self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
+            self.message_append_note(cr, uid, ids, _('System notification'),
+                        _("Applicant is <b>Created</b>."), type='notification', need_action_user_id=obj.user_id.id, context=context)
+        return True
+
+
+    def create(self, cr, uid, vals, context=None):
+        obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
+        self.create_notificate(cr, uid, [obj_id], context=context)
+        return obj_id
+
+    def case_open(self, cr, uid, ids, context=None):
+        """
+            open Request of the applicant for the hr_recruitment
+        """
+        res = super(hr_applicant, self).case_open(cr, uid, ids, context)
         date = self.read(cr, uid, ids, ['date_open'])[0]
         if not date['date_open']:
             self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),})
-        for (id, name) in self.name_get(cr, uid, ids):
-            message = _("The job request '%s' has been set 'in progress'.") % name
-            self.log(cr, uid, id, message)
-        return res
-
-    def case_close(self, cr, uid, ids, *args):
-        res = super(hr_applicant, self).case_close(cr, uid, ids, *args)
-        for (id, name) in self.name_get(cr, uid, ids):
-            message = _("Applicant '%s' is being hired.") % name
-            self.log(cr, uid, id, message)
-        return res
-
-    def case_close_with_emp(self, cr, uid, ids, *args):
+        return res
+
+    def case_close(self, cr, uid, ids, context=None):
+        res = super(hr_applicant, self).case_close(cr, uid, ids, context)
+        return res
+
+    def case_close_with_emp(self, cr, uid, ids, context=None):
         hr_employee = self.pool.get('hr.employee')
         model_data = self.pool.get('ir.model.data')
         act_window = self.pool.get('ir.actions.act_window')
@@ -431,7 +466,8 @@
                                                      'address_home_id': address_id,
                                                      'department_id': applicant.department_id.id
                                                      })
-                self.case_close(cr, uid, [applicant.id], *args)
+                self.write(cr, uid, [applicant.id], {'emp_id': emp_id})
+                self.case_close(cr, uid, [applicant.id], context)
             else:
                 raise osv.except_osv(_('Warning!'),_('You must define Applied Job for this applicant.'))
 
@@ -442,17 +478,25 @@
         dict_act_window['view_mode'] = 'form,tree'
         return dict_act_window
 
-    def case_reset(self, cr, uid, ids, *args):
+    def case_cancel(self, cr, uid, ids, context=None):
+        """Overrides cancel for crm_case for setting probability
+        """
+        res = super(hr_applicant, self).case_cancel(cr, uid, ids, context)
+        self.write(cr, uid, ids, {'probability' : 0.0})
+        return res
+
+    def case_pending(self, cr, uid, ids, context=None):
+        """Marks case as pending"""
+        res = super(hr_applicant, self).case_pending(cr, uid, ids, context)
+        self.write(cr, uid, ids, {'probability' : 0.0})
+        return res
+
+    def case_reset(self, cr, uid, ids, context=None):
         """Resets case as draft
-        @param self: The object pointer
-        @param cr: the current row, from the database cursor,
-        @param uid: the current user’s ID for security checks,
-        @param ids: List of case Ids
-        @param *args: Tuple Value for additional Params
         """
-
-        res = super(hr_applicant, self).case_reset(cr, uid, ids, *args)
+        res = super(hr_applicant, self).case_reset(cr, uid, ids, context)
         self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
+        self._case_reset_notification(cr, uid, ids, context)
         return res
 
     def set_priority(self, cr, uid, ids, priority, *args):
@@ -473,8 +517,8 @@
     def write(self, cr, uid, ids, vals, context=None):
         if 'stage_id' in vals and vals['stage_id']:
             stage = self.pool.get('hr.recruitment.stage').browse(cr, uid, vals['stage_id'], context=context)
-            text = _("Changed Stage to: %s") % stage.name
-            self.message_append(cr, uid, ids, text, body_text=text, context=context)
+            self.message_append_note(cr, uid, ids, _('System notification'),
+                        _("Changed Stage to <b>%s</b>.") % stage.name, type='notification')
         return super(hr_applicant,self).write(cr, uid, ids, vals, context=context)
 
 hr_applicant()

=== modified file 'hr_recruitment/hr_recruitment_view.xml'
--- hr_recruitment/hr_recruitment_view.xml	2011-12-21 13:10:28 +0000
+++ hr_recruitment/hr_recruitment_view.xml	2012-03-06 11:02:33 +0000
@@ -79,6 +79,9 @@
                         <field name="partner_name"/>
                         <field name="job_id" on_change="onchange_job(job_id)"/>
                         <button name="action_makeMeeting" type="object" string="Meeting" icon="gtk-index"/>
+                        <button string="Send New Email"
+                            name="%(mail.action_email_compose_message_wizard)d"
+                            icon="terp-mail-message-new" type="action"/>
                     <newline/>
                     <field name="department_id" widget="selection" on_change="onchange_department_id(department_id)"/>
                     <group colspan="2" col="4">
@@ -124,13 +127,6 @@
                             <field name="source_id"/>
                             <field name="reference"/>
                         </group>
-                        <group col="2" colspan="2">
-                           <separator colspan="2" string="Dates"/>
-                           <field name="create_date"/>
-                           <field name="write_date"/>
-                           <field name="date_closed"/>
-                           <field name="date_open"/>
-                        </group>
                         <separator colspan="4" string="Status"/>
                         <group col="8" colspan="4">
                             <field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
@@ -141,33 +137,11 @@
                             <button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/>
                         </group>
                    </page>
-                   <page string="Communication &amp; History" groups="base.group_extended">
-                       <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" readonly="1">
-                            <tree string="History">
-                                <field name="display_text" string="History Information"/>
-                                <field name="email_from" invisible="1"/>
-                                <button
-                                    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>
-                        </field>
-                        <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="%(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"/>
                  </page>
                 </notebook>
+                <field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
             </form>
         </field>
     </record>

=== modified file 'mail/static/src/js/mail.js'
--- mail/static/src/js/mail.js	2012-02-29 14:23:31 +0000
+++ mail/static/src/js/mail.js	2012-03-06 11:02:33 +0000
@@ -338,10 +338,15 @@
         start: function() {
             var self = this;
             this._super.apply(this, arguments);
+<<<<<<< TREE
             /* events and buttons */
             this.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); });
             this.$element.find('button.oe_mail_wall_button_more').bind('click', function () { self.do_more(); });
             this.$element.find('div.oe_mail_wall_nomore').hide();
+=======
+            /* events and buttons */
+            this.$element.find('button.oe_mail_button_comment').bind('click', function () { self.do_comment(); });   
+>>>>>>> MERGE-SOURCE
             /* load mail.message search view */
             var search_view_loaded = this.load_search_view(this.params.search_view_id, {}, false);
             var search_view_ready = $.when(search_view_loaded).then(function () {

=== modified file 'mail/static/src/xml/mail.xml'
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to