[CLEAN] crm_claim, hr_recruitment: very small code cleaning
authorThibault Delavallée <tde@openerp.com>
Wed, 30 May 2012 11:18:31 +0000 (13:18 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 30 May 2012 11:18:31 +0000 (13:18 +0200)
bzr revid: tde@openerp.com-20120530111831-io3h7bbknt5ot0uh

addons/crm_claim/crm_claim.py
addons/hr_recruitment/hr_recruitment.py

index 557f048..2753c5f 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
 ##############################################################################
 
 from base_status.base_stage import base_stage
-from osv import fields, osv
+import binascii
 from crm import crm
-import time
 from crm import wizard
-import binascii
+from osv import fields, osv
+import time
 import tools
 from tools.translate import _
 
 wizard.mail_compose_message.SUPPORTED_MODELS.append('crm.claim')
+
 CRM_CLAIM_PENDING_STATES = (
     crm.AVAILABLE_STATES[2][0], # Cancelled
     crm.AVAILABLE_STATES[3][0], # Done
@@ -73,7 +74,8 @@ class crm_claim(base_stage, osv.osv):
         'email_cc': fields.text('Watchers Emails', size=252, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
         'email_from': fields.char('Email', size=128, help="These people will receive email."),
         'partner_phone': fields.char('Phone', size=32),
-        'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_ids', '=', section_id)]"), 
+        'stage_id': fields.many2one ('crm.case.stage', 'Stage',
+                        domain="['|', ('section_ids', '=', section_id), ('case_default', '=', True)]"), 
         'cause': fields.text('Root Cause'),
         'state': fields.related('stage_id', 'state', type="selection", store=True,
                 selection=crm.AVAILABLE_STATES, string="State", readonly=True,
index e0e7b1c..6c361cf 100644 (file)
@@ -101,7 +101,7 @@ class hr_applicant(base_stage, osv.Model):
 
     def _get_default_department_id(self, cr, uid, context=None):
         """ Gives default department by checking if present in the context """
-        return self._resolve_department_id_from_context(cr, uid, context=context)
+        return (self._resolve_department_id_from_context(cr, uid, context=context) or False)
 
     def _get_default_stage_id(self, cr, uid, context=None):
         """ Gives default stage_id """
@@ -298,7 +298,7 @@ class hr_applicant(base_stage, osv.Model):
         return True
 
     def stage_next(self, cr, uid, ids, context=None):
-        """This function computes next stage for case from its current stage
+        """ This function computes next stage for case from its current stage
              using available stage for that case type
         """
         stage_obj = self.pool.get('hr.recruitment.stage')