← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/addons-training-improve-code-ysa into lp:~openobject-training/openobject-addons/training_with_history

 

Yogesh(Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/addons-training-improve-code-ysa into lp:~openobject-training/openobject-addons/training_with_history.

Requested reviews:
  OpenObject Training (openobject-training)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/addons-training-improve-code-ysa/+merge/54200

training_intra, training_exam, training_room :- improve usability issue.
training :- improve code.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/addons-training-improve-code-ysa/+merge/54200
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/addons-training-improve-code-ysa.
=== modified file 'training/document_price.py'
--- training/document_price.py	2011-03-14 10:48:46 +0000
+++ training/document_price.py	2011-03-21 12:30:59 +0000
@@ -21,11 +21,10 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ############################################################################################
-from osv import osv, fields
-
-import tools
-import netsvc
-from tools import config
+
+from osv import osv
+from osv import fields
+
 from tools.translate import _
 import decimal_precision as dp
 
@@ -49,6 +48,8 @@
         return price
 
     def _price_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         user_proxy = self.pool.get('res.users')
         user = user_proxy.browse(cr, uid, uid, context=context)
         try:
@@ -100,7 +101,6 @@
 
 document_price_component()
 
-
 class document_price(osv.osv):
     _inherit = 'ir.attachment'
 
@@ -111,16 +111,11 @@
             res[obj.id] = reduce(lambda acc, component: acc + component.price,
                                  obj.component_ids,
                                  0.0)
-
         return res
 
     _columns = {
         'component_ids' : fields.one2many('document.price.component', 'attach_id'),
-
-        'price' : fields.function(_price_compute, method=True,
-                                  digits_compute=dp.get_precision('Account'),
-                                  string='Price',
-                                  type='float'),
+        'price' : fields.function(_price_compute, method=True, digits_compute=dp.get_precision('Account'), string='Price', type='float'),
         'state' : fields.selection( [ ('draft', 'Draft'), ('validated', 'Validated'), ('pending', 'Pending') ], 'State', select=1, readonly=True),
         'support_note' : fields.text('Note'),
     }
@@ -130,8 +125,9 @@
     }
 
     def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
-        link_course_ids = context and context.get('course_ids', False) or False
-
+        if context is None:
+            context = {}
+        link_course_ids = context.get('course_ids', False)
         if link_course_ids:
             course_ids = [course[2]['course_id'] for course in link_course_ids]
             return super(document_price, self).search(cr, uid, [('type', '=', 'course_material'),
@@ -143,3 +139,5 @@
 
 document_price()
 
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'training/document_type_data.xml'
--- training/document_type_data.xml	2011-01-20 11:35:57 +0000
+++ training/document_type_data.xml	2011-03-21 12:30:59 +0000
@@ -10,5 +10,6 @@
         <field name="name">Lecturer Material</field>
         <field name="code">lecturer_material</field>
     </record>
+
 </data>
 </openerp>

=== modified file 'training/invoice.py'
--- training/invoice.py	2011-03-14 10:48:46 +0000
+++ training/invoice.py	2011-03-21 12:30:59 +0000
@@ -1,9 +1,7 @@
-from osv import osv, fields
+from osv import osv
+from osv import fields
 
-import tools
 import netsvc
-import tempfile
-import os
 import time
 
 class account_invoice(osv.osv):
@@ -18,10 +16,7 @@
     }
 
     def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank=False):
-        values = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
-                                                                   date_invoice,
-                                                                   payment_term,
-                                                                   partner_bank)
+        values = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank)
 
         if partner_id:
             partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
@@ -57,7 +52,6 @@
 
 account_invoice()
 
-
 class   purchase_order_analytic_distribution(osv.osv):
     _inherit = 'purchase.order'
 
@@ -106,3 +100,6 @@
             'analytics_id': adist_id or '',  # Analytic Distribution
         })
 purchase_order_analytic_distribution()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== modified file 'training/partner.py'
--- training/partner.py	2011-02-25 12:33:02 +0000
+++ training/partner.py	2011-03-21 12:30:59 +0000
@@ -22,17 +22,16 @@
 #
 ############################################################################################
 
-from osv import osv, fields
-import time
-import tools
+from osv import osv
+from osv import fields
+
 from tools.translate import _
 
 class res_partner_contact_technical_skill(osv.osv):
     _name = 'res.partner.contact_technical_skill'
 
     _columns = {
-        'name' : fields.char('Name', size=32, select=True, required=True,
-                            help="The name of the technical skill"),
+        'name' : fields.char('Name', size=32, select=True, required=True, help="The name of the technical skill"),
     }
 
     _sql_constraints = [
@@ -55,10 +54,8 @@
     _inherit = 'res.partner.contact'
 
     _columns = {
-        'matricule' : fields.char('Matricule', size=32,
-                                  help="The matricule of the contact"),
-        'birthplace' : fields.char('BirthPlace', size=64,
-                                   help="The birthplace of the contact"),
+        'matricule' : fields.char('Matricule', size=32, help="The matricule of the contact"),
+        'birthplace' : fields.char('BirthPlace', size=64, help="The birthplace of the contact"),
         'education_level' : fields.char('Education Level', size=128),
         'technical_skill_ids' : fields.many2many('res.partner.contact_technical_skill',
                                                  'res_partner_contact_technical_skill_rel',
@@ -80,17 +77,18 @@
     def _get_function_by_kind(self, cr, uid, kind, context=None):
         proxy = self.pool.get('training.config.contact.function')
         ids = proxy.search(cr, uid, [('kind', '=', kind)], context=context)
-        res = [ obj.function_id.code for obj in proxy.browse(cr, uid, ids, context=context) ]
-        if not len(res):
+        result = [ obj.function_id.code for obj in proxy.browse(cr, uid, ids, context=context) ]
+        if not len(result):
             raise osv.except_osv(_('Warning'),
                                  _("""Do not forget to configure the contact's function"""))
-        return res
+        return result
 
     def search(self, cr, uid, domain, offset = 0, limit = None, order = None, context = None, count = False):
-        function = context and context.get('function', False) or False
-
+        if context is None:
+            context = {}
+        function = context.get('function', False)
+        proxy = self.pool.get('training.config.contact.function')
         if function:
-            proxy = self.pool.get('training.config.contact.function')
             ids = proxy.search(cr, uid, [('kind', '=', function)], context=context)
             if not ids:
                 raise osv.except_osv(_('Warning'),
@@ -121,8 +119,7 @@
         'external_matricule' : fields.char('Matricule', size=32),
         'departments' : fields.text('Departments'),
         'orientation' : fields.text('Orientation'),
-        'birthdate' : fields.related('contact_id', 'birthdate', type='date', readonly=True,
-                                     store=True),
+        'birthdate' : fields.related('contact_id', 'birthdate', type='date', readonly=True, store=True),
         'pricelist_id' : fields.related('name', 'property_product_pricelist', string='Pricelist', type='many2one', relation='product.pricelist', readonly=True, store=True),
         'contact_firstname' : fields.related('contact_id', 'first_name', string='Contact First Name', readonly=True),
         'contact_lastname' : fields.related('contact_id', 'name', string='Contact Last Name', readonly=True),
@@ -137,13 +134,16 @@
             return {'value': {'name': False}}
 
         addr_pool = self.pool.get('res.partner.address')
-        _name = addr_pool.browse(cr, uid, address_id).partner_id.id
+        address_data = addr_pool.browse(cr, uid, address_id)
+        _name = address_data.partner_id and address_data.partner_id.id or False
         return {'value': {'name': _name}}
 
     def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80):
+        if context is None:
+            context = {}
         partner_id = context and context.get('partner_id', False) or False
         job_search_context = 'ignore_past'
-        if context and context.get('job_search_context', ''):
+        if context.get('job_search_context', False):
             job_search_context = context.get('job_search_context')
 
         domain = []
@@ -172,33 +172,30 @@
         return self.name_get(cr, uid, self.search(cr, uid, domain, context=context, limit=limit), context=context)
 
     def search(self, cr, uid, domain, offset = 0, limit = None, order = None, context = None, count = False):
-        partner_id = context and context.get('partner_id', False) or False
+        if context is None:
+            context = {}
+        traing_config_func_pool = self.pool.get('training.config.contact.function')
+        res_partn_job_pool = self.pool.get('res.partner.job')
+        partner_id = context.get('partner_id', False)
         if partner_id:
             domain.extend([('name','=', partner_id)])
 
-        function = context and context.get('function', False) or False
+        function = context.get('function', False)
         if function:
-            proxy = self.pool.get('training.config.contact.function')
-            ids = proxy.search(cr, uid, [('kind', '=', function)], context=context)
+            ids = traing_config_func_pool.search(cr, uid, [('kind', '=', function)], context=context)
             if not ids:
                 raise osv.except_osv(_('Warning'),
                                      _("Please, Could you configure the contact's function ?"))
 
-            function_ids = [x.function_id.id for x in proxy.browse(cr, uid, ids, context=context)]
-
-            proxy = self.pool.get('res.partner.job')
-            job_ids = proxy.search(cr, uid,
-                                   domain + [('function_id', 'in', function_ids),('state', '=', 'current')])
+            function_ids = [x.function_id.id for x in traing_config_func_pool.browse(cr, uid, ids, context=context)]
+            job_ids = res_partn_job_pool.search(cr, uid, domain + [('function_id', 'in', function_ids),('state', '=', 'current')])
 
             if not job_ids:
                 raise osv.except_osv(_('Warning'),
                                      _("Please, Could you check the functions because the system does not find any function with the status 'current'"))
 
-
             course_ids = []
-
-            offer_id = context and context.get('offer_id', False) or False
-
+            offer_id = context.get('offer_id', False)
             if offer_id:
                 cr.execute("SELECT course_id FROM training_course_offer_rel WHERE offer_id = %s", (offer_id,))
                 course_ids = [x[0] for x in cr.fetchall()]
@@ -207,32 +204,27 @@
                 if course_id:
                     course_ids = [course_id]
 
-
             if course_ids:
                 cr.execute("SELECT job_id "
                            "FROM training_course_job_rel "
                            "WHERE course_id in (" + ",".join(['%s'] * len(course_ids)) + ") "
                            "  AND job_id in " + '(' + ','.join(['%s'] * len(job_ids)) + ')', course_ids + job_ids)
                 return [x[0] for x in cr.fetchall()]
-
             return job_ids
 
-        res = super(res_partner_job, self).search(cr, uid, domain, offset=offset, limit=limit,
+        return super(res_partner_job, self).search(cr, uid, domain, offset=offset, limit=limit,
                                                    order=order, context=context, count=count)
-        return res
-
 res_partner_job()
 
 class training_course_category(osv.osv):
     _name = 'training.course_category'
+
 training_course_category()
 
 class res_partner_team(osv.osv):
     _inherit = 'res.partner.team'
     _columns = {
-        'specialisation_id' : fields.many2one('training.course_category', 'Specialisation',
-                                              required=True,
-                                              help="A Quality Team has a particularity")
+        'specialisation_id' : fields.many2one('training.course_category', 'Specialisation', required=True, help="A Quality Team has a particularity")
     }
 
 res_partner_team()
@@ -241,17 +233,13 @@
     _inherit = 'res.partner'
 
     _columns = {
-        'notif_contact_id' : fields.many2one('res.partner.job',
-                                             'Subscription Contact',
+        'notif_contact_id' : fields.many2one('res.partner.job', 'Subscription Contact',
                                              domain="[('name', '=', active_id), ('state', '=', 'current')]",
                                              help="The person to contact if the the partner want to receive a notification for a subscription"),
-        'notif_invoicing_id' : fields.many2one('res.partner.job',
-                                             'Invoicing Contact',
+        'notif_invoicing_id' : fields.many2one('res.partner.job', 'Invoicing Contact',
                                              domain="[('name', '=', active_id), ('state', '=', 'current')]",
                                              help="The person to contact for things related to invoicing on partner side."),
-        'notif_participant' : fields.boolean('Participant',
-                                            help="Allows to know if the participant wants to receive a notification"),
-
+        'notif_participant' : fields.boolean('Participant', help="Allows to know if the participant wants to receive a notification"),
         'no_penalties': fields.boolean('No Penalties', help='Allow to not invoice this partner in case of subscription cancellation'),
 
     }

=== modified file 'training/product.py'
--- training/product.py	2010-08-24 12:01:49 +0000
+++ training/product.py	2011-03-21 12:30:59 +0000
@@ -67,3 +67,4 @@
 
 product_product_training()
 
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'training/res_groups.py'
--- training/res_groups.py	2011-02-25 12:33:02 +0000
+++ training/res_groups.py	2011-03-21 12:30:59 +0000
@@ -22,7 +22,7 @@
 #
 ############################################################################################
 
-from osv import osv, fields
+from osv import osv
 
 class groups(osv.osv):
     _inherit = 'res.groups'
@@ -44,3 +44,4 @@
 
 groups()
 
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'training/training.py'
--- training/training.py	2011-03-18 12:58:20 +0000
+++ training/training.py	2011-03-21 12:30:59 +0000
@@ -22,9 +22,10 @@
 #
 ############################################################################################
 
+from osv import osv
+from osv import fields
+
 from cStringIO import StringIO
-from osv import osv, fields
-from tools import config
 from tools.translate import _
 from zipfile import PyZipFile, ZIP_DEFLATED
 import base64
@@ -35,7 +36,6 @@
 import time
 import datetime
 import tools
-import re
 from product import _get_product_procurement_trigger
 from product import _get_product_procurement_methods
 import decimal_precision as dp
@@ -90,7 +90,6 @@
     _columns = {
         'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Full Name'),
         'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', ondelete='cascade', required=True),
-
         'partner_ids' : fields.many2many('res.partner',
                                          'training_purchase_line_partner_rel',
                                          'purchase_line_id',
@@ -120,21 +119,10 @@
 
     _columns = {
         'name' : fields.char('Course Type', size=32, required=True, select=1, help="The course type's name"),
-        'objective' : fields.text('Objective',
-                                  help="Allows to the user to write the objectives of the course type",
-                                  translate=True,
-                                 ),
-        'description' : fields.text('Description',
-                                    translate=True,
-                                    help="Allows to the user to write the description of the course type"),
-        'min_limit' : fields.integer('Minimum Threshold',
-                                     required=True,
-                                     select=2,
-                                     help="The minimum threshold is the minimum for this type of course"),
-        'max_limit' : fields.integer('Maximum Threshold',
-                                     required=True,
-                                     select=2,
-                                     help="The maximum threshold is the maximum for this type of course"),
+        'objective' : fields.text('Objective', help="Allows to the user to write the objectives of the course type", translate=True),
+        'description' : fields.text('Description', translate=True, help="Allows to the user to write the description of the course type"),
+        'min_limit' : fields.integer('Minimum Threshold', required=True, help="The minimum threshold is the minimum for this type of course"),
+        'max_limit' : fields.integer('Maximum Threshold', required=True, help="The maximum threshold is the maximum for this type of course"),
         'product_id' : fields.many2one('product.product', 'Lecturer'),
     }
 
@@ -159,6 +147,8 @@
     _name = 'training.base.purchase_line'
 
     def _fcalc_product_price(self, cr, uid, ids, fieldname, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
         for prsh_line in self.browse(cr, uid, ids, context=context):
             if prsh_line.product_id.procurement_price == 'from_attachment' \
@@ -169,12 +159,9 @@
         return res
 
     _columns = {
-        'product_id' : fields.many2one('product.product', 'Product', required=True,
-                                       help="The product for this purchase line"),
-        'product_qty' : fields.integer('Quantity', required=True,
-                                       help="The quantity of this product"),
-        'product_uom' : fields.many2one('product.uom', 'Product UoM', required=True,
-                                        help="The unit of mesure for this product"),
+        'product_id' : fields.many2one('product.product', 'Product', required=True, help="The product for this purchase line"),
+        'product_qty' : fields.integer('Quantity', required=True, help="The quantity of this product"),
+        'product_uom' : fields.many2one('product.uom', 'Product UoM', required=True, help="The unit of mesure for this product"),
         'product_price' : fields.function(_fcalc_product_price, type='float', digits_compute=dp.get_precision('Account'), string='Cost Price', method=True),
         'attachment_id' : fields.many2one('ir.attachment', 'Attachment'),
         'attachment_price' : fields.related('attachment_id', 'price', type='float', digits_compute=dp.get_precision('Account'), string='Attachment Price', readonly=True),
@@ -185,6 +172,8 @@
     }
 
     def on_change_product_or_attachment(self, cr, uid, ids, product_id, attachment_id, context=None):
+        if context is None:
+            context = {}
         ret_value = {'product_uom': 0, 'product_price': 0.0, 'attachment_price': 0.0}
         if not product_id:
             return {'value' : ret_value }
@@ -321,6 +310,8 @@
     }
 
     def _total_duration_compute(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
 
         if 'offer_id' in context:
@@ -329,10 +320,11 @@
 
         for course in self.browse(cr, uid, ids, context=context):
             res[course.id] = reduce(lambda acc, child: acc + child.duration, course.course_ids, 0.0)
-
         return res
 
     def _has_support(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         cr.execute("SELECT res_id, count(1) "
                    "FROM ir_attachment "
@@ -343,7 +335,6 @@
                    ids + ['course_material'],
         )
         res.update(dict([(x[0], bool(x[1])) for x in cr.fetchall()]))
-
         return res
 
     def action_workflow_pending(self, cr, uid, ids, context=None):
@@ -353,6 +344,8 @@
         return True
 
     def _duration_compute(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
 
         if 'offer_id' in context:
@@ -365,6 +358,8 @@
         return res
 
     def _with_children_compute(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
 
         if 'offer_id' in context:
@@ -377,10 +372,10 @@
         return res
 
     def _price_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
-
         proxy = self.pool.get('ir.attachment')
-
         for course in self.browse(cr, uid, ids, context=context):
             support_ids = proxy.search(cr, uid,
                                        [('res_model', '=', self._name),
@@ -390,12 +385,13 @@
             price = reduce(lambda acc, support: acc + support.price,
                           proxy.browse(cr, uid, support_ids, context=context),
                            0.0)
-
             res[course.id] = price
 
         return res
 
     def _attachment_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, [])
         proxy = self.pool.get('ir.attachment')
         for course in self.browse(cr, uid, ids, context=context):
@@ -409,6 +405,8 @@
         return res
 
     def _get_support(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('ir.attachment')
         attach_ids = proxy.search(cr, uid, [('id', 'in', ids),('res_model', '=', 'training.course'),('type', '=', 'course_material')], context=context)
         res = set()
@@ -421,90 +419,36 @@
         'splitted_by' : fields.selection([('2', '2 Hours'),
                                           ('4', '4 Hours'),
                                           ('8', '8 Hours')
-                                         ],
-                                         'Splitted By',
-                                         required=True),
-        'price' : fields.function(_price_compute,
-                                  method=True,
-                                  string='Price',
-                                  type='float',
-                                  digits_compute=dp.get_precision('Account'),
+                                         ], 'Splitted By', required=True),
+        'price' : fields.function(_price_compute, method=True, string='Price', type='float', digits_compute=dp.get_precision('Account'),
                                   #store = {
                                   #    'ir.attachment' : (_get_support, None, 10),
                                   #},
                                   help='The price of the support of the courses'),
-        'theme_ids' : fields.many2many('training.course.theme', 'training_course_theme_rel', 'course_id',
-                                      'theme_id', 'Theme'),
-
-        'duration' : fields.function(_duration_compute,
-                                     method=True,
-                                     string='Duration',
-                                     type='float',
-                                     store=True,
-                                     help='The duration of the course'),
-
-        'duration_with_children':fields.function(_total_duration_compute,
-                                                 method=True,
-                                                 string='Duration',
-                                                 type='float',
-                                                 store=True,
-                                                 help='The duration of the course'),
-
-        'duration_without_children':fields.float('Duration',
-                                                 help="The duration of the course"),
-
-        'with_children': fields.function(_with_children_compute,
-                                         method=True,
-                                         string='With Children',
-                                         store=True,
-                                         type='boolean',
-                                         help='Allows to know if the course contains some subcourses or not'),
-
-        'p_id' : fields.many2one('training.course',
-                                 'Parent Course',
-                                 help="The parent course",
-                                 readonly=True,
-                                 domain="[('state_course', '=', 'validated')]"),
-
-        'course_ids' : fields.one2many('training.course',
-                                       'p_id',
-                                       "Sub Courses",
-                                       help="A course can be completed with some subcourses"),
-
-        'sequence' : fields.integer('Sequence',
-                                    help="The sequence can help the user to reorganize the order of the courses"),
-
-        'reference_id' : fields.many2one('training.course',
-                                         'Master Course',
-                                         help="The master course is necessary if the user wants to link certain courses together to easy the managment",
-                                        ),
+        'theme_ids' : fields.many2many('training.course.theme', 'training_course_theme_rel', 'course_id', 'theme_id', 'Theme'),
+        'duration' : fields.function(_duration_compute, method=True, string='Duration', type='float', store=True, help='The duration of the course'),
+        'duration_with_children':fields.function(_total_duration_compute, method=True, string='Duration', type='float',
+                                        store=True, help='The duration of the course'),
+        'duration_without_children':fields.float('Duration', help="The duration of the course"),
+        'with_children': fields.function(_with_children_compute, method=True, string='With Children', store=True,
+                                        type='boolean', help='Allows to know if the course contains some subcourses or not'),
+        'p_id' : fields.many2one('training.course', 'Parent Course', help="The parent course", readonly=True, domain="[('state_course', '=', 'validated')]"),
+        'course_ids' : fields.one2many('training.course', 'p_id', "Sub Courses", help="A course can be completed with some subcourses"),
+        'sequence' : fields.integer('Sequence', help="The sequence can help the user to reorganize the order of the courses"),
+        'reference_id' : fields.many2one('training.course', 'Master Course',
+                                         help="The master course is necessary if the user wants to link certain courses together to easy the managment"),
         'child_reference_id' : fields.one2many('training.course', 'reference_id', 'Children'),
-
         'reference_lang_id' : fields.related('reference_id', 'lang_id', type='many2one', relation='res.lang', string="Master Course's Language", readonly=True),
         'reference_type' : fields.related('reference_id', 'course_type_id', type='many2one', relation='training.course_type', string="Master Course's Type", readonly=True),
         'analytic_account_id' : fields.many2one('account.analytic.account', 'Account', ondelete='cascade', required=True),
         'course_type_id' : fields.many2one('training.course_type', 'Type', select=1),
         'category_id': fields.many2one('training.course_category', 'Product Line', select=1),
-
         'lecturer_ids' : fields.many2many('res.partner.job', 'training_course_job_rel', 'course_id', 'job_id', 'Lecturers',
-                                          select=1,
                                           help="The lecturers who give the course"),
-
-        'internal_note' : fields.text('Note',
-                                      help="The user can write some internal note for this course"),
-
-        'lang_id' : fields.many2one('res.lang',
-                                    'Language',
-                                    required=True,
-                                    select=1,
-                                    domain=[('active', '=', True), ('translatable', '=', True)],
+        'internal_note' : fields.text('Note', help="The user can write some internal note for this course"),
+        'lang_id' : fields.many2one('res.lang', 'Language', required=True, domain=[('active', '=', True), ('translatable', '=', True)],
                                     help="The language of the course"),
-        'kind': fields.selection(training_course_kind_compute,
-                                 'Kind',
-                                 required=True,
-                                 select=2,
-                                 help="The kind of course"),
-
+        'kind': fields.selection(training_course_kind_compute, 'Kind', required=True, help="The kind of course"),
         'state_course' : fields.selection([('draft', 'Draft'),
                                            ('deprecated', 'Deprecated'),
                                            ('validated', 'Validated'),
@@ -515,36 +459,18 @@
                                           select=1,
                                           help="The state of the course"
                                          ),
-
-        'purchase_line_ids' : fields.one2many('training.course.purchase_line', 'course_id',
-                                              'Supplier Commands',
-                                              help="The purchase line helps to create a purchase order for the seance",),
-#                                              read=['training.group_course_manager'], write=['training.group_course_manager']),
-
-
-        'has_support' : fields.function(_has_support,
-                                        method=True,
-                                        type="boolean",
+        'purchase_line_ids' : fields.one2many('training.course.purchase_line', 'course_id', 'Supplier Commands',
+                                              help="The purchase line helps to create a purchase order for the seance",
+                                              read=['training.group_course_manager'], write=['training.group_course_manager']),
+        'has_support' : fields.function(_has_support, method=True, type="boolean",
                                         store={
                                             'ir.attachment' : (_get_support, None, 10),
-                                        },
-                                        select=2,
-                                        string="Has Support"),
+                                        }, string="Has Support"),
         'forced_nosupport': fields.boolean('Forced No Support', help="This course has no attachment, and that is normal", select=2),
-
-        'long_name' : fields.char('Long Name',
-                                     size=256,
-                                     select=1,
-                                     help='Allows to show the long name of the course for the external view'),
-
-        'attachment_ids' : fields.function(_attachment_compute,
-                                           method=True,
-                                           string='Supports of Course',
-                                           type='one2many',
-                                           relation='ir.attachment'),
+        'long_name' : fields.char('Long Name', size=256, help='Allows to show the long name of the course for the external view'),
+        'attachment_ids' : fields.function(_attachment_compute, method=True, string='Supports of Course', type='one2many', relation='ir.attachment'),
         'attachment_note': fields.text('Support of Course Note'),
         'pending_ids': fields.one2many('training.content.review', 'course_id', 'Reviews', readonly=True),
-
     }
 
     _defaults = {
@@ -556,6 +482,8 @@
     }
 
     def _check_duration(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         this = self.browse(cr, uid, ids[0], context=context)
         #return (this.duration > 0.0 or this.duration_without_children > 0.0 or this.duration_with_children > 0.0)
         return this.duration_without_children > 0.0
@@ -565,19 +493,24 @@
     ]
 
     def create(self, cr, uid, values, context=None):
+        if context is None:
+            context = {}
         if 'category_id' in values:
             proxy = self.pool.get('training.course_category')
             values['parent_id'] = proxy.browse(cr, uid, values['category_id'], context).analytic_account_id.id
         return super(training_course, self).create(cr, uid, values, context)
 
     def write(self, cr, uid, ids, values, context=None):
+        if context is None:
+            context = {}
         if 'category_id' in values:
             proxy = self.pool.get('training.course_category')
             values['parent_id'] = proxy.browse(cr, uid, values['category_id'], context).analytic_account_id.id
         return super(training_course, self).write(cr, uid, ids, values, context)
 
-
     def copy_data(self, cr, uid, id, default=None, context=None):
+        if context is None:
+            context = {}
         data, trans_data = super(training_course, self).copy_data(cr, uid, id, default=default, context=context)
         to_delete = [ 'theme_ids', 'questionnaire_ids', 'purchase_line_ids', 'pending_ids', 'line_ids', 'lecturer_ids', 'budget_intra_line_ids', 'attachment_ids' ]
         for key in to_delete:
@@ -587,6 +520,8 @@
 
 
     def on_change_reference(self, cr, uid, ids, reference_id, context=None):
+        if context is None:
+            context = {}
         if not reference_id:
             return False
 
@@ -609,15 +544,14 @@
         return {'value' : values}
 
     def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
-        link_id = context and context.get('link_id', False) or False
+        if context is None:
+            context = {}
+        link_id = context.get('link_id', False)
         has_master_course = context and ('master_course' in context) or False
 
         if link_id:
-
             course = self.browse(cr, uid, link_id, context=context)
-
             reference_id = course.reference_id and course.reference_id.id or course.id
-
             res = super(training_course, self).search(cr, uid, [('reference_id', '=', reference_id)], context=context)
             if course.reference_id:
                 res += [course.reference_id.id]
@@ -653,11 +587,7 @@
 class training_offer_public_target(osv.osv):
     _name = 'training.offer.public.target'
     _columns = {
-        'name':fields.char('Name',
-                           translate=True,
-                           size=256,
-                           select=1,
-                           help="Allows to the participants to select a course whose can participate"),
+        'name':fields.char('Name', translate=True, size=256, help="Allows to the participants to select a course whose can participate"),
         'note' : fields.text('Target Audience', translate=True),
     }
 
@@ -701,6 +631,8 @@
         return {'type': 'ir.actions.act_window_close' }
 
     def action_confirm(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         offer_proxy = self.pool.get('training.offer')
         offer_id = context.get('active_id', False)
         val = offer_proxy.action_update_seance_procurements(cr, uid, offer_id, context=context)
@@ -731,9 +663,7 @@
         'course_id' : fields.many2one('training.course', 'Course'),
         'description' : fields.char('Description', size=128),
         'fix' : fields.selection(_get_product_procurement_methods, 'Invoiced Quantity', required=True),
-        'procurement_quantity' : fields.selection(_get_product_procurement_trigger,
-                                                  'Trigger',
-                                                  required=True),
+        'procurement_quantity' : fields.selection(_get_product_procurement_trigger, 'Trigger', required=True),
         'auto_update': fields.boolean('Auto. Update'),
     }
 
@@ -745,6 +675,8 @@
     }
 
     def on_change_product_or_attachment(self, cr, uid, ids, product_id, attachment_id, context=None):
+        if context is None:
+            context = {}
         super_val = super(training_offer_purchase_line, self).on_change_product_or_attachment(cr, uid, ids, product_id, attachment_id, context=context)
         if super_val and super_val.get('value', False):
             ret_val = super_val['value']
@@ -784,6 +716,8 @@
 training_offer_category()
 
 def training_offer_category_compute(obj, cr, uid, context=None):
+    if context is None:
+        context = {}
     proxy = obj.pool.get('training.offer.category')
     cr.execute("SELECT id FROM %s" % (proxy._table))
     ids = [ x[0] for x in cr.fetchall() ]
@@ -797,6 +731,8 @@
     _description = 'Offer'
 
     def on_change_course_ids(self, cr, uid, ids, course_ids, context=None):
+        if context is None:
+            context = {}
         values = {
             'type_id' : 0,
             'product_line_id' : 0,
@@ -815,6 +751,8 @@
         return {'value' : values}
 
     def _is_standalone_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         for offer in self.browse(cr, uid, ids, context=context):
             res[offer.id] = len(offer.course_ids) == 1 and 1 or 0
@@ -822,8 +760,9 @@
         return res
 
     def draft_cb(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
-
         for offer_id in ids:
             workflow.trg_create(uid, 'training.offer', offer_id, cr)
 
@@ -831,6 +770,8 @@
 
 
     def action_load_procurements(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.offer.purchase.line')
         for offer in self.browse(cr, uid, ids, context=context):
             for course_offer_rel in offer.course_ids:
@@ -850,6 +791,8 @@
         return True
 
     def action_update_seance_procurements(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         session_proxy = self.pool.get('training.session')
         seance_proxy = self.pool.get('training.seance')
         group_proxy = self.pool.get('training.group')
@@ -975,7 +918,6 @@
     def _can_be_planned_search(self, cr, uid, obj, name, args, context=None):
         if not len(args):
             return []
-
         return [('id', 'in', self.can_be_planned_search(cr, uid, context=context))]
 
     def _can_be_planned_compute(self, cr, uid, ids, fields, args, context=None):
@@ -985,6 +927,8 @@
         return dict.fromkeys(ids, True)
 
     def is_planned_search(self, cr, uid, obj, name, args, context=None):
+        if context is None:
+            context = {}
         if not len(args):
             return []
         cond = " = 0";
@@ -1012,48 +956,22 @@
         'product_line_id' : fields.many2one('training.course_category', 'Product Line', select=1, required=True),
 
         'type_id' : fields.many2one('training.course_type', 'Type'),
-        'name' : fields.char('Name',
-                             size=64,
-                             required=True,
-                             select=1,
-                             help="The name's offer"),
-        'product_id' : fields.many2one('product.product',
-                                       'Product',
-                                       help="An offer can be a product for invoicing",
-                                      ),
+        'name' : fields.char('Name', size=64, required=True, help="The name's offer"),
+        'product_id' : fields.many2one('product.product', 'Product', help="An offer can be a product for invoicing"),
         'course_ids' : fields.one2many('training.course.offer.rel', 'offer_id', 'Courses', help='An offer can contain some courses'),
-        'duration' : fields.function(_duration_compute,
-                                     method=True,
-                                     string='Duration',
-                                     type='float',
-                                    ),
-        'objective' : fields.text('Objective',
-                                  help='The objective of the course will be used by the internet web site'
-                                 ),
+        'duration' : fields.function(_duration_compute, method=True, string='Duration', type='float'),
+        'objective' : fields.text('Objective', help='The objective of the course will be used by the internet web site'),
         'long_name': fields.char('Long Name', size=255),
-        'description' : fields.text('Description',
-                                    help="Allows to write the description of the course"),
+        'description' : fields.text('Description', help="Allows to write the description of the course"),
         'state' : fields.selection([('draft', 'Draft'),
                                     ('validated', 'Validated'),
                                     ('deprecated', 'Deprecated')
-                                   ],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                                   select=1,
-                                   help="The status of the course",
-                                  ),
-        'kind' : fields.selection(training_offer_kind_compute,
-                                  'Kind',
-                                  required=True,
-                                  select=1),
-        'target_public_ids': fields.many2many('training.offer.public.target',
-                                            'training_offer_public_target_ids',
-                                            'offer_id', 'public_target_id',
+                                   ], 'State', required=True, readonly=True, help="The status of the course"),
+        'kind' : fields.selection(training_offer_kind_compute, 'Kind', required=True),
+        'target_public_ids': fields.many2many('training.offer.public.target', 'training_offer_public_target_ids', 'offer_id', 'public_target_id',
                                             string='Target Audience', select=1),
         'lang_id' : fields.many2one('res.lang', 'Language'),
         'create_date' : fields.datetime('Create Date', readonly=True),
-
         'preliminary_offer_ids' : fields.many2many('training.offer',
                                                    'training_offer_pre_offer_rel',
                                                    'offer_id',
@@ -1067,33 +985,15 @@
                                                      'cpl_offer_id',
                                                      'Complementary Offers',
                                                      domain="[('state', '=', 'validated')]"),
-
-        'is_standalone' : fields.function(_is_standalone_compute,
-                                          method=True,
-                                          string='Is Standalone',
-                                          type="boolean",
-                                          help="Allows to know if an offer is standalone or a block of courses"),
-
-        'purchase_line_ids' : fields.one2many('training.offer.purchase.line',
-                                              'offer_id',
-                                              'Procurements'),
-        'purchase_line_log_ids': fields.one2many('training.offer.purchase.line.log',
-                                              'offer_id',
-                                              'Procurements Logs'),
-        'theme_ids' : fields.many2many('training.course.theme', 'training_offer_them_rel', 'offer_id',
-                                      'theme_id', 'Theme'),
+        'is_standalone' : fields.function(_is_standalone_compute, method=True, string='Is Standalone',
+                                          type="boolean", help="Allows to know if an offer is standalone or a block of courses"),
+        'purchase_line_ids' : fields.one2many('training.offer.purchase.line', 'offer_id', 'Procurements'),
+        'purchase_line_log_ids': fields.one2many('training.offer.purchase.line.log', 'offer_id', 'Procurements Logs'),
+        'theme_ids' : fields.many2many('training.course.theme', 'training_offer_them_rel', 'offer_id', 'theme_id', 'Theme'),
         'notification_note': fields.text('Notification Note', help='This note will be show on notification emails'),
         'is_certification': fields.boolean('Is a certification?', help='Indicate is this Offer is a Certification Offer'),
-
-        'can_be_planned' : fields.function(_can_be_planned_compute, method=True,
-                                           fnct_search=_can_be_planned_search,
-                                           type='boolean',
-                                           string='Can Be Planned'),
-
-        'is_planned': fields.function(is_planned_compute, method=True,
-                                      fnct_search=is_planned_search,
-                                      type='boolean',
-                                      string='Is Planned'),
+        'can_be_planned' : fields.function(_can_be_planned_compute, method=True, fnct_search=_can_be_planned_search, type='boolean', string='Can Be Planned'),
+        'is_planned': fields.function(is_planned_compute, method=True, fnct_search=is_planned_search, type='boolean', string='Is Planned'),
         'categorie_id': fields.selection(training_offer_category_compute, 'Category', required=False, select=1,),
     }
 
@@ -1104,7 +1004,9 @@
     }
 
     def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
-        course_id = context and context.get('course_id', False) or False
+        if context is None:
+            context = {}
+        course_id = context.get('course_id', False)
 
         if course_id:
             cr.execute("""SELECT offer_id FROM training_course_offer_rel WHERE course_id = %s""", (course_id,))
@@ -1133,31 +1035,15 @@
     _description = 'Catalog'
     _columns = {
         'name' : fields.char('Title', size=64, required=True, select=1),
-        'year' : fields.integer('Year',
-                                size=4,
-                                required=True,
-                                select=1,
-                                help="The year when the catalog has been published",
-                               ),
-        'session_ids' : fields.one2many('training.session',
-                                        'catalog_id',
-                                        'Sessions',
-                                        help="The sessions in the catalog"),
-        'note' : fields.text('Note',
-                             translate=True,
-                             help="Allows to write a note for the catalog"),
+        'year' : fields.integer('Year', size=4, required=True, help="The year when the catalog has been published"),
+        'session_ids' : fields.one2many('training.session', 'catalog_id', 'Sessions', help="The sessions in the catalog"),
+        'note' : fields.text('Note', translate=True, help="Allows to write a note for the catalog"),
         'state' : fields.selection([('draft','Draft'),
                                     ('validated', 'Validated'),
                                     ('inprogress', 'In Progress'),
                                     ('deprecated', 'Deprecated'),
                                     ('cancelled','Cancelled'),
-                                   ],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                                   select=1,
-                                   help="The status of the catalog",
-                                  ),
+                                   ], 'State', required=True, readonly=True, help="The status of the catalog"),
     }
 
     _defaults = {
@@ -1217,6 +1103,8 @@
         return { 'type' : 'ir.actions.act_window.close' }
 
     def action_generate_zip(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         values = {}
         try:
             import tempfile
@@ -1255,11 +1143,15 @@
         return self.write(cr, uid, ids, values, context=context)
 
     def _get_report(self, cr, uid, oid, reportname, context=None):
+        if context is None:
+            context = {}
         srv = netsvc.LocalService(reportname)
         pdf, _r = srv.create(cr, uid, [oid], {}, context=context)
         return pdf
 
     def add_selections(self, cr, uid, ids, directory, log, context=None):
+        if context is None:
+            context = {}
         active_id = context and context.get('active_id')
         seance = self.pool.get('training.seance').browse(cr, uid, active_id, context=context)
         ts = time.strptime(seance.date, '%Y-%m-%d %H:%M:%S')
@@ -1323,6 +1215,8 @@
     _order = 'date desc, name'
 
     def _has_shared_seances_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, False)
         for session in self.browse(cr, uid, ids, context=context):
             res[session.id] = any(seance.shared for seance in session.seance_ids)
@@ -1331,14 +1225,17 @@
 
     # training.session
     def _store_get_participation(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         result = set()
-
         for line in self.pool.get('training.subscription.line').browse(cr, 1, ids, context=context):
             result.add(line.session_id.id)
 
         return list(result)
 
     def _participant_count(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         cr.execute("""SELECT ts.id, MAX(tsea_summary.count)
                         FROM training_session ts
@@ -1361,15 +1258,18 @@
 
     # training.session
     def _confirmed_subscriptions_count(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         sl_proxy = self.pool.get('training.subscription.line')
         for session_id in ids:
             res[session_id] = int(sl_proxy.search_count(cr, uid, [('session_id', '=', session_id),('state', 'in', ['confirmed', 'done'])], context=context))
-
         return res
 
     # training.session
     def _available_seats_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
 
         for session in self.browse(cr, uid, ids, context=context):
@@ -1384,6 +1284,8 @@
 
     # training.session
     def _draft_subscriptions_count(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
 
         proxy = self.pool.get("training.subscription.line")
@@ -1394,6 +1296,8 @@
 
     # training.session
     def _limit_all(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = {}
         for obj in self.browse(cr, uid, ids, context=context):
             res[obj.id] = {'min_limit' : 0, 'max_limit' : 0}
@@ -1429,6 +1333,8 @@
         return res
 
     def _min_limit_reached(self, cr, uid, ids, fn, args, context=None):
+        if context is None:
+            context = {}
         result = dict.fromkeys(ids, False)
         for session in self.browse(cr, uid, ids, context):
             count = ['participant_count', 'participant_count_manual'][session.manual]
@@ -1437,6 +1343,8 @@
 
     # training.session
     def _store_get_seances(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         values = set()
 
         for obj in self.pool.get('training.seance').browse(cr, uid, ids, context=context):
@@ -1447,12 +1355,8 @@
 
     _columns = {
         'id' : fields.integer('Seance ID', readonly=True),
-        'has_shared_seances' : fields.function(_has_shared_seances_compute,
-                                               method=True,
-                                               type='boolean',
-                                               string="Has Shared Seances",
-                                               help="Allows to know if the session has a shared seance"
-                                              ),
+        'has_shared_seances' : fields.function(_has_shared_seances_compute, method=True, type='boolean',
+                                               string="Has Shared Seances", help="Allows to know if the session has a shared seance"),
         'name' : fields.char('Name', size=64, required=True, select=1),
         'state' : fields.selection([('draft', 'Draft'),
                                     ('opened', 'Opened'),
@@ -1461,115 +1365,46 @@
                                     ('inprogress', 'In Progress'),
                                     ('closed', 'Closed'),
                                     ('cancelled', 'Cancelled')],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                               select=1,
-                               help="The status of the session",
-                                  ),
+                                   'State', required=True, readonly=True, help="The status of the session"),
         'group_ids' : fields.one2many('training.group', 'session_id', 'Group', readonly=True),
         'done' : fields.boolean('Done'),
-        'offer_id' : fields.many2one('training.offer',
-                                     'Offer',
-                                     select=1,
-                                     required=True,
-                                     help="Allows to select a validated offer for the session",
-                                     domain="[('state', '=', 'validated')]"
-                                    ),
+        'offer_id' : fields.many2one('training.offer', 'Offer', required=True, help="Allows to select a validated offer for the session",
+                                     domain="[('state', '=', 'validated')]"),
         'offer_product_line_id' : fields.related('offer_id', 'product_line_id', type='many2one', relation='training.course_category', select=1, string='Product Line'),
-        'kind' : fields.related('offer_id',
-                                'kind',
-                                type='selection',
-                                selection=training_offer_kind_compute,
-                                string='Kind',
-                                readonly=True),
-        'catalog_id' : fields.many2one('training.catalog', 'Catalog',
-                                       select=1,
-                                       help="Allows to select a published catalog"
-                                      ),
-        'seance_ids' : fields.many2many('training.seance',
-                                        'training_session_seance_rel',
-                                        'session_id',
-                                        'seance_id',
-                                        'Seances',
-                                        ondelete='cascade',
+        'kind' : fields.related('offer_id', 'kind', type='selection', selection=training_offer_kind_compute, string='Kind', readonly=True),
+        'catalog_id' : fields.many2one('training.catalog', 'Catalog', help="Allows to select a published catalog" ),
+        'seance_ids' : fields.many2many('training.seance', 'training_session_seance_rel', 'session_id', 'seance_id', 'Seances', ondelete='cascade',
                                         help='List of the events in the session'),
-        'date' : fields.datetime('Date',
-                                 required=True,
-                                 select=1,
-                                 help="The date of the planned session"
-                                ),
-
-        'user_id' : fields.many2one('res.users',
-                                    'Responsible',
-                                    select=1,
-                                    required=True),
-        'available_seats' : fields.function(_available_seats_compute,
-                                            method=True,
-                                            string="Available Seats",
-                                            help="Available Seats = Maximum Threshold - Total Confirmed Seats",
-                                            type='integer'),
-
-        'participant_count' : fields.function(_participant_count,
-                                              method=True,
-                                              string='Total Confirmed Seats',
-                                              type='integer',
-                                             ),
-
-        'confirmed_subscriptions' : fields.function(_confirmed_subscriptions_count,
-                                                    method=True,
-                                                    string='Confirmed Subscriptions',
-                                                    type='integer',
+        'date' : fields.datetime('Date', required=True,  help="The date of the planned session" ),
+        'user_id' : fields.many2one('res.users', 'Responsible', required=True),
+        'available_seats' : fields.function(_available_seats_compute, method=True, string="Available Seats", type='integer',
+                                            help="Available Seats = Maximum Threshold - Total Confirmed Seats"),
+        'participant_count' : fields.function(_participant_count, method=True, string='Total Confirmed Seats', type='integer'),
+        'confirmed_subscriptions' : fields.function(_confirmed_subscriptions_count, method=True, string='Confirmed Subscriptions', type='integer',
                                                     #store={
                                                     #    'training.subscription.line' : (_store_get_participation, None, 10),
                                                     #}
                                                    ),
-        'draft_subscriptions' : fields.function(_draft_subscriptions_count,
-                                                method=True,
-                                                string="Draft Subscriptions",
-                                                type="integer",
-                                                help="Draft Subscriptions for this session",
-                                               ),
-
-        'subscription_line_ids': fields.one2many('training.subscription.line',
-                                                 'session_id',
-                                                 'Subscription Lines',
-                                                 readonly=True),
-
-        'participant_count_manual' : fields.integer('Manual Confirmed Seats',
-                                                    help="The quantity of supports, catering, ... relative to the number of participants coming from the confirmed seats"),
+        'draft_subscriptions' : fields.function(_draft_subscriptions_count, method=True, string="Draft Subscriptions", type="integer",
+                                                help="Draft Subscriptions for this session" ),
+        'subscription_line_ids': fields.one2many('training.subscription.line', 'session_id', 'Subscription Lines', readonly=True),
+        'participant_count_manual' : fields.integer('Manual Confirmed Seats', help="The quantity of supports, catering, ... relative to the number of participants coming from the confirmed seats"),
         'manual' : fields.boolean('Manual', help="Allows to the user to specify the number of participants"),
-        'min_limit' : fields.function(_limit_all,
-                                      method=True,
-                                      string='Mininum Threshold',
-                                      #store={
-                                      #    'training.seance' : (_store_get_seances, None, 10),
-                                      #},
-                                      type='integer',
-                                      multi='limit',
-                                      help="The minimum threshold is the minimum of the minimum threshold of each seance",
-                                      readonly=True),
-        'max_limit' : fields.function(_limit_all,
-                                      method=True,
-                                      string='Maximum Threshold',
-                                      #store={
-                                      #    'training.seance' : (_store_get_seances, None, 10),
-                                      #},
-                                      type='integer',
-                                      multi='limit',
-                                      help="The maximum threshold is the minimum of the maximum threshold of each seance",
-                                      readonly=True),
-        'min_limit_reached': fields.function(_min_limit_reached,
-                                             method=True,
-                                             string='Minimum Threshold Reached',
-                                             type='boolean',
-                                             readonly=True,
+        'min_limit' : fields.function(_limit_all, method=True, string='Mininum Threshold', readonly=True,
+                                      #store={
+                                      #    'training.seance' : (_store_get_seances, None, 10),
+                                      #},
+                                      type='integer', multi='limit', help="The minimum threshold is the minimum of the minimum threshold of each seance"),
+        'max_limit' : fields.function(_limit_all, method=True, string='Maximum Threshold', readonly=True,
+                                      #store={
+                                      #    'training.seance' : (_store_get_seances, None, 10),
+                                      #},
+                                      type='integer', multi='limit', help="The maximum threshold is the minimum of the maximum threshold of each seance"),
+        'min_limit_reached': fields.function(_min_limit_reached, method=True, string='Minimum Threshold Reached', type='boolean', readonly=True,
                                              store={
                                                 'training.seance' : (_store_get_seances, None, 10),
                                                 'training.subscription.line' : (_store_get_participation, None, 10),
-                                             },
-                                             ),
-
+                                             }),
         'request_ids': fields.one2many('training.participation.stakeholder.request', 'session_id', 'Requests'),
         'stylegroup_id': fields.many2one('training.email.stylegroup', 'Style Group'),
     }
@@ -1577,11 +1412,19 @@
     _order = "date asc"
 
     def _check_date_before_now(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         obj = self.browse(cr, uid, ids[0], context=context)
         res = obj.date >= time.strftime('%Y-%m-%d %H:%M:%S')
         return res
 
     def _check_date_holiday(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         obj = self.browse(cr, uid, ids[0], context=context)
         date = time.strftime('%Y-%m-%d', time.strptime(obj.date, '%Y-%m-%d %H:%M:%S'))
 
@@ -1589,6 +1432,8 @@
         return res
 
     def _check_date_of_seances(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for session in self.browse(cr, uid, ids, context=context):
             for seance in session.seance_ids:
                 if seance.date < session.date:
@@ -1618,6 +1463,8 @@
     }
 
     def _create_seance(self, cr, uid, session, context=None):
+        if context is None:
+            context = {}
         seance_ids = []
         seance_proxy = self.pool.get('training.seance')
 
@@ -1857,14 +1704,17 @@
 
     # training.session
     def action_create_seances(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for session in self.browse(cr, uid, ids, context=context):
             seance_ids = self._create_seance(cr, uid, session, context)
 
             self.write(cr, uid, session.id, {'seance_ids' : [(6, 0, seance_ids)]}, context=context)
-
         return True
 
     def on_change_offer(self, cr, uid, ids, offer_id, context=None):
+        if context is None:
+            context = {}
         if not offer_id:
             return False
 
@@ -1879,6 +1729,10 @@
         }
 
     def on_change_date(self, cr, uid, ids, date, offer_id, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         old_date = ids and self.browse(cr, uid, ids[0], context=context).date or 0
 
         if self.pool.get('training.holiday.period').is_in_period(cr, date):
@@ -1896,6 +1750,8 @@
 
     # training.session
     def _create_participation(self, cr, uid, ids, subscription_line, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.participation')
         proxy_seance = self.pool.get('training.seance')
 
@@ -1919,6 +1775,8 @@
 
     # training.session
     def test_workflow_open(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for obj in self.browse(cr, uid, ids, context=context):
             if not len(obj.seance_ids):
                 raise osv.except_osv(_('Warning'), _("Please, do not forget to have the seances in your session"))
@@ -1941,7 +1799,8 @@
 
     # training.session
     def action_workflow_open_confirm(self, cr, uid, ids, context=None):
-
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.subscription.line')
         subscription_line_ids = proxy.search(cr, uid, [('session_id', 'in', ids), ('state', '=', 'confirmed')], context=context)
         proxy.send_email(cr, uid, subscription_line_ids, 'session_open_confirmed', context)
@@ -1968,6 +1827,8 @@
 
     # training.session
     def action_create_invoice(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         sl_proxy = self.pool.get('training.subscription.line')
         for session in self.browse(cr, uid, ids, context=context):
             sl_ids = sl_proxy.search(cr, uid, [('session_id', '=', session.id),('invoice_line_id', '=', False),('state', 'in', ('confirmed', 'done'))], context=context)
@@ -1982,6 +1843,8 @@
 
     # training.session
     def action_workflow_close(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
         proxy = self.pool.get('training.subscription.line')
         for session in self.browse(cr, uid, ids, context):
@@ -1998,9 +1861,9 @@
 
     # training.session
     def action_cancellation_session(self, cr, uid, ids, context=None):
-
         # just send emails...
-
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.subscription.line')
         subscription_line_ids = proxy.search(cr, uid, [('session_id', 'in', ids), ('state', '=', 'confirmed')], context=context)
         proxy.send_email(cr, uid, subscription_line_ids, 'session_confirm_cancelled', context)
@@ -2017,6 +1880,8 @@
 
     # training.session
     def action_workflow_cancel(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         self.write(cr, uid, ids, {'state' : 'cancelled'}, context=context)
 
         workflow = netsvc.LocalService('workflow')
@@ -2040,14 +1905,13 @@
 
 
     def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
+        if context is None:
+            context = {}
         subscription_id = context and context.get('subscription_id', False) or False
-
         if subscription_id:
             proxy = self.pool.get('training.subscription.line')
             ids = proxy.search(cr, uid, [('subscription_id', '=', subscription_id)], context=context)
             return [sl.session_id.id for sl in proxy.browse(cr, uid, ids, context=context)]
-
-
         return super(training_session, self).search(cr, uid, domain, offset=offset, limit=limit, order=order, context=context, count=count)
 
     def copy(self, cr, uid, object_id, values, context=None):
@@ -2064,6 +1928,8 @@
         return {'type':'ir.actions.act_window_close'}
 
     def action_apply(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         subscription_form_view = context and context.get('subscription_form_view', False) or False
         record_id = context and context.get('record_id', False) or False
 
@@ -2114,17 +1980,14 @@
 
     _columns = {
         'partner_id' : fields.many2one('res.partner', 'Partner'),
-        'job_ids' : fields.many2many('res.partner.job',
-                                     'tms_contact_job_rel',
-                                     'ms_id',
-                                     'job_id',
-                                     'Contacts',
-                                    ),
+        'job_ids' : fields.many2many('res.partner.job', 'tms_contact_job_rel', 'ms_id', 'job_id', 'Contacts'),
         'session_ids' : fields.one2many('training.subscription.mass.line', 'wizard_id', 'Sessions'),
     }
 
     def default_get(self, cr, uid, fields, context=None):
-        record_id = context and context.get('record_id', False) or False
+        if context is None:
+            context = {}
+        record_id = context.get('record_id', False)
 
         res = super(training_mass_subscription_wizard, self).default_get(cr, uid, fields, context=context)
 
@@ -2135,7 +1998,9 @@
         return res
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
-        record_id = context and context.get('record_id', False) or False
+        if context is None:
+            context = {}
+        record_id = context.get('record_id', False)
 
         res = super(training_mass_subscription_wizard, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
         if record_id:
@@ -2154,11 +2019,7 @@
         'session_id' : fields.many2one('training.session', 'Session',
                                        domain="[('state', 'in', ('opened','opened_confirmed', 'closed_confirmed', 'inprogress'))]", required=True),
         'allow_closed_session': fields.boolean('Allow Closed Session'),
-        'kind' : fields.related('session_id','offer_id', 'kind',
-                                type='selection',
-                                selection=training_offer_kind_compute,
-                                string='Kind',
-                                readonly=True),
+        'kind' : fields.related('session_id','offer_id', 'kind', type='selection', selection=training_offer_kind_compute, string='Kind', readonly=True),
     }
 
     def on_change_allow_closed_session(self, cr, uid, ids, new_allow, context=None):
@@ -2182,11 +2043,7 @@
     _rec_name='partner_id'
     _columns = {
         'job_id' : fields.many2one('res.partner.job', 'Contact', required=True),
-        'partner_id' : fields.related('job_id', 'name',
-                                      string='Partner',
-                                      type='many2one',
-                                      relation='res.partner',
-                                      store=True),
+        'partner_id' : fields.related('job_id', 'name', string='Partner', type='many2one', relation='res.partner', store=True),
         'session_id' : fields.many2one('training.session', 'Session', required=True),
     }
 
@@ -2196,7 +2053,6 @@
             'job_id' : job.id,
             'session_id' : subscription_mass_line.session_id.id,
         }
-
         return proxy.create(cr, uid, values, context=context)
 
 training_subscription_line_second()
@@ -2220,6 +2076,8 @@
 
     def _store_get_sublines(self, cr, uid, sl_ids, context=None):
         """get all participations related to this subscription line"""
+        if context is None:
+            context = {}
         search_context = context.copy()
         # do no limit search to only active records
         search_context['active_test'] = False
@@ -2231,6 +2089,8 @@
     def _store_get_contacts(self, cr, uid, contact_ids, context=None):
         """get all participations related to the modified contact ids supplied
            (trigger on 'res.partner.contact' for every contact modification)"""
+        if context is None:
+            context = {}
         part_pool = self.pool.get('training.participation')
 
         search_context = context.copy()
@@ -2243,6 +2103,8 @@
     def _store_get_jobs(self, cr, uid, job_ids, context=None):
         """get all participations related to the modified job ids supplied
            (trigger on 'res.partner.job' when 'contact_id' field is modified)"""
+        if context is None:
+            context = {}
         part_pool = self.pool.get('training.participation')
 
         search_context = context.copy()
@@ -2264,27 +2126,19 @@
         'group_id' : fields.related('seance_id', 'group_id', string='Group', type='many2one', relation='training.group', select=1, store=True, readonly=True),
         'subscription_line_id' : fields.many2one('training.subscription.line', 'Subscription Line', select=True, required=True, readonly=True, ondelete='cascade'),
         'session_id' : fields.related('subscription_line_id', 'session_id', type='many2one', relation='training.session', select=True, store=True),
-        'course_id' : fields.related('seance_id', 'course_id', 'name', type='char', size=64, readonly=True,
-                                     string="Course", select=2),
+        'course_id' : fields.related('seance_id', 'course_id', 'name', type='char', size=64, readonly=True, string="Course"),
         'duration' : fields.related('seance_id', 'duration', string='Duration', type='float', readonly=True, store=True),
         'kind' : fields.related('seance_id', 'kind', type='selection', selection=[('standard', 'Course')], string='Kind', select=1),
-
         'present' : fields.boolean('Present', help="Allows to know if a participant was present or not", select=1),
-
-        'subscription_id' : fields.related('subscription_line_id', 'subscription_id',
-                                           type='many2one',
-                                           relation='training.subscription',
-                                           string='Subscription', readonly=True),
-        'job_id' : fields.related('subscription_line_id', 'job_id',
-                                  type='many2one', relation='res.partner.job',
+        'subscription_id' : fields.related('subscription_line_id', 'subscription_id', type='many2one', relation='training.subscription', string='Subscription', readonly=True),
+        'job_id' : fields.related('subscription_line_id', 'job_id', type='many2one', relation='res.partner.job',
                                   string='Participant', select=1, readonly=True,
                                   store={
                                       'training.participation': (_store_get_own, ['subscription_line_id'], 10),
                                       'training.subscription.line' : (_store_get_sublines, ['job_id'], 9),
                                   }
                                  ),
-        'contact_id' : fields.related('subscription_line_id', 'job_id', 'contact_id',
-                                      type='many2one', relation='res.partner.contact',
+        'contact_id' : fields.related('subscription_line_id', 'job_id', 'contact_id', type='many2one', relation='res.partner.contact',
                                       string='Contact', select=1, readonly=True,
                                       store={
                                           'training.subscription.line': (_store_get_sublines, None, 10),
@@ -2306,14 +2160,11 @@
                                                 'res.partner.job': (_store_get_jobs, ['contact_id'], 13),
                                             }
                                             ),
-        'function_id': fields.related('subscription_line_id', 'job_id', 'function_id',
-                                      type='many2one', relation='res.partner.function',
+        'function_id': fields.related('subscription_line_id', 'job_id', 'function_id', type='many2one', relation='res.partner.function',
                                       string='Function', select=2, readonly=True),
-        'partner_id' : fields.related('subscription_line_id', 'partner_id',
-                                      type='many2one', relation='res.partner',
+        'partner_id' : fields.related('subscription_line_id', 'partner_id', type='many2one', relation='res.partner',
                                       string='Partner', select=2, readonly=True),
-        'date' : fields.related('seance_id', 'date', type='datetime', string='Date', select=1,
-                                readonly=True, store=True),
+        'date' : fields.related('seance_id', 'date', type='datetime', string='Date', select=1, readonly=True, store=True),
         'purchase_ids': fields.many2many('purchase.order.line',
                                          'training_participation_purchase_rel',
                                          'participation_id',
@@ -2351,6 +2202,8 @@
 
 
     def name_get(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         res = []
         for obj in self.browse(cr, uid, list(set(ids)), context=context):
             sl = obj.subscription_line_id
@@ -2364,6 +2217,8 @@
 
     # training.participation
     def create_procurements(self, cr, uid, participation_ids, delayed=False, context=None):
+        if context is None:
+            context = {}
         purchase_order_pool = self.pool.get('purchase.order')
         products = {}
         for participation in self.browse(cr, uid, participation_ids, context=context):
@@ -2408,6 +2263,8 @@
     _description = 'Seance'
 
     def _shared_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         for seance in self.browse(cr, uid, ids, context=context):
             res[seance.id] = len(seance.session_ids) > 1
@@ -2416,7 +2273,6 @@
     # training.seance
     def _available_seats_compute(self, cr, uid, ids, fieldnames, args, context=None):
         res = dict.fromkeys(ids, 0)
-
         for seance in self.browse(cr, uid, ids, context=context):
             count = ['participant_count', 'participant_count_manual'][seance.manual]
             res[seance.id] = int(seance.max_limit - int(seance[count]))
@@ -2425,6 +2281,10 @@
 
     # training.seance
     def _draft_seats_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         res = dict.fromkeys(ids, 0)
 
         cr.execute("SELECT rel.seance_id, count(1) "
@@ -2441,6 +2301,10 @@
 
     # training.seance
     def _participant_count(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         res = dict.fromkeys(ids, 0)
 
         cr.execute('SELECT tp.seance_id, COUNT(DISTINCT(tsl.contact_id)) '
@@ -2459,6 +2323,8 @@
     _order = "date asc"
 
     def _confirmed_lecturer_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 'no')
         proxy = self.pool.get('training.participation.stakeholder')
         for seance in self.browse(cr, uid, ids, context=context):
@@ -2476,6 +2342,8 @@
         return list(values)
 
     def _get_sessions_type(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = []
         for seance in self.browse(cr, uid, ids, context=context):
             types = set()
@@ -2487,6 +2355,8 @@
         return res
 
     def _contact_names_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 'None')
         for seance in self.browse(cr, uid, ids, context=context):
             name = []
@@ -2536,30 +2406,13 @@
         'id' : fields.integer('Database ID', readonly=True),
         'is_first_seance' : fields.boolean('First Seance', select=1),
         'name' : fields.char('Name', size=64, required=True, select=1),
-        'session_ids' : fields.many2many('training.session',
-                                         'training_session_seance_rel',
-                                         'seance_id',
-                                         'session_id',
-                                         'Sessions',
-                                         select=1,
-                                         ondelete='cascade'),
-        'sessions_type': fields.function(_get_sessions_type,
-                                         method=True,
-                                         string='Session(s) Type',
-                                         type='char',
-                                         size=32,
-                                         ),
+        'session_ids' : fields.many2many('training.session', 'training_session_seance_rel', 'seance_id', 'session_id', 'Sessions', ondelete='cascade'),
+        'sessions_type': fields.function(_get_sessions_type, method=True, string='Session(s) Type', type='char', size=32),
         'forced_lecturer' : fields.boolean('Forced Lecturer(s)'),
-        'confirmed_lecturer' : fields.function(_confirmed_lecturer_compute,
-                                               method=True,
-                                               select=1,
+        'confirmed_lecturer' : fields.function(_confirmed_lecturer_compute, method=True, string="Confirmed Lecturer",
                                                store={
                                                    'training.participation.stakeholder' : (_get_stakeholders, None, 10),
-                                               },
-                                               string="Confirmed Lecturer",
-                                               type='selection',
-                                               selection=[('no', 'No'),('yes','Yes')],
-                                              ),
+                                               }, type='selection', selection=[('no', 'No'),('yes','Yes')]),
         'lecturer_note': fields.text('Lecturer Note'),
         'original_session_id' : fields.many2one('training.session', 'Original Session', ondelete='cascade'),
         'original_offer_id': fields.related('original_session_id', 'offer_id', string="Original Offer", type='many2one', relation='training.offer', select=1),
@@ -2568,37 +2421,19 @@
         'duplicated' : fields.boolean('Duplicated', required=True),
         'date' : fields.datetime('Date', required=True, select=1,help="The create date of seance"),
         'duration' : fields.float('Duration', select=1, help="The duration of the seance"),
-        'participant_ids' : fields.one2many('training.participation',
-                                            'seance_id',
-                                            'Participants',
-                                            ),
-        'group_id' : fields.many2one('training.group', 'Group',
-                                     #required=True,
-                                     help='The group of participants',
-                                    ),
+        'participant_ids' : fields.one2many('training.participation', 'seance_id', 'Participants'),
+        'group_id' : fields.many2one('training.group', 'Group', help='The group of participants'),
         'state' : fields.selection([('opened', 'Opened'),
                                     ('confirmed', 'Confirmed'),
                                     ('inprogress', 'In Progress'),
                                     ('closed', 'Closed'),
                                     ('cancelled', 'Cancelled'),
                                     ('done', 'Done')],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                                   select=1,
-                                   help="The status of the Seance",
-                                  ),
+                                   'State', required=True, readonly=True, help="The status of the Seance"),
         'contact_ids' : fields.one2many('training.participation.stakeholder', 'seance_id', 'Lecturers', readonly=True),
-        'contact_names' : fields.function(_contact_names_compute, method=True,
-                                          type='char', size=256,
-                                          string='Lecturers'),
-        'course_id' : fields.many2one('training.course',
-                                      'Course',
-                                      select=1,
-                                      domain="[('state_course', '=', 'validated')]"),
-        'state_course' : fields.related('course_id', 'state_course',
-                                        string="Course's State",
-                                        type='selection',
+        'contact_names' : fields.function(_contact_names_compute, method=True, type='char', size=256, string='Lecturers'),
+        'course_id' : fields.many2one('training.course', 'Course', domain="[('state_course', '=', 'validated')]"),
+        'state_course' : fields.related('course_id', 'state_course', string="Course's State", type='selection',
                                         selection=[('draft', 'Draft'),
                                                    ('pending', 'Pending'),
                                                    ('deprecated', 'Deprecated'),
@@ -2608,54 +2443,36 @@
         'min_limit' : fields.integer("Minimum Threshold",help='The Minimum of Participants in Seance'),
         'max_limit' : fields.integer("Maximum Threshold",help='The Maximum of Participants in Seance'),
         'user_id' : fields.many2one('res.users', 'Responsible', required=True, select=1),
-
-        'available_seats' : fields.function(_available_seats_compute,
-                                            method=True,
-                                            string='Available Seats',
-                                            type='integer',
-                                            help='Available seats in Seance'
-                                           ),
-        'draft_seats' : fields.function(_draft_seats_compute,
-                                        method=True,
-                                        string='Draft Subscriptions',
-                                        type='integer',
-                                        help='Draft Subscriptions',
-                                       ),
-
+        'available_seats' : fields.function(_available_seats_compute, method=True, string='Available Seats', type='integer', help='Available seats in Seance'),
+        'draft_seats' : fields.function(_draft_seats_compute, method=True, string='Draft Subscriptions', type='integer', help='Draft Subscriptions'),
         'presence_form' : fields.selection([('yes', 'Yes'),
                                             ('no', 'No')],
-                                           'Presence Form Received',
-                                           help='The training center has received the presence list from the lecturer'),
-        'shared' : fields.function(_shared_compute,
-                                   method=True,
-                                   string='Shared',
-                                   type='boolean',
-                                   help="Allows to know if the seance is linked with a lot of sessions"),
-
+                                           'Presence Form Received', help='The training center has received the presence list from the lecturer'),
+        'shared' : fields.function(_shared_compute, method=True, string='Shared', type='boolean', help="Allows to know if the seance is linked with a lot of sessions"),
         'kind': fields.selection(training_course_kind_compute, 'Kind', required=True, select=1),
         'master_id' : fields.many2one('training.seance', 'Master Seance'),
-
-        'participant_count' : fields.function(_participant_count,
-                                              method=True,
-                                              type="integer",
-                                              string="Confirmed Seats",
-                                              help="Confirmed Subscriptions for this seance",
-                                             ),
-        'participant_count_manual' : fields.integer('Manual Confirmed Seats',
-                                                    help="The quantity of supports, catering, ... relative to the number of participants coming from the confirmed seats"),
+        'participant_count' : fields.function(_participant_count, method=True, type="integer",
+                                              string="Confirmed Seats", help="Confirmed Subscriptions for this seance"),
+        'participant_count_manual' : fields.integer('Manual Confirmed Seats', help="The quantity of supports, catering, ... relative to the number of participants coming from the confirmed seats"),
         'manual' : fields.boolean('Manual', help="Allows to the user to specify the number of participants"),
     }
 
     def _check_limits(self, cr, uid, ids, context=None):
+        if not ids:
+            return False
         obj = self.browse(cr, uid, ids)[0]
         return obj.min_limit <= obj.max_limit
 
     def _check_date_before_now(self,cr,uid,ids,context=None):
+        if  not ids:
+            return False
         obj = self.browse(cr, uid, ids[0])
         res = obj.date > time.strftime('%Y-%m-%d %H:%M:%S')
         return res
 
     def _check_date_holiday(self, cr, uid, ids, context=None):
+        if not ids:
+            return False
         obj = self.browse(cr, uid, ids[0], context=context)
         date = time.strftime('%Y-%m-%d', time.strptime(obj.date, '%Y-%m-%d %H:%M:%S'))
         return not self.pool.get('training.holiday.period').is_in_period(cr, date)
@@ -2665,7 +2482,6 @@
             for session in seance.session_ids:
                 if seance.date < session.date:
                     return False
-
         return True
 
     _constraints = [
@@ -2706,6 +2522,8 @@
 
     # training.seance
     def action_do_confirm(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.participation')
         emails = self.pool.get('training.email')
         report = netsvc.LocalService('report.training.seance.support.delivery.report')
@@ -2761,6 +2579,8 @@
 
     # training.seance
     def action_workflow_inprogress(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
 
         for seance in self.browse(cr, uid, ids, context=context):
@@ -2779,6 +2599,8 @@
 
     # training.seance
     def action_workflow_done(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
         self.write(cr, uid, ids, {'state' : 'done'}, context=context)
 
@@ -2798,6 +2620,8 @@
 
     # training.seance
     def action_workflow_cancel(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
 
         # Annulation des commandes, des formateurs et des procurements
@@ -2829,6 +2653,8 @@
 
     # training.seance
     def _create_participation(self, cr, uid, seance, subscription_line, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.participation')
         values = {
             'seance_id' : seance.id,
@@ -2837,6 +2663,8 @@
         return proxy.create(cr, uid, values, context=context)
 
     def on_change_date(self, cr, uid, ids, date, context=None):
+        if context is None:
+            context = {}
         old_date = ids and self.browse(cr, uid, ids[0], context=context).date or 0
 
         if self.pool.get('training.holiday.period').is_in_period(cr, date):
@@ -2853,6 +2681,8 @@
 
     # training.seance
     def create_procurements(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         purchase_order_pool = self.pool.get('purchase.order')
         location_id = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')], context=context)[0]
 
@@ -2868,6 +2698,8 @@
         return True
 
     def unlink(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for seance in self.browse(cr, uid, ids, context=context):
             if seance.state == 'confirmed':
                 for pl in seance.purchase_line_ids:
@@ -2883,12 +2715,16 @@
         return super(training_seance, self).unlink(cr, uid, ids, context=context)
 
     def copy(self, cr, uid, object_id, values, context=None):
+        if context is None:
+            context = {}
         if not 'is_first_seance' in values:
             values['is_first_seance'] = 0
 
         return super(training_seance, self).copy(cr, uid, object_id, values, context=context)
 
     def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
+        if context is None:
+            context = {}
         offer_id = context and context.get('offer_id', False) or False
 
         if offer_id:
@@ -2930,6 +2766,8 @@
                                                    limit=limit, order=order, context=context, count=count)
 
     def _get_product(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         assert len(ids) == 1
         seance = self.browse(cr, uid, ids[0], context)
         if not seance.course_id.course_type_id:
@@ -2945,6 +2783,8 @@
     _rec_name = 'product_id'
 
     def _proc_qty_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0)
         for pl in self.browse(cr, uid, ids, context=context):
             if pl.fix == 'fix':
@@ -2963,11 +2803,7 @@
         'description' : fields.char('Description', size=128, required=True),
         'fix' : fields.selection(_get_product_procurement_methods, 'Invoiced Quantity', required=True),
         'procurement_id' : fields.many2one('procurement.order', 'Procurement'),
-        'proc_qty' : fields.function(_proc_qty_compute,
-                                     method=True,
-                                     string='Ordered Quantity',
-                                     type='integer',
-                                    ),
+        'proc_qty' : fields.function(_proc_qty_compute, method=True, string='Ordered Quantity', type='integer'),
         'auto_update': fields.boolean('Auto. Update'),
     }
 
@@ -2978,6 +2814,8 @@
     }
 
     def on_change_product_or_attachment(self, cr, uid, ids, product_id, attachment_id, context=None):
+        if context is None:
+            context = {}
         super_val = super(training_seance_purchase_line, self).on_change_product_or_attachment(cr, uid, ids, product_id, attachment_id, context=context)
         if super_val and super_val.get('value', False):
             ret_val = super_val['value']
@@ -3012,6 +2850,8 @@
             return {}
 
     def _get_analytic_account_id(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         po_line = self.browse(cr, uid, ids[0], context=context)
         if not po_line.course_id:
             # course not defined on purchase line, use seance one.
@@ -3022,12 +2862,13 @@
 
 training_seance_purchase_line()
 
-
 class training_subscription(osv.osv):
     _name = 'training.subscription'
     _description = 'Subscription'
 
     def check_notification_mode(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for subr in self.browse(cr, uid, ids, context=context):
             if not subr.partner_id.notif_contact_id \
                 and not subr.partner_id.notif_participant:
@@ -3035,6 +2876,8 @@
                         _('No notification mode (HR and/or Participant) for this partner "%s", please choose at least one') % (subr.partner_id.name))
 
     def _notification_text_compute_one(self, cr, uid, partner_id, context=None):
+        if context is None:
+            context = {}
         partner_pool = self.pool.get('res.partner')
         if isinstance(partner_id, osv.orm.browse_record):
             partner = partner_id
@@ -3050,10 +2893,8 @@
 
     def _notification_text_compute(self, cr, uid, ids, name, args, context=None):
         res = dict.fromkeys(ids, '')
-
         for obj in self.browse(cr, uid, ids):
             res[obj.id] = self._notification_text_compute_one(cr, uid, obj.partner_id, context=context)
-
         return res
 
     def _get_partner(self, cr, uid, ids, context=None):
@@ -3063,7 +2904,6 @@
         'name' : fields.char('Reference', size=32, required=True, select=1, readonly=True, help='The unique identifier is generated by the system (customizable)'),
         'create_date' : fields.datetime('Creation Date', select=True, readonly=True),
         'state' : fields.selection([('draft', 'Draft'), ('confirmed','Request Sent'), ('cancelled','Cancelled'), ('done', 'Done') ], 'State', readonly=True, required=True, select=1,help='The state of the Subscription'),
-
         'partner_id' : fields.many2one('res.partner', 'Partner', select=1, required=True,help='The Subscription name', **WRITABLE_ONLY_IN_DRAFT),
         'partner_rh_email' : fields.char('Subscription Contact', size=64),
         'address_id' : fields.many2one('res.partner.address', 'Invoice Address', select=1, required=True,help='The Subscription invoice address', **WRITABLE_ONLY_IN_DRAFT),
@@ -3072,11 +2912,8 @@
 
         'pricelist_id' : fields.related('partner_id', 'property_product_pricelist', string='Pricelist', type='many2one', relation='product.pricelist', readonly=True),
         'payment_term_id' : fields.many2one('account.payment.term', 'Payment Term', **WRITABLE_ONLY_IN_DRAFT),
-
         'responsible_id' : fields.many2one('res.users', 'Creator', required=True, readonly=True, select=1),
-
         'origin' : fields.char('Origin', size=64, **WRITABLE_ONLY_IN_DRAFT),
-
         'notification_active' : fields.boolean('Active', **WRITABLE_ONLY_IN_DRAFT),
         'notification_text' : fields.function(_notification_text_compute, method=True,
                                               string='Kind', type='char',
@@ -3089,6 +2926,8 @@
     }
 
     def create(self, cr, uid, vals, context):
+        if context is None:
+            context = {}
         if vals.get('name', '/')=='/':
             vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'training.subscription')
         if not vals.get('notification_text', '') and vals.get('partner_id', None):
@@ -3166,9 +3005,10 @@
             for sl in subscription.subscription_line_ids:
                 workflow.trg_validate(uid, 'training.subscription.line', sl.id, signal, cr)
 
-
     # training.subscription
     def action_workflow_cancel(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
         sl_proxy = self.pool.get('training.subscription.line')
         sl_ids = []
@@ -3272,6 +3112,8 @@
     def _store_get_jobs(self, cr, uid, job_ids, context=None):
         """get all subscription line related to the modified job ids supplied
            (trigger on 'res.partner.job' when 'contact_id' field is modified)"""
+        if context is None:
+            context = {}
         subl_pool = self.pool.get('training.subscription.line')
 
         search_context = context.copy()
@@ -3287,39 +3129,28 @@
 
     _columns = {
         'name' : fields.char('Reference', size=64, required=True, readonly=True, select=1),
-
         'create_uid': fields.many2one('res.users', 'Created by', readonly=True, select=1),
         'create_date': fields.datetime('Created at', readonly=True),
         'validation_uid': fields.many2one('res.users', 'Validated by', readonly=True, select=2),
         'validation_date': fields.datetime('Validated at', readonly=True),
         'cancellation_uid': fields.many2one('res.users', 'Cancelled by', readonly=True, select=2),
         'cancellation_date': fields.datetime('Cancelled at', readonly=True),
-
-        'subscription_id' : fields.many2one('training.subscription', 'Subscription',
-                                            required=True,
-                                            ondelete='cascade',
+        'subscription_id' : fields.many2one('training.subscription', 'Subscription', required=True, ondelete='cascade',
                                             select=1,help='Select the subscription', **WRITABLE_ONLY_IN_DRAFT),
-        'subscription_state' : fields.related('subscription_id', 'state',
-                                              type='selection',
+        'subscription_state' : fields.related('subscription_id', 'state', type='selection',
                                               selection=[
                                                   ('draft', 'Draft'),
                                                   ('confirmed','Confirmed'),
                                                   ('cancelled','Cancelled'),
                                                   ('done', 'Done'),
-                                              ],
-                                              string='State',
-                                              readonly=True,
-                                              required=True,
-                                              select=1,
-                                              help='The state of the Subscription'),
+                                              ], string='State', readonly=True, required=True, help='The state of the Subscription'),
         'price_list_id' : fields.many2one('product.pricelist', 'Pricelist', required=True, domain="[('type', '=', 'sale')]", **WRITABLE_ONLY_IN_DRAFT),
         'partner_hr_email' : fields.related('subscription_id', 'partner_rh_email', type='char', size=64, string='HR Email', readonly=True),
         'notification_text' : fields.related('subscription_id', 'notification_text', type='char', size=64, store=True, string='Notification (Kind)', readonly=True),
         'session_id' : fields.many2one('training.session', 'Session', select=1, required=True,
                                        domain="[('state', 'in', ('opened','opened_confirmed', 'closed_confirmed', 'inprogress'))]",
                                        help='Select the session', **WRITABLE_ONLY_IN_DRAFT),
-        'session_state': fields.related('session_id', 'state', readonly=True,
-                                        type='selection',
+        'session_state': fields.related('session_id', 'state', readonly=True, type='selection',
                                         selection= [
                                             ('draft', 'Draft'),
                                             ('opened', 'Opened'),
@@ -3328,12 +3159,10 @@
                                             ('inprogress', 'In Progress'),
                                             ('closed', 'Closed'),
                                             ('cancelled', 'Cancelled'),
-                                        ],
-                                        string='Session State', select=2),
+                                        ], string='Session State', select=2),
         'session_date': fields.related('session_id', 'date', readonly=True, type="datetime", string="Session Date", select=2),
         'offer_id' : fields.related('session_id', 'offer_id', type='many2one', relation='training.offer', string='Offer', select=1, store=True, readonly=True),
         'offer_product_line_id' : fields.related('session_id', 'offer_id', 'product_line_id', type='many2one', relation='training.course_category', select=1, string='Product Line'),
-
         'price' : fields.float('Sales Price', digits_compute=dp.get_precision('Account'), required=True, write=['base.group_user'], **WRITABLE_ONLY_IN_DRAFT),
         'partner_id' : fields.related('subscription_id', 'partner_id', type='many2one', store=True,
                                       relation='res.partner', string="Partner", select=1, readonly=True),
@@ -3346,63 +3175,30 @@
                                             'training.subscription.line': (_store_get_own, ['job_id'], 9),
                                             'res.partner.job': (_store_get_jobs, ['contact_id'], 10),
                                         }),
-        'contact_firstname' : fields.related('contact_id', 'first_name', string='Contact Firstname',
-                                             type='char', size=64, readonly=True),
-        'contact_lastname' : fields.related('contact_id', 'name', string='Contact Lastname',
-                                             type='char', size=64, readonly=True),
-
+        'contact_firstname' : fields.related('contact_id', 'first_name', string='Contact Firstname', type='char', size=64, readonly=True),
+        'contact_lastname' : fields.related('contact_id', 'name', string='Contact Lastname', type='char', size=64, readonly=True),
         'partner_rh' : fields.related('partner_id', 'notif_contact_id', type='many2one', relation='res.partner.job', readonly=True, string='Subscription Contact', store=True),
-
         'invoice_line_id' : fields.many2one('account.invoice.line', 'Invoice Line', readonly=True),
         'invoice_id' : fields.related('invoice_line_id', 'invoice_id', type='many2one', relation='account.invoice', string="Invoice", readonly=True, store=True),
-        'paid' : fields.function(_paid_compute,
-                                 method=True,
-                                 string='Paid',
-                                 type='boolean',
-                                 readonly=True),
-        'kind' : fields.related('session_id', 'kind',
-                                string="Kind",
-                                type="selection",
-                                selection=training_offer_kind_compute,
-                                select=1,
-                                readonly=True),
+        'paid' : fields.function(_paid_compute, method=True, string='Paid', type='boolean', readonly=True),
+        'kind' : fields.related('session_id', 'kind', string="Kind", type="selection", selection=training_offer_kind_compute, readonly=True),
         'state' : fields.selection([('draft', 'Draft'),
                                     ('confirmed','Confirmed'),
                                     ('cancelled','Cancelled'),
                                     ('done', 'Done') ],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                                   select=1,help='The state of participant'),
-        'date' : fields.related('session_id', 'date', type='datetime', string='Date',
-                                readonly=True),
-        'available_seats' : fields.related('session_id', 'available_seats',
-                                           type='integer',
-                                           readonly=True,
-                                           string='Available Seats'),
-        'draft_subscriptions' : fields.related('session_id', 'draft_subscriptions',
-                                       type='integer',
-                                       readonly=True,
-                                       string='Draft Subscriptions'),
+                                   'State', required=True, readonly=True, select=1,help='The state of participant'),
+        'date' : fields.related('session_id', 'date', type='datetime', string='Date', readonly=True),
+        'available_seats' : fields.related('session_id', 'available_seats', type='integer', readonly=True, string='Available Seats'),
+        'draft_subscriptions' : fields.related('session_id', 'draft_subscriptions', type='integer', readonly=True, string='Draft Subscriptions'),
         'has_certificate' : fields.boolean('Has Certificate', readonly=True, select=2),
         'reason_cancellation' : fields.text('Reason of Cancellation', readonly=True),
-        'theoritical_disponibility' : fields.function(_theoritical_disponibility_compute,
-                                      method=True,
-                                      string='Theoritical Disponibility',
-                                      type='integer'),
+        'theoritical_disponibility' : fields.function(_theoritical_disponibility_compute, method=True, string='Theoritical Disponibility', type='integer'),
         'max_limit' : fields.related('session_id', 'max_limit', string='Maximum Threshold', type='integer', store=True, readonly=True),
-        'confirmed_subscriptions' : fields.related('session_id', 'confirmed_subscriptions',
-                                                   string='Confirmed Subscriptions',
-                                                   type='integer', readonly=True,
-                                                  ),
-
+        'confirmed_subscriptions' : fields.related('session_id', 'confirmed_subscriptions', string='Confirmed Subscriptions', type='integer', readonly=True),
         'participation_ids' : fields.one2many('training.participation', 'subscription_line_id', 'Participations', readonly=True),
         'internal_note' : fields.text("Internal Note"),
         'email_note': fields.text("Email Note"),
-
-        'was_present' : fields.function(_was_present_compute, method=True,
-                                        type='boolean',
-                                        string='Was Present'),
+        'was_present' : fields.function(_was_present_compute, method=True, type='boolean', string='Was Present'),
     }
 
     def _default_name(self, cr, uid, context=None):
@@ -3417,6 +3213,8 @@
     _order = 'name desc'
 
     def copy(self, cr, uid, object_id, values, context=None):
+        if context is None:
+            context = {}
         if 'name' not in values:
             values['name'] = self._default_name(cr, uid, context=context)
 
@@ -3432,6 +3230,8 @@
 
     # training.subscription.line
     def _check_subscription(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for sl in self.browse(cr, 1, ids, context=context):
             session = sl.session_id
             contact = sl.job_id.contact_id
@@ -3462,6 +3262,8 @@
 
     # training.subscription.line
     def on_change_session(self, cr, uid, ids, session_id, price_list_id, partner_id, context=None):
+        if context is None:
+            context = {}
         if not session_id:
             return False
 
@@ -3499,6 +3301,8 @@
         return values
 
     def on_change_price_list(self, cr, uid, ids, session_id, price_list_id, context=None):
+        if context is None:
+            context = {}
         if not price_list_id or not session_id:
             return False
 
@@ -3517,6 +3321,8 @@
     # training.subscription.line
     def _get_values_from_wizard(self, cr, uid, subscription_id, job, subscription_mass_line, context=None):
         # this method can easily surcharged by inherited modules
+        if context is None:
+            context = {}
         subscription = self.pool.get('training.subscription').browse(cr, uid, subscription_id, context=context)
         session = subscription_mass_line.session_id
 
@@ -3572,7 +3378,8 @@
     # training.subscription.line
     def action_workflow_send_confirm_emails(self, cr, uid, ids, context=None):
         # the confirm function will send an email to the participant and/or the HR Manager
-
+        if context is None:
+            context = {}
         lines = {}
 
         for sl in self.browse(cr, uid, ids, context=context):
@@ -3600,7 +3407,7 @@
         return True
 
     def action_create_refund(self, cr, uid, ids, context=None):
-        if not context:
+        if context is None:
             context = {}
         invoice_proxy = self.pool.get('account.invoice')
         invoice_line_proxy = self.pool.get('account.invoice.line')
@@ -3684,6 +3491,8 @@
 
     # training.subscription.line
     def _delete_participations(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         proxy = self.pool.get('training.participation')
         part_ids = []
         mrp_products = {}
@@ -3716,7 +3525,8 @@
 
     # training.subscription.line
     def action_create_invoice_and_refund(self, cr, uid, ids, context=None):
-
+        if context is None:
+            context = {}
         config_pool = self.pool.get('ir.config')
         DISCOUNT_DAYS = config_pool.get(cr, uid, 'training.subscription.cancel.discount.days') # calendar days
 
@@ -3778,8 +3588,10 @@
 
 
     def _invoice_min_max(self, cr, uid, values, context=None):
+        if context is None:
+            context = {}
         # NOTE: replace values in place
-        if not context or not context.get('cancellation', False):
+        if not context.get('cancellation', False):
             return True
 
         config_pool = self.pool.get('ir.config')
@@ -3802,6 +3614,8 @@
 
 
     def _get_courses(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, [])
 
         for sl in self.browse(cr, uid, ids, context=context):
@@ -3819,6 +3633,8 @@
 
     # training.subscription.line
     def _get_invoice_line_taxes(self, cr, uid, subline, fiscal_position, partner, session, context=None):
+        if context is None:
+            context = {}
         if session.offer_id.product_id:
             if session.offer_id.product_id.taxes_id:
                 taxes = session.offer_id.product_id.taxes_id
@@ -3828,6 +3644,8 @@
 
     # training.subscription.line
     def action_create_invoice(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         # Creation des factures
         account_code = self.pool.get('ir.config').get(cr, uid, 'training.subscription.invoice.default.account')
         if not account_code:
@@ -3943,6 +3761,8 @@
 
     # training.subscription.line
     def action_workflow_done(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         self.write(cr, uid, ids, {'state' : 'done'}, context=context)
 
         workflow = netsvc.LocalService('workflow')
@@ -3952,6 +3772,8 @@
 
     # training.subscription.line
     def action_workflow_cancel(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         self.send_email(cr, uid, ids, 'sub_cancelled', context)
         self.write(cr, uid, ids, {'state': 'cancelled', 'cancellation_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'cancellation_uid': uid}, context=context)
 
@@ -3964,6 +3786,8 @@
 
 
     def send_email(self, cr, uid, ids, trigger, context=None, **objects):
+        if context is None:
+            context = {}
         """Send email to participant and to HR (grouped by session)"""
         email_proxy = self.pool.get('training.email')
         groups = {}
@@ -4010,6 +3834,8 @@
         return res
 
     def _amount_to_pay(self, cr, uid, ids, name, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 'N/A')
         if not ids:
             return res
@@ -4033,22 +3859,16 @@
     _columns = {
         'reference': fields.char('Reference', size=16, readonly=True, required=True),
         'session_id': fields.many2one('training.session', 'Session', select=1, required=True, readonly=True),
-        'date': fields.function(_date_compute, method=True,
-                                string='First Seance Date',
-                                type='datetime',
+        'date': fields.function(_date_compute, method=True, string='First Seance Date', type='datetime',
                                 store={
                                     'training.participation.stakeholder': (_store_get_requests, None, 25),
-                                },
-                                select=1,
-                                ),
+                                }),
         'kind' : fields.related('session_id', 'offer_id', 'kind', type='char', readonly=True, select=1, string="Offer's Kind"),
         'job_id': fields.many2one('res.partner.job', 'Contact', required=True, select=1, **WRITABLE_ONLY_IN_DRAFT),
         'email' : fields.char('Email', size=128, select=1, **WRITABLE_ONLY_IN_DRAFT),
         'payment_mode' : fields.selection([('contract', 'Contract'),
                                            ('invoice', 'Invoice')
-                                          ],
-                                          'Payment Mode',
-                                          select=1),
+                                          ], 'Payment Mode'),
         'participation_ids': fields.one2many('training.participation.stakeholder', 'request_id', 'Participations', **WRITABLE_ONLY_IN_DRAFT),
         'notes' : fields.text('Notes'),
         'state': fields.selection([('draft', 'Draft'),
@@ -4058,23 +3878,14 @@
                                    ('refused', 'Refused'),
                                    ('cancelled', 'Cancelled'),
                                    ('done', 'Done'),
-                                  ],
-                                  'State',
-                                  readonly=True,
-                                  required=True,
-                                  select=1,
-                                 ),
+                                  ], 'State', readonly=True, required=True),
         'purchase_order_id': fields.many2one('purchase.order', 'Purchase Order', readonly=True),
         'purchase_paid': fields.related('purchase_order_id', 'invoice_id', 'reconciled', type='boolean', string='Invoice Paid', readonly=True,),
         'amount_to_pay': fields.function(_amount_to_pay, string='Amount to pay', type='char', size='20', readonly=True, method=True),
-        'price' : fields.function(_price_compute, method=True,
-                                  string='Remuneration',
-                                  type='float',
-                                  digits_compute=dp.get_precision('Account'),
+        'price' : fields.function(_price_compute, method=True, string='Remuneration', type='float', digits_compute=dp.get_precision('Account'),
                                   store={
                                       'training.participation.stakeholder': (_store_get_requests, None, 25),
-                                  },
-                                  ),
+                                  }),
     }
 
     _defaults = {
@@ -4101,12 +3912,14 @@
 
     @tools.cache(skiparg=4)
     def _get_stock_location(self, cr, uid, context=None):
-        r = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')], context=context, limit=1)
-        if not r:
+        result = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')], context=context, limit=1)
+        if not result:
             return False
-        return r[0]
+        return result[0]
 
     def _create_PO(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         po_proxy = self.pool.get('purchase.order')
 
         for this in self.browse(cr, uid, ids, context=context):
@@ -4126,6 +3939,8 @@
                 sh.create_purchase_order_line(po_id)
 
     def action_create_purchase_order(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for obj in self.browse(cr, uid, ids, context=context):
             if not obj.payment_mode:
                 raise osv.except_osv(_('Error'),
@@ -4198,6 +4013,8 @@
         return 0
 
     def action_wkf_accept(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         cr.sql_log = True
         report_invoice = netsvc.LocalService('report.account.invoice')
         self.write(cr, uid, ids, {'state': 'accepted'}, context=context)
@@ -4221,6 +4038,8 @@
         return True
 
     def action_wkf_send_request_email(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         email_proxy = self.pool.get('training.email')
         for this in self.browse(cr, uid, ids, context=context):
             seances = list(sh.seance_id for sh in this.participation_ids)
@@ -4230,6 +4049,8 @@
         return True
 
     def action_wkf_send_cancellation_email(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         email_proxy = self.pool.get('training.email')
         for this in self.browse(cr, uid, ids, context=context):
             seances = list(sh.seance_id for sh in this.participation_ids)
@@ -4239,6 +4060,8 @@
         return True
 
     def action_wkf_refuse(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         self.write(cr, uid, ids, {'state': 'refused'}, context=context)
         self._cancel_PO(cr, uid, ids, context)
         self._spread_wkf_signal(cr, uid, ids, 'signal_refuse', context)
@@ -4274,6 +4097,8 @@
         }}
 
     def on_change_seance(self, cr, uid, _, job_id, seance_id, context=None):
+        if context is None:
+            context = {}
         seance = seance_id and self.pool.get('training.seance').browse(cr, uid, seance_id, context) or False
         return {'value': {
             'group_id': seance and seance.group_id.id or False,
@@ -4288,6 +4113,8 @@
         }}
 
     def on_change_manual(self, cr, uid, ids, manual, job_id, seance_id, context=None):
+        if context is None:
+            context = {}
         if not manual:
             return {}
         return {'value': {
@@ -4300,6 +4127,8 @@
         }}
 
     def _default_price_compute(self, cr, uid, job, seance, product_id=None, context=None):
+        if context is None:
+            context = {}
         if not job or not seance:
             return False
 
@@ -4332,6 +4161,8 @@
         return unit_price * seance.duration
 
     def _get_price(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, 0.0)
         for this in self.browse(cr, uid, ids, context=context):
             if this.manual_price:
@@ -4344,44 +4175,22 @@
     _columns = {
         'request_id': fields.many2one('training.participation.stakeholder.request', 'Request', readonly=True, required=True, ondelete='cascade'),
         'request_session_id': fields.related('request_id', 'session_id', type='many2one', relation='training.session', readonly=True),
-        'seance_id' : fields.many2one('training.seance',
-                                      'Seance',
-                                      required=True,
-                                      select=1,
-                                      help='Select the Seance',
-                                      ondelete='cascade',
-                                      domain="[('date', '>=', time.strftime('%Y-%m-%d'))]"
-                                     ),
+        'seance_id' : fields.many2one('training.seance', 'Seance', required=True, help='Select the Seance', ondelete='cascade',
+                                      domain="[('date', '>=', time.strftime('%Y-%m-%d'))]"),
         'group_id' : fields.related('seance_id', 'group_id', type='many2one', relation='training.group', readonly=True, select=1, store=True, string='Group'),
         'job_id': fields.related('request_id', 'job_id', string="Contact", type='many2one', relation='res.partner.job', readonly=True),
         'contact_id' : fields.related('job_id', 'contact_id', type='many2one', relation='res.partner.contact', readonly=True, store=True, select=2),
         'partner_id' : fields.related('job_id', 'name', type='many2one', relation='res.partner', readonly=True, store=True, string="Partner", select=2),
         'date' : fields.related('seance_id', 'date', type='datetime', string='Date', readonly=True, select=1, store=True),
-        'kind' : fields.related('seance_id', 'kind',
-                                type='selection',
-                                selection=[('standard', 'Course')],
-                                string='Kind',
-                                readonly=True,
-                                select=1),
-        'course_id' : fields.related('seance_id', 'course_id',
-                                     type='many2one',
-                                     relation='training.course',
-                                     string='Course',
-                                     readonly=True,
-                                     select=1),
-
+        'kind' : fields.related('seance_id', 'kind', type='selection', selection=[('standard', 'Course')], string='Kind', readonly=True),
+        'course_id' : fields.related('seance_id', 'course_id', type='many2one', relation='training.course', string='Course', readonly=True),
         'state' : fields.selection([('draft', 'Draft'),
                                     ('accepted', 'Accepted'),
                                     ('refused', 'Refused'),
                                     ('cancelled', 'Cancelled'),
                                     ('done', 'Done'),
-                                   ],
-                                   'State',
-                                   required=True,
-                                   readonly=True,
-                                   select=1,),
+                                   ], 'State', required=True, readonly=True),
         'duration' : fields.related('seance_id', 'duration', type='float', string='Duration', readonly=True, store=True),
-
         'state_seance' : fields.related('seance_id', 'state', type='selection',
                                         selection=[('opened', 'Opened'),
                                                    ('confirmed', 'Confirmed'),
@@ -4389,30 +4198,13 @@
                                                    ('closed', 'Closed'),
                                                    ('cancelled', 'Cancelled'),
                                                    ('done', 'Done')
-                                                  ],
-                                        string='State of Seance',
-                                        readonly=True,
-                                       ),
-
-        'purchase_order_line_id' : fields.many2one('purchase.order.line',
-                                                   'Purchase Order Line',
-                                                   readonly=True),
-        'purchase_order_id' : fields.related('purchase_order_line_id', 'order_id',
-                                             string='Purchase Order',
-                                             type='many2one',
-                                             relation='purchase.order',
-                                             readonly=True),
-
+                                                  ], string='State of Seance', readonly=True),
+        'purchase_order_line_id' : fields.many2one('purchase.order.line', 'Purchase Order Line', readonly=True),
+        'purchase_order_id' : fields.related('purchase_order_line_id', 'order_id', string='Purchase Order', type='many2one', relation='purchase.order', readonly=True),
         'paid' : fields.related('purchase_order_id', 'invoiced', type='boolean', string='Invoiced & Paid', readonly=True, select=1),
-
         'manual_price': fields.boolean('Manual Price'),
         'forced_price': fields.float('Renumeration', required=True, digits_compute=dp.get_precision('Account')),
-        'price' : fields.function(_get_price, method=True,
-                                  string='Remuneration',
-                                  type='float',
-                                  digits_compute=dp.get_precision('Account'),
-                                  store=True,
-                                 ),
+        'price' : fields.function(_get_price, method=True, string='Remuneration', type='float', digits_compute=dp.get_precision('Account'), store=True),
         'product_id' : fields.many2one('product.product', 'Product', select=2),
     }
 
@@ -4425,6 +4217,8 @@
                 and seance_record.course_id.analytic_account_id.id or ''
 
     def create_purchase_order_line(self, cr, uid, ids, po_id, context=None):
+        if context is None:
+            context = {}
         po_proxy = self.pool.get('purchase.order')
         pol_proxy = self.pool.get('purchase.order.line')
         workflow = netsvc.LocalService('workflow')
@@ -4454,6 +4248,8 @@
             obj.write({'purchase_order_line_id' : pol_id})
 
     def _check_disponibility(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for this in self.browse(cr, uid, ids, context=context):
             contact = this.job_id.contact_id
             cr.execute("""SELECT s.id
@@ -4478,6 +4274,8 @@
         return True
 
     def send_email(self, cr, uid, ids, trigger, session, context=None, objects_by_ids=None):
+        if context is None:
+            context = {}
         if objects_by_ids is None:
             objects_by_ids = {}
         email_proxy = self.pool.get('training.email')
@@ -4493,6 +4291,8 @@
         return True
 
     def _action_wkf(self, cr, uid, ids, state, purchase_order_signal, context=None):
+        if context is None:
+            context = {}
         # First, validate or cancel the purcchase order line (at least try to)
         wkf = netsvc.LocalService('workflow')
         for this in self.browse(cr, uid, ids, context):
@@ -4592,12 +4392,8 @@
     _name = 'training.session.duplicate.wizard'
 
     _columns = {
-        'session_id': fields.many2one('training.session', 'Session',
-                                      required=True,
-                                      readonly=True,
-                                      domain=[('state', 'in', ['opened', 'opened_confirmed'])]),
-        'group_id' : fields.many2one('training.group', 'Group',
-                                     domain="[('session_id', '=', session_id)]"),
+        'session_id': fields.many2one('training.session', 'Session', required=True, readonly=True, domain=[('state', 'in', ['opened', 'opened_confirmed'])]),
+        'group_id' : fields.many2one('training.group', 'Group', domain="[('session_id', '=', session_id)]"),
         'subscription_line_ids' : fields.many2many('training.subscription.line',
                                                    'training_sdw_participation_rel',
                                                    'wizard_id',
@@ -4610,6 +4406,10 @@
         return {'type' : 'ir.actions.act_window_close'}
 
     def action_apply(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         this = self.browse(cr, uid, ids[0], context=context)
 
         if len(this.subscription_line_ids) == 0:
@@ -4690,6 +4490,8 @@
         return {'type' : 'ir.actions.act_window_close'}
 
     def default_get(self, cr, uid, fields, context=None):
+        if context is None:
+            context = {}
         record_id = context and context.get('record_id', False) or False
 
         res = super(training_session_duplicate_wizard, self).default_get(cr, uid, fields, context=context)
@@ -4714,7 +4516,7 @@
     def action_po_create(self, cr, uid, po_line_ids, location_id, context=None):
         """ function action_po_assign from mrp module, modified to fullfill needs
             or basing training purchase system """
-        if not context:
+        if context is None:
             context = {}
         purchase_id = False
         company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
@@ -4836,7 +4638,6 @@
 
     _columns = {
         'seance_id_int' : fields.related('seance_id', 'id', type='integer', readonly=True, string="Seance ID"),
-
         'seance_id': fields.many2one('training.seance', 'Seance'),
         'seance_date': fields.related('seance_id', 'date', type='datetime', string='Seance Date', readonly=True, store=True, select=1),
         'course_id': fields.many2one('training.course', 'Course'),
@@ -4852,14 +4653,14 @@
                                              ('done', 'Done'),
                                              ('cancel', 'Cancelled')
                                             ],
-                                string='Order Status',
-                                readonly=True,
+                                string='Order Status', readonly=True, select=True,
                                 help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.",
-                                select=True
                                ),
     }
 
     def approved_cb(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
         for pol in self.browse(cr, uid, ids, context=context):
             if len(pol.order_id.order_line) in (0, 1):
@@ -4872,6 +4673,8 @@
         return True
 
     def cancel_cb(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         workflow = netsvc.LocalService('workflow')
         for pol in self.browse(cr, uid, ids, context=context):
             if len(pol.order_id.order_line) in (0, 1):
@@ -4901,47 +4704,15 @@
     _description = 'Training Subscription Cancellation Wizard'
 
     _columns = {
-        'subscription_line_id' : fields.many2one('training.subscription.line', 'Subscription Line',
-                                                 domain="[('state', 'in', ['draft', 'confirmed']),('session_id.state', 'in', ('opened', 'opened_confirmed', 'closed_confirmed'))]",
-                                                 required=True
-                                                ),
-        'subscription_id' : fields.related('subscription_line_id', 'subscription_id',
-                                           type='many2one',
-                                           relation='training.subscription',
-                                           string='Subscription',
-                                           readonly=True),
-
-        'partner_id' : fields.related('subscription_line_id', 'subscription_id', 'partner_id',
-                                      type='many2one',
-                                      relation='res.partner',
-                                      string='Partner',
-                                      readonly=True),
-
-        'participant_id' : fields.related('subscription_line_id', 'job_id',
-                                          type='many2one',
-                                          relation='res.partner.job',
-                                          string='Participant',
-                                          readonly=True),
-
-        'session_id' : fields.related('subscription_line_id', 'session_id',
-                                      type='many2one',
-                                      relation='training.session',
-                                      string='Session',
-                                      readonly=True),
-
-        'session_offer_id' : fields.related('subscription_line_id', 'session_id', 'offer_id',
-                                            type='many2one',
-                                            relation='training.session',
-                                            string='Session Offer',
-                                            readonly=True),
-
-        'session_date' : fields.related('subscription_line_id', 'session_id', 'date',
-                                        type='datetime',
-                                        string='Session Date',
-                                        readonly=True),
-
-        'session_state' : fields.related('subscription_line_id', 'session_id', 'state',
-                                         type='selection',
+        'subscription_line_id' : fields.many2one('training.subscription.line', 'Subscription Line', required=True,
+                                                 domain="[('state', 'in', ['draft', 'confirmed']),('session_id.state', 'in', ('opened', 'opened_confirmed', 'closed_confirmed'))]"),
+        'subscription_id' : fields.related('subscription_line_id', 'subscription_id', type='many2one', relation='training.subscription', string='Subscription', readonly=True),
+        'partner_id' : fields.related('subscription_line_id', 'subscription_id', 'partner_id', type='many2one', relation='res.partner', string='Partner', readonly=True),
+        'participant_id' : fields.related('subscription_line_id', 'job_id', type='many2one', relation='res.partner.job', string='Participant', readonly=True),
+        'session_id' : fields.related('subscription_line_id', 'session_id', type='many2one', relation='training.session', string='Session', readonly=True),
+        'session_offer_id' : fields.related('subscription_line_id', 'session_id', 'offer_id', type='many2one', relation='training.session', string='Session Offer', readonly=True),
+        'session_date' : fields.related('subscription_line_id', 'session_id', 'date', type='datetime', string='Session Date', readonly=True),
+        'session_state' : fields.related('subscription_line_id', 'session_id', 'state', type='selection',
                                          selection=[
                                              ('draft', 'Draft'),
                                              ('opened', 'Opened'),
@@ -4950,38 +4721,20 @@
                                              ('inprogress', 'In Progress'),
                                              ('closed', 'Closed'),
                                              ('cancelled', 'Cancelled')
-                                         ],
-                                         string='Session State',
-                                         readonly=True),
-
-        'new_participant_id' : fields.many2one('res.partner.job', 'Participant',
-                                               domain="[('name', '=', partner_id),('id', '!=', participant_id),('state', '=', 'current')]"),
-
+                                         ], string='Session State', readonly=True),
+        'new_participant_id' : fields.many2one('res.partner.job', 'Participant', domain="[('name', '=', partner_id),('id', '!=', participant_id),('state', '=', 'current')]"),
         'new_participant_email' : fields.char('Email', size=128),
-
-        'new_session_id' : fields.many2one('training.session', 'Session',
-                                           domain="[('state', 'in', ('opened', 'opened_confirmed')),('date', '>', time.strftime('%Y-%m-%d')),('date', '>', session_date),('offer_id', '=', session_offer_id)]"
-                                          ),
-
+        'new_session_id' : fields.many2one('training.session', 'Session', domain="[('state', 'in', ('opened', 'opened_confirmed')),('date', '>', time.strftime('%Y-%m-%d')),('date', '>', session_date),('offer_id', '=', session_offer_id)]"),
         'new_session_date' : fields.related('new_session_id', 'date', type='datetime', string='Session Date', readonly=True),
-
         'cancellation_reason' : fields.text('Reason'),
         'cancellation_medical_certificate_toggle' : fields.boolean('Has Justification'),
         'cancellation_medical_certificate_name' : fields.char('Filename', size=128),
         'cancellation_medical_certificate' : fields.binary('Justification'),
-
         'state' : fields.selection([('init', 'Init'),
                                     ('replacement', 'Replacement'),
                                     ('postponement', 'Postponement'),
                                     ('cancellation', 'Cancellation'),
-                                    ('end', 'End')],
-                                   'State',
-                                   required=True,
-                                   readonly=True
-                                  ),
-
-
-
+                                    ('end', 'End')], 'State', required=True, readonly=True),
     }
 
     _defaults = {
@@ -4990,9 +4743,10 @@
     }
 
     def on_change_subscription_line(self, cr, uid, ids, subscription_line_id, context=None):
+        if context is None:
+            context = {}
         if not subscription_line_id:
             return {}
-
         subscription_line = self.pool.get('training.subscription.line').browse(cr, uid, subscription_line_id, context=context)
         return {
             'value' : {
@@ -5008,6 +4762,8 @@
         }
 
     def on_change_new_participant(self, cr, uid, ids, new_participant_id, context=None):
+        if context is None:
+            context = {}
         if not new_participant_id:
             return {}
 
@@ -5015,11 +4771,11 @@
         return {'value' : {'new_participant_email' : job.email }}
 
     def on_change_new_session(self, cr, uid, ids, new_session_id, context=None):
+        if context is None:
+            context = {}
         if not new_session_id:
             return {}
-
         session = self.pool.get('training.session').browse(cr, uid, new_session_id, context=context)
-
         return {
             'value' : {
                 'new_session_date' : session.date,
@@ -5041,15 +4797,13 @@
         return self.write(cr, uid, ids, {'state' : 'postponement'}, context=context)
 
     def action_apply(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         if not ids:
             return False
-
         this = self.browse(cr, uid, ids[0], context=context)
-
         old_participant_id = this.participant_id
-
         workflow = netsvc.LocalService('workflow')
-
         context2 = context.copy()
         if 'default_state' in context2:
             del context2['default_state']
@@ -5064,9 +4818,7 @@
                     'res_model' : 'training.subscription.line',
                     'res_id' : this.subscription_line_id.id,
                 }
-
                 self.pool.get('ir.attachment').create(cr, uid, values, context=context2)
-
             this.subscription_line_id.write(
                 {
                     'has_certificate' : this.cancellation_medical_certificate_toggle,
@@ -5074,7 +4826,6 @@
                 },
                 context=context2
             )
-
             workflow.trg_validate(uid, 'training.subscription.line', this.subscription_line_id.id, 'signal_cancel', cr)
             sl_proxy = self.pool.get('training.subscription.line')
 
@@ -5098,9 +4849,7 @@
                                                                      old_participant_id.contact_id.name,
                                                                      this.new_participant_id.contact_id.first_name,
                                                                      this.new_participant_id.contact_id.name))
-
             this.subscription_line_id.write({'internal_note' : "\n----\n".join(internal_note)})
-
             email_proxy.send_email(cr, uid,
                              'sub_replacement',
                              'hr',
@@ -5115,9 +4864,7 @@
                 'session_id' : this.new_session_id.id,
             }
             sl_proxy = self.pool.get('training.subscription.line')
-
             new_sl_id = sl_proxy.copy(cr, uid, this.subscription_line_id.id, values, context = context2 or {})
-
             new_sl = sl_proxy.browse(cr, uid, new_sl_id, context=context2)
             new_sl.write({'internal_note' : _("Created by Postponement of %s") % this.subscription_line_id.name})
             this.subscription_line_id.write({'reason_cancellation' : _("Cancelled by Postponement: %s") % new_sl.name })
@@ -5141,10 +4888,8 @@
         'participation_seance_date' : fields.related('participation_id', 'seance_id', 'date', type='datetime', readonly=True, string='Date'),
         'participation_sl' : fields.related('participation_id', 'subscription_line_id', type='many2one', relation='training.subscription.line', readonly=True, string='Subscription Line'),
         'participation_session_id' : fields.related('participation_id', 'subscription_line_id', 'session_id', type='many2one', relation='training.session',
-                                                    readonly=True,
-                                                    string='Session'),
-        'seance_id' : fields.many2one('training.seance', 'Seance',
-                                      required=True),
+                                                    readonly=True, string='Session'),
+        'seance_id' : fields.many2one('training.seance', 'Seance', required=True),
     }
 
     def on_change_seance(self, cr, uid, ids, seance_id, context=None):
@@ -5153,10 +4898,11 @@
                 'participation_id' : not seance_id and [] or [('seance_id', '=', seance_id)],
             }
         }
-
         return values
 
     def on_change_participation(self, cr, uid, ids, participation_id, context=None):
+        if context is None:
+            context = {}
         if not participation_id:
             return {
                 'value' : {
@@ -5184,14 +4930,16 @@
         return {'type' : 'ir.actions.act_window_close'}
 
     def apply_cb(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         this = self.browse(cr, uid, ids[0], context=context)
 
         if this.participation_id.seance_id == this.seance_id:
             raise osv.except_osv(_('Warning'),
                                  _('You have selected the same seance'))
-
         this.participation_id.write({'seance_id' : this.seance_id.id})
-
         return {'type' : 'ir.actions.act_window_close'}
 
 training_participation_reassign_wizard()
@@ -5232,6 +4980,8 @@
     _inherit = 'training.seance'
 
     def _purchase_in_error(self, cr, uid, ids, fieldname, args, context=None):
+        if context is None:
+            context = {}
         prsh_error_obj = self.pool.get('training.seance.purchase_errors')
         res = dict.fromkeys(ids, False)
 
@@ -5246,6 +4996,8 @@
         return res
 
     def _purchase_in_error_search(self, cr, uid, obj, name, args, context=None):
+        if context is None:
+            context = {}
         if not len(args):
             return []
         search_for_errors = False
@@ -5258,20 +5010,15 @@
         return [('id', 'in', seance_ids)]
 
     _columns = {
-        'purchase_in_error' : fields.function(_purchase_in_error, method=True,
-                                           fnct_search=_purchase_in_error_search,
-                                           type='boolean',
-                                           string='Have Purchase In Errors'),
+        'purchase_in_error' : fields.function(_purchase_in_error, method=True, fnct_search=_purchase_in_error_search,
+                                           type='boolean', string='Have Purchase In Errors'),
     }
 training_seance_purchase_errors()
 
 class res_partner_w_themes(osv.osv):
     _inherit = 'res.partner'
     _columns = {
-        'theme_ids': fields.many2many('training.course.theme',
-                                      'res_partner_themes_rel',
-                                      'partner_id', 'theme_id',
-                                      string='Themes'),
+        'theme_ids': fields.many2many('training.course.theme', 'res_partner_themes_rel', 'partner_id', 'theme_id', string='Themes'),
         'target_public_id': fields.many2one('training.offer.public.target', 'Target Audience'),
     }
 res_partner_w_themes()

=== modified file 'training/training_content_review.py'
--- training/training_content_review.py	2011-03-14 10:48:46 +0000
+++ training/training_content_review.py	2011-03-21 12:30:59 +0000
@@ -21,31 +21,31 @@
 #
 ##############################################################################
 
-import time
 from osv import osv
 from osv import fields
-from tools import config
+
+import time
 from tools.translate import _
 import decimal_precision as dp
 
-class training_content_review_line_advance(osv.osv):
-    _name = 'training.content.review.line'
-training_content_review_line_advance()
-
-class training_content_review_writer_advance(osv.osv):
-    _name = 'training.content.review.writer'
-training_content_review_writer_advance()
-
-class training_content_review_purchase_line(osv.osv):
-    _name = 'training.content.review.purchase.line'
-training_content_review_purchase_line()
-
 content_review_type = [
     ('other_material', 'Other Material'),
     ('course_material', 'Course Material'),
     ('', ''),
 ]
 
+class training_content_review_line_advance(osv.osv):
+    _name = 'training.content.review.line'
+training_content_review_line_advance()
+
+class training_content_review_writer_advance(osv.osv):
+    _name = 'training.content.review.writer'
+training_content_review_writer_advance()
+
+class training_content_review_purchase_line(osv.osv):
+    _name = 'training.content.review.purchase.line'
+training_content_review_purchase_line()
+
 class training_content_review_reason(osv.osv):
     _name = 'training.content.review.reason'
 
@@ -66,6 +66,7 @@
     _sql_constraints = [
         ('uniq_code', 'unique(code)', "Must be unique"),
     ]
+
 training_content_review_reason()
 
 class training_content_review(osv.osv):
@@ -107,6 +108,8 @@
         raise osv.except_osv(_("Can't compute seance_next_date field with unknown review type"))
 
     def _seance_next_date_compute(self, cr, uid, ids, fieldnames, args, context=None):
+        if context is None:
+            context = {}
         res = dict.fromkeys(ids, '') #time.strftime('%Y-%m-%d %H:%M:%S'))
         time_cmp = time.strftime('%Y-%m-%d 00:00:00')
 
@@ -134,6 +137,8 @@
         return res
 
     def create_invoice(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         inv_pool = self.pool.get('account.invoice')
         jrnl_pool = self.pool.get('account.journal')
         adist_pool = self.pool.get('account.analytic.plan.instance')
@@ -184,7 +189,7 @@
             inv_pool.button_compute(cr, uid, [inv_id], context=context, set_total=True)
 
             self.write(cr, uid, [review.id], {'invoice_id': inv_id}, context=context)
-
+        return True
 
     _name = 'training.content.review'
     _rec_name = 'ref'
@@ -209,10 +214,7 @@
         'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True, select=2),
         'type': fields.related('reason_id', 'type', type='selection', selection=_get_type_selection, string='Type', readonly=True, select=2),
         'state': fields.selection(_STATES, 'State', required=True, readonly=True, select=1),
-        'seance_next_date' : fields.function(_seance_next_date_compute,
-                                     method=True,
-                                     string='Seance Next Date',
-                                     type='datetime'),
+        'seance_next_date' : fields.function(_seance_next_date_compute, method=True, string='Seance Next Date', type='datetime'),
         'partner_id': fields.many2one('res.partner', 'Partner', select=True),
         'address_id': fields.many2one('res.partner.address', 'Address'),
         'team_id': fields.many2one('res.partner.team', 'Team', select=2),
@@ -227,32 +229,29 @@
     }
 
     def onchange_reason_id(self, cr, uid, ids, reason_id, context=None):
-        r = {'value': {'type': '', 'reason_to_invoice': True}}
+        result = {'value': {'type': '', 'reason_to_invoice': True}}
         reason_pool = self.pool.get('training.content.review.reason')
         if reason_id:
             reason = reason_pool.browse(cr, uid, reason_id, context=context)
-            r['value']['type'] = reason.type
-            r['value']['reason_to_invoice'] = reason.to_invoice
-        return r
+            result['value'].update({
+                        'type' : reason.type,
+                        'reason_to_invoice' : reason.to_invoice
+                        })
+        return result
 
     def onchange_delivery_date(self, cr, uid, ids, delivery_date, context=None):
-        print("review: onchange_delivery_date# delivery_date => %s" % (delivery_date))
-        r = {'value': {}}
+        result = {'value': {}}
         if not delivery_date:
-            return r
-        r['value']['estimated_delivery_date'] = delivery_date
+            return result
+        result['value'].update({'estimated_delivery_date' : delivery_date})
+        return result
 
     def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
-        r = {'value': {}}
+        result = {'value': {'address_id' : False}}
         if partner_id:
             partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
-            if partner.address:
-                r['value']['address_id'] = partner.address[0].id
-            else:
-                r['value']['address_id'] = False
-        else:
-            r['value']['address_id'] = False
-        return r
+            result['value'].update({'address_id' : partner.address and partner.address[0].id or False})
+        return result
 
     def action_draft(self, cr, uid, ids, context=None):
         return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
@@ -267,10 +266,11 @@
             'state': 'validated',
             'validation_date': time.strftime('%Y-%m-%d %H:%M:%S'),
         }
-        review = self.browse(cr, uid, ids[0], context=context)
-        if review.delivery_date:
-            vals['estimated_delivery_date'] = review.delivery_date
-        return self.write(cr, uid, [ ids[0] ], vals, context=context)
+        for review in self.browse(cr, uid, ids, context=context):
+            if review.delivery_date:
+                vals.update({'estimated_delivery_date' : review.delivery_date})
+            result = self.write(cr, uid, [review.id], vals, context=context)
+        return result
 
     def action_inprogress(self, cr, uid, ids, context=None):
         if not ids:
@@ -278,10 +278,11 @@
         vals = {
             'state': 'inprogress',
         }
-        review = self.browse(cr, uid, ids[0], context=context)
-        if review.delivery_date:
-            vals['estimated_delivery_date'] = review.delivery_date
-        return self.write(cr, uid, ids, vals, context=context)
+        for review in self.browse(cr, uid, ids, context=context):
+            if review.delivery_date:
+                vals.update({'estimated_delivery_date' : review.delivery_date})
+            result = self.write(cr, uid, [review.id], vals, context=context)
+        return result
 
     def action_done(self, cr, uid, ids, context=None):
         return self.write(cr, uid, ids, {'state': 'done'}, context=context)
@@ -296,8 +297,8 @@
 
     def _get_document_name_by_type(self, cr, uid, review_line, context=None):
         if review_line.review_id.type == 'course_material':
-            n = review_line.course_material_id
-            return n and n.name_get()[0][1] or ''
+            material = review_line.course_material_id
+            return material and material.name_get()[0][1] or ''
         return ''
 
     def _get_document_name(self, cr, uid, ids, fname, args, context=None):
@@ -312,6 +313,7 @@
         'content_name': fields.function(_get_document_name, string='Content Name', type='char', size=255, method=True),
         'course_material_id': fields.many2one('ir.attachment', 'Course Material'),
     }
+
 training_content_review_line()
 
 class training_content_review_line_wizard(osv.osv_memory):
@@ -327,7 +329,7 @@
         return ''
 
     def action_add_content(self, cr, uid, ids, context=None):
-        if not context:
+        if context is None:
             context = {}
         wizard = self.browse(cr, uid, ids[0], context=context)
         active_id = context.get('active_id')
@@ -361,15 +363,11 @@
     }
 
     def onchange_job_id(self, cr, uid, ids, job_id, context=None):
-        print("review_writer: ONCHANGE JOB ID: %s" % (job_id))
-        r = {'value': {}}
+        result = {'value': {'job_email' : ''}}
         if job_id:
             job_pool = self.pool.get('res.partner.job')
-            job = job_pool.browse(cr, uid, job_id, context=context)
-            r['value']['job_email'] = job.email
-        else:
-            r['value']['job_email'] = ''
-        return r
+            result['value'].update({'job_email' : job_pool.browse(cr, uid, job_id, context=context).email or False})
+        return result
 
 training_content_review_writer()
 
@@ -383,7 +381,6 @@
                    }
 
         product = self.pool.get('product.product').browse(cr, uid, product_id)
-
         return {
             'value' : {
                 'unit_price' : product.standard_price,
@@ -396,31 +393,20 @@
 
     def _price_compute(self, cr, uid, ids, fieldnames, args, context=None):
         res = dict.fromkeys(ids, 0.0)
-
         for obj in self.browse(cr, uid, ids, context=context):
             res[obj.id] = obj.product_qty * obj.unit_price
         return res
 
     _columns = {
         'review_id': fields.many2one('training.content.review', 'Review', required=True),
-
         'product_id': fields.many2one('product.product', 'Product', select=1),
         'account_id': fields.many2one('account.account', 'Account', select=1, required=True),
         'tax_ids': fields.many2many('account.tax', 'training_content_purchase_line_taxes', 'purchase_line_id', 'tax_id', 'Taxes'),
         'description': fields.char('Description', size=128, required=True),
         'product_qty': fields.float('Quantity', required=True),
         'product_uom': fields.many2one('product.uom', 'Product UoM'),
-        'unit_price': fields.float('Unit Price', required=True,
-                                    digits_compute=dp.get_precision('Account'),
-                                   ),
-        'price': fields.function(_price_compute,
-                                  method=True,
-                                  string='Price',
-                                  store=True,
-                                  select=2,
-                                  digits_compute=dp.get_precision('Account'),
-                                  type='float'),
-
+        'unit_price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Account')),
+        'price': fields.function(_price_compute, method=True, string='Price', store=True, digits_compute=dp.get_precision('Account'), type='float'),
     }
 
     _defaults = {
@@ -434,14 +420,13 @@
 
     def _get_active_review(self, cr, uid, ids, type, context=None):
         review_pool = self.pool.get('training.content.review')
-        rq = [('type', '=', type),('course_id', 'in', ids),('state', 'in', ['validated', 'inprogress'])]
-        rev_ids = review_pool.search(cr, uid, rq)
+        domain = [('type', '=', type),('course_id', 'in', ids),('state', 'in', ['validated', 'inprogress'])]
+        rev_ids = review_pool.search(cr, uid, domain, context=context)
 
         result = set()
         for r in review_pool.browse(cr, uid, rev_ids, context=context):
             if r.course_id.id in ids:
                 result.add(r.course_id.id)
-
         result = dict([ (id, id in result) for id in ids ])
 
         return result
@@ -455,8 +440,8 @@
                 else:
                     op = 'not in'
         review_pool = self.pool.get('training.content.review')
-        rq = [('type', '=', type),('state', 'in', ['validated', 'inprogress'])]
-        rev_ids = review_pool.search(cr, uid, rq)
+        domain = [('type', '=', type),('state', 'in', ['validated', 'inprogress'])]
+        rev_ids = review_pool.search(cr, uid, domain, context=context)
 
         result = set()
         for r in review_pool.browse(cr, uid, rev_ids, context=context):
@@ -465,37 +450,32 @@
         return [('id', op, list(result))]
 
     def _get_active_course_review(self, cr, uid, ids, fn, args, context=None):
-        r = self._get_active_review(cr, uid, ids, 'course_material', context=context)
-        return r
+        return self._get_active_review(cr, uid, ids, 'course_material', context=context)
 
     def _search_active_course_review(self, cr, uid, obj, name, args, context=None):
         return self._search_active_review(cr, uid, 'course_material', 'active_course_review', args, context=context)
-        return []
 
     def _get_active_exam_review(self, cr, uid, ids, fn, args, context=None):
-        r = self._get_active_review(cr, uid, ids, 'exam_material', context=context)
-        return r
+        return self._get_active_review(cr, uid, ids, 'exam_material', context=context)
 
     def _search_active_exam_review(self, cr, uid, obj, name, args, context=None):
         return self._search_active_review(cr, uid, 'exam_material', 'active_exam_review', args, context=context)
-        return []
 
     def _get_active_review_name(self, cr, uid, ids, type, context=None):
         review_pool = self.pool.get('training.content.review')
-        rq = [('type', '=', type),('course_id', 'in', ids),('state', 'in', ['validated', 'inprogress'])]
-        rev_ids = review_pool.search(cr, uid, rq)
+        domain = [('type', '=', type),('course_id', 'in', ids),('state', 'in', ['validated', 'inprogress'])]
+        rev_ids = review_pool.search(cr, uid, domain, context=context)
 
         rev_data = {}
         for r in review_pool.browse(cr, uid, rev_ids, context=context):
             rev_data.setdefault(r.course_id.id, []).extend(r.name_get())
 
-
         names = review_pool.name_get(cr, uid, rev_ids, context=context)
-        r = dict.fromkeys(ids, '')
+        result = dict.fromkeys(ids, '')
         for k, v in rev_data.iteritems():
-            r[k] = ','.join([ x[1] for x in v ])
+            result[k] = ','.join([ x[1] for x in v ])
 
-        return r
+        return result
 
     def _get_active_course_review_name(self, cr, uid, ids, fn, args, context=None):
         return self._get_active_review_name(cr, uid, ids, 'course_material', context=context)
@@ -517,3 +497,5 @@
         'active_course_review': fields.related('course_id', 'active_course_review', string='Active Course Review', type='boolean', select=1),
     }
 training_seance_review_inherit()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'training/training_data.xml'
--- training/training_data.xml	2011-01-10 14:43:34 +0000
+++ training/training_data.xml	2011-03-21 12:30:59 +0000
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
     <data>
+
         <record model="training.offer.kind" id="training_offer_kind_standard">
             <field name="code">standard</field>
             <field name="name">Standard</field>
@@ -10,6 +11,7 @@
             <field name="code">standard</field>
             <field name="name">Standard</field>
         </record>
+
     </data>
 </openerp>
 

=== modified file 'training/training_email.py'
--- training/training_email.py	2011-02-25 12:33:02 +0000
+++ training/training_email.py	2011-03-21 12:30:59 +0000
@@ -1,7 +1,7 @@
 # -*- encoding: utf-8 -*-
 ############################################################################################
 #
-#    OpenERP, Open Source Management Solution	
+#    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 #    Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved
 #    Copyright (C) 2010-2011 Thamini S.à.R.L (<http://www.thamini.com>). All Rights Reserved
@@ -21,10 +21,10 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ############################################################################################
-from osv import osv, fields
+from osv import osv
+from osv import fields
 from osv.orm import browse_record
 
-import tools
 import locale
 import time
 from mako.template import Template as MakoTemplate
@@ -32,7 +32,6 @@
 import traceback
 import sys
 import netsvc
-import cPickle
 
 class training_email_stylegroup(osv.osv):
     _name = 'training.email.stylegroup'
@@ -58,20 +57,18 @@
     _name = 'training.email.error'
 
     _columns = {
-        'create_date' : fields.datetime('Create Date', readonly=True, select=1),
-        'create_uid' : fields.many2one('res.users', 'User', readonly=True, select=1),
-        'name' : fields.char('Subject', size=256,
-                             required=True, readonly=True,
-                             select=1),
-        'message' : fields.text('Message', select=1,
-                                required=True, readonly=True),
-        'objects' : fields.text('Objects',
-                                required=True, readonly=True),
+        'create_date' : fields.datetime('Create Date', readonly=True),
+        'create_uid' : fields.many2one('res.users', 'User', readonly=True),
+        'name' : fields.char('Subject', size=256, required=True, readonly=True),
+        'message' : fields.text('Message', required=True, readonly=True),
+        'objects' : fields.text('Objects', required=True, readonly=True),
     }
 
     _order = 'create_date desc'
 
     def action_send(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
         for obj in self.browse(cr, uid, ids, context=context):
             objects = eval(obj.objects)
 
@@ -142,11 +139,11 @@
         return self.write(cr, uid, ids, {'state' : 'deprecated'}, context=context)
 
     def _get_default_layout(self, cr, uid, context):
-        ima = self.pool.get('ir.model.data')
-        imaid = ima.search(cr, uid, [('module', '=', 'training'), ('name', '=', 'default_email_layout')])
-        if not imaid:
+        model_data_pool = self.pool.get('ir.model.data')
+        model_data_ids = model_data_pool.search(cr, uid, [('module', '=', 'training'), ('name', '=', 'default_email_layout')])
+        if not model_data_ids:
             return False
-        return ima.read(cr, uid, [imaid[0]], ['res_id'])[0]['res_id']
+        return model_data_pool.browse(cr, uid, model_data_ids[0], context=context).res_id
 
     def _get_default_stylegroup(self, cr, uid, context=None):
         tesg = self.pool.get('training.email.stylegroup')
@@ -196,15 +193,10 @@
                 ('e', 'Examiners'),
                 ('po', 'Portal'),
             ],
-            'Target',
-            size=4,
-            required=True,
-            select=1),
-
-        'notes': fields.text('Internal Note', translate=True, select=2),
-
-        'subject' : fields.char('Subject', size=256, required=True, translate=True, select=1),
-        'smtp_client_id' : fields.many2one('email.smtpclient', 'SMTP Client', required=True, select=2, domain=[('state', '=', 'confirm')]),
+            'Target', size=4, required=True),
+        'notes': fields.text('Internal Note', translate=True),
+        'subject' : fields.char('Subject', size=256, required=True, translate=True),
+        'smtp_client_id' : fields.many2one('email.smtpclient', 'SMTP Client', required=True, domain=[('state', '=', 'confirm')]),
         'body' : fields.text('Body', required=True, translate=True),
         'state' : fields.selection([('draft', 'Draft'),
                                     ('validated', 'Validated'),
@@ -212,18 +204,19 @@
                                    ],
                                    'State',
                                    required=True,
-                                   readonly=True,
-                                   select=1),
+                                   readonly=True),
         'layout_id': fields.many2one('training.email.layout', 'Layout'),
         'sign_id': fields.many2one('training.email.sign', 'Sign'),
         'from': fields.char('Email From', size=128, help='If not specify, use the email defined in the SMTP Client'),
         'reply_to': fields.char('Reply-to', size=128),
         'bcc': fields.char('Bcc', size=128),
         'fail_email': fields.char('Fail Email', size=128, help='If the mail rendering fail, the traceback will be sent to this email'),
-        'stylegroup_id': fields.many2one('training.email.stylegroup', 'Style Group', select=1),
+        'stylegroup_id': fields.many2one('training.email.stylegroup', 'Style Group'),
     }
 
     def verify_trigger_target(self, cr, uid, ids, trigger, target, context=None):
+        if context is None:
+            context = {}
         if not trigger or not target:
             return {}
         warn = None
@@ -256,13 +249,13 @@
             if trigger != 'procurements':
                 warn = _('Suppliers can only receive procurements emails')
                 values['trigger'] = 'procurements'
-
-
         if not warn:
             return {}
         return {'value': values, 'warning': {'title': _('Unreachable couple trigger/target'), 'message': warn}}
 
-    def _get_email(self, cr, uid, trigger, target, stylegroup, context):
+    def _get_email(self, cr, uid, trigger, target, stylegroup, context=None):
+        if context is None:
+            context = {}
         stylegroup_id = stylegroup and stylegroup.id or None
         def do_search(trigger, target, stylegroup_id):
             search_crit = [('state', '=', 'validated'),
@@ -291,15 +284,17 @@
         """Check that only one email template by training.email `code'
            is in `validated' state
         """
+        if context is None:
+            context = {}
         for email in self.browse(cr, uid, ids, context=context):
             if email.state == 'validated':
-                cnt = self.search_count(cr, uid, [('state', '=', 'validated'),
+                count = self.search_count(cr, uid, [('state', '=', 'validated'),
                                                   ('trigger', '=', email.trigger),
                                                   ('target', '=', email.target),
                                                   ('stylegroup_id', '=', email.stylegroup_id.id),
                                                   ('id', '!=', email.id)],
                                         context=context)
-                if cnt != 0:
+                if count != 0:
                     return False
         return True
 
@@ -312,7 +307,6 @@
         'layout_id': _get_default_layout,
     }
 
-
     def render(self, cr, uid, email, what, tpl, **objects):
         try:
             return MakoTemplate(tpl).render_unicode(**objects)
@@ -328,7 +322,7 @@
     ${ zz }
 %endfor
 
-Traceback: 
+Traceback:
 ${tb}
 """
 
@@ -370,15 +364,15 @@
             if email.fail_email:
                 self.pool.get('email.smtpclient').send_email(cr, uid, email.smtp_client_id.id, email.fail_email, subject, body, emailfrom=email['from'])
             else:
-                netsvc.Logger().notifyChannel('training.email', netsvc.LOG_ERROR, subject) 
-                netsvc.Logger().notifyChannel('training.email', netsvc.LOG_ERROR, body) 
+                netsvc.Logger().notifyChannel('training.email', netsvc.LOG_ERROR, subject)
+                netsvc.Logger().notifyChannel('training.email', netsvc.LOG_ERROR, body)
 
             return None
 
     def _get_attachments(self, cr, uid, model, oid, context=None):
         proxy = self.pool.get('ir.attachment')
-        aids = proxy.search(cr, uid, [('res_model', '=', model), ('res_id', '=', oid)], context=context)
-        return [(a.datas_fname or a.name, a.datas.decode('base64')) for a in proxy.browse(cr, uid, aids, context=context)]
+        attachment_ids = proxy.search(cr, uid, [('res_model', '=', model), ('res_id', '=', oid)], context=context)
+        return [(a.datas_fname or a.name, a.datas.decode('base64')) for a in proxy.browse(cr, uid, attachment_ids, context=context)]
 
     def _get_lang(self, session, seance, **objects):
         lng = None
@@ -389,6 +383,8 @@
         return lng
 
     def convert_date(self, date_string, context=None):
+        if context is None:
+            context = {}
         lc_time_backup = locale.getlocale(locale.LC_TIME)
         lang_format = {
             'fr_FR': '%d %B %Y - %HH%M',
@@ -396,7 +392,7 @@
             'en_US': '%B, %d %Y - %HH%M',
         }
         lang = 'fr_FR'
-        if context and 'lang' in context and context['lang'] in lang_format:
+        if context.get('lang',False) in lang_format:
             lang = context['lang']
         try:
             locale.setlocale(locale.LC_TIME, (lang, lc_time_backup[1]))
@@ -413,6 +409,8 @@
         return subline.participation_ids[0].seance_id.group_id.id
 
     def send_email(self, cr, uid, trigger, target, to, session=None, seance=None, attachments=None, context=None, stylegroup=None, **objects):
+        if context is None:
+            context = {}
         if not to:
             return False
 
@@ -427,11 +425,9 @@
         if attachments is None:
             attachments = []
 
-
         email = self._get_email(cr, uid, trigger, target, stylegroup, context=ctx)
         if not email:
             return False
-
         attachments += self._get_attachments(cr, uid, 'training.email', email.id, ctx)
 
         if session:
@@ -488,12 +484,12 @@
         else:
             body += sign
 
-        self.pool.get('email.smtpclient').send_email(cr, uid, email.smtp_client_id.id, 
-                                                     emailto=to, 
-                                                     subject=subject, 
-                                                     body=body, 
-                                                     attachments=attachments, 
-                                                     emailfrom=email['from'], 
+        self.pool.get('email.smtpclient').send_email(cr, uid, email.smtp_client_id.id,
+                                                     emailto=to,
+                                                     subject=subject,
+                                                     body=body,
+                                                     attachments=attachments,
+                                                     emailfrom=email['from'],
                                                      replyto=email.reply_to,
                                                      bcc=email.bcc)
         return True
@@ -538,7 +534,7 @@
                 body = body.encode('utf-8')
 
             html = MIMEText(body or '', _charset='utf-8', _subtype="html")
-            html.add_header('Content-Disposition', 'inline') 
+            html.add_header('Content-Disposition', 'inline')
             msg.attach(html)
 
             # search for company logo in email body
@@ -608,5 +604,3 @@
 smtp_queue()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
-

=== modified file 'training/training_holiday.py'
--- training/training_holiday.py	2011-02-25 12:33:02 +0000
+++ training/training_holiday.py	2011-03-21 12:30:59 +0000
@@ -1,7 +1,7 @@
 # -*- encoding: utf-8 -*-
 ############################################################################################
 #
-#    OpenERP, Open Source Management Solution	
+#    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 #    Copyright (C) 2008-2009 AJM Technologies S.A. (<http://www.ajm.lu). All Rights Reserved
 #    Copyright (C) 2010-2011 Thamini S.à.R.L (<http://www.thamini.com>). All Rights Reserved
@@ -21,7 +21,8 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ############################################################################################
-from osv import osv, fields
+from osv import osv
+from osv import fields
 from tools.translate import _
 
 import time
@@ -34,11 +35,7 @@
 
     _columns = {
         'year' : fields.integer('Year', select=1, required=True),
-
-        'period_ids' : fields.one2many('training.holiday.period',
-                                       'year_id',
-                                       'Holiday Periods',
-                                      ),
+        'period_ids' : fields.one2many('training.holiday.period', 'year_id', 'Holiday Periods'),
     }
 
     _defaults = {
@@ -50,12 +47,7 @@
     ]
 
     def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80):
-        return self.name_get(cr, uid,
-                             self.search(cr, uid,
-                                         [('year', '=', name)]+args,
-                                         limit=limit),
-                             context=context)
-
+        return self.name_get(cr, uid, self.search(cr, uid, [('year', '=', name)]+args, limit=limit), context=context)
 
 holiday_year()
 
@@ -63,15 +55,10 @@
     _name = 'training.holiday.period'
 
     _columns = {
-        'year_id' : fields.many2one('training.holiday.year',
-                                    'Year',
-                                    required=True,
-                                    select=1,
-                                    ondelete='cascade'),
-
+        'year_id' : fields.many2one('training.holiday.year', 'Year', required=True, ondelete='cascade'),
         'name' : fields.char('Name', size=64, required=True),
-        'date_start' : fields.date('Date Start', required=True, select=1),
-        'date_stop' : fields.date('Date Stop', required=True, select=1),
+        'date_start' : fields.date('Date Start', required=True),
+        'date_stop' : fields.date('Date Stop', required=True),
         'active' : fields.boolean('Active'),
         'contact_id' : fields.many2one('res.partner.contact', 'Contact'),
     }
@@ -83,10 +70,11 @@
     }
 
     def _check_date_start_stop(self, cr, uid, ids, context=None):
+        if not ids:
+            return False
         obj = self.browse(cr, uid, ids[0], context=context)
         return obj.date_start <= obj.date_stop
 
-
     def is_in_period(self, cr, date):
         if not date:
             raise osv.except_osv(_('Warning'),
@@ -122,8 +110,11 @@
         return {'type': 'ir.actions.act_window_close'}
 
     def action_apply(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        if not ids:
+            return False
         this = self.browse(cr, uid, ids[0], context=context)
-
         first_day = mx.DateTime.strptime('%04s-01-01' % (this.year,), '%Y-%m-%d')
         last_day = mx.DateTime.strptime('%04s-12-31' % (this.year,), '%Y-%m-%d')
 
@@ -171,3 +162,4 @@
 
 holiday_year_wizard()
 
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'training/wizard/training_create_block_offer.py'
--- training/wizard/training_create_block_offer.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_create_block_offer.py	2011-03-21 12:30:59 +0000
@@ -19,9 +19,9 @@
 #
 ##############################################################################
 
-from osv import osv, fields
+from osv import osv
+from osv import fields
 from tools.translate import _
-import netsvc
 
 class training_create_block_offer(osv.osv_memory):
     _name = 'training.create.block.offer'
@@ -35,24 +35,28 @@
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
+        if not context.get('active_model'):
+            return {}
 
-        proxy = self.pool.get(context['active_model'])
-        name = None
-        product_line = False
+        proxy = self.pool.get(context.get('active_model'))
         languages = set()
-
+        result = {'name': None}
         for course in proxy.browse(cr, uid, context.get('active_ids', []), context=context):
             if course.state_course != 'validated':
                 raise osv.except_osv(_('Warning'), _("Please, The state of all courses must be 'validated'"))
-            if name is None:
-                name = course.name
-            product_line = course.category_id.id
+            if result.get('name',None) is None:
+                result.update({'name': course.name})
+            result.update({
+                           'product_line_id': course.category_id and course.category_id.id or False,
+                           'type_id': course.course_type_id and course.course_type_id.id or False
+                           })
             languages.add(course.lang_id.id)
 
         if len(languages) > 1:
             raise osv.except_osv(_('Warning'), _('You have selected a course with a different language'))
 
-        return {'name':name, 'lang_id':list(languages)[0], 'product_line_id':product_line, 'type_id':course.course_type_id.id}
+        result.update({'lang_id': list(languages)[0]})
+        return result
 
 
     def create_block_offer(self, cr, uid, ids, context=None):

=== modified file 'training/wizard/training_create_block_offer.xml'
--- training/wizard/training_create_block_offer.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/training_create_block_offer.xml	2011-03-21 12:30:59 +0000
@@ -13,10 +13,11 @@
 						<field name="lang_id" />
 						<field name="product_line_id" />
 					</group>
-	            	<newline/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
-	                    <button type="object" name="create_block_offer" string="Create Offers" icon="gtk-apply"/>
+	                    <button type="object" name="create_block_offer" string="Create Offers" icon="gtk-new"/>
 	                </group>
 	            </form>
 	        </field>

=== modified file 'training/wizard/training_create_offer.py'
--- training/wizard/training_create_offer.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_create_offer.py	2011-03-21 12:30:59 +0000
@@ -19,7 +19,7 @@
 #
 ##############################################################################
 
-from osv import osv, fields
+from osv import osv
 from tools.translate import _
 import netsvc
 

=== modified file 'training/wizard/training_create_offer.xml'
--- training/wizard/training_create_offer.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/training_create_offer.xml	2011-03-21 12:30:59 +0000
@@ -8,10 +8,11 @@
 	        <field name="arch" type="xml">
 	            <form string="Create Offers">
 	            	<label string="Do you want to create an offer for each selected course ?" />
-	            	<newline/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
-	                    <button type="object" name="create_offers" string="Create Offers" icon="gtk-apply"/>
+	                    <button type="object" name="create_offers" string="Create Offers" icon="gtk-new"/>
 	                </group>
 	            </form>
 	        </field>

=== modified file 'training/wizard/training_subscription_line_confirm.py'
--- training/wizard/training_subscription_line_confirm.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_line_confirm.py	2011-03-21 12:30:59 +0000
@@ -19,8 +19,7 @@
 #
 ##############################################################################
 
-from osv import osv, fields
-from tools.translate import _
+from osv import osv
 import netsvc
 
 class training_subscription_line_confim(osv.osv_memory):

=== modified file 'training/wizard/training_subscription_line_confirm.xml'
--- training/wizard/training_subscription_line_confirm.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_line_confirm.xml	2011-03-21 12:30:59 +0000
@@ -8,7 +8,8 @@
 	        <field name="arch" type="xml">
 	            <form string="Confirm Subscription Lines">
 	            	<label string="Do you want to confirm all subscription lines ?" />
-	            	<newline/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
 	                    <button type="object" name="confirm_line" string="Confirm" icon="gtk-apply"/>

=== modified file 'training/wizard/training_subscription_second_line.py'
--- training/wizard/training_subscription_second_line.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_second_line.py	2011-03-21 12:30:59 +0000
@@ -19,8 +19,7 @@
 #
 ##############################################################################
 
-from osv import osv, fields
-from tools.translate import _
+from osv import osv
 
 class training_subscription_second_line(osv.osv_memory):
     _name = 'training.subscription.second.line'

=== modified file 'training/wizard/training_subscription_second_line.xml'
--- training/wizard/training_subscription_second_line.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_second_line.xml	2011-03-21 12:30:59 +0000
@@ -8,7 +8,8 @@
 	        <field name="arch" type="xml">
 	            <form string="Mass Subscription Second Line">
 	            	<label string="This wizard will generate the subscription !" />
-	            	<newline/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
 	                    <button type="object" name="make_subscription" string="Make Subscription" icon="gtk-apply"/>

=== modified file 'training/wizard/training_subscription_session.py'
--- training/wizard/training_subscription_session.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_session.py	2011-03-21 12:30:59 +0000
@@ -19,8 +19,8 @@
 #
 ##############################################################################
 
-from osv import osv, fields
-from tools.translate import _
+from osv import osv
+from osv import fields
 
 class training_subscription_session(osv.osv_memory):
     _name = 'training.subscription.session'

=== modified file 'training/wizard/training_subscription_session.xml'
--- training/wizard/training_subscription_session.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/training_subscription_session.xml	2011-03-21 12:30:59 +0000
@@ -13,9 +13,11 @@
 	                <field name="job_ids"  nolabel="1" colspan="4" domain="[('name', '=', partner_id),('state', '=', 'current')]" />
 	                <separator string="Sessions" colspan="2" />
 	                <field name="line_ids" nolabel="1" colspan="4" domain="[('state', 'in', ('opened','opened_confirmed'))]"/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
-	                    <button type="object" name="make_subscription" string="Create Subscription" icon="gtk-apply"/>
+	                    <button type="object" name="make_subscription" string="Create Subscription" icon="gtk-new"/>
 	                </group>
 	            </form>
 	        </field>

=== modified file 'training/wizard/training_validate_course.py'
--- training/wizard/training_validate_course.py	2011-03-18 08:57:04 +0000
+++ training/wizard/training_validate_course.py	2011-03-21 12:30:59 +0000
@@ -20,8 +20,8 @@
 #
 ##############################################################################
 
+from osv import osv
 import netsvc
-from osv import osv, fields
 
 class validate_courses(osv.osv_memory):
     _name = 'validate.courses'

=== modified file 'training/wizard/validate_course_view.xml'
--- training/wizard/validate_course_view.xml	2011-03-18 08:57:04 +0000
+++ training/wizard/validate_course_view.xml	2011-03-21 12:30:59 +0000
@@ -8,7 +8,8 @@
 	        <field name="arch" type="xml">
 	            <form string="Validate Courses">
 	            	<label string="Do you want to validate the selected courses ?" />
-	            	<newline/>
+	                <newline/>
+	                <separator colspan="4" string=""/>
 	                <group colspan="2" col="2">
 	                    <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
 	                    <button type="object" name="validate_courses" string="Validate Courses" icon="gtk-apply"/>

=== modified file 'training/wizard/wizard_create_session_view.xml'
--- training/wizard/wizard_create_session_view.xml	2010-10-06 14:19:57 +0000
+++ training/wizard/wizard_create_session_view.xml	2011-03-21 12:30:59 +0000
@@ -7,11 +7,13 @@
         <field name="type">form</field>
         <field name="arch" type="xml">
             <form string="Plannify Session" col="2">
-                <label string="Can you select a date for the session ?" colspan="2" />
-                <newline />
-                <field name="name" />
-                <newline />
-                <field name="date" />
+                <label string="Can you select a date for the session ?" colspan="2"/>
+                <newline/>
+                <field name="name"/>
+                <newline/>
+                <field name="date"/>
+                <newline/>
+                <separator colspan="4" string=""/>
                 <group colspan="2" col="2">
                     <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
                     <button type="object" name="create_session" string="Create Session" icon="gtk-apply"/>
@@ -37,5 +39,6 @@
         <field name="object" eval="True"/>
         <field name="value" eval="'ir.actions.act_window,%d' % ref('training_session_create_wizard_action')"/>
     </record>
+
 </data>
 </openerp>

=== modified file 'training_exam/training_exam_view.xml'
--- training_exam/training_exam_view.xml	2011-03-18 13:32:27 +0000
+++ training_exam/training_exam_view.xml	2011-03-21 12:30:59 +0000
@@ -108,8 +108,8 @@
                     <group colspan="4" col="9">
                         <field name="state"/>
                         <button type="action" name="%(training_exam.exam_question_new_version_action)d" string="Create New Version" icon="gtk-new" states="validated,deprecated"/>
-                        <button type="action" name="%(training_exam_question_validate_wizard_action)d" string="Validate" icon="gtk-execute" states="draft"/>
-                        <button type="action" name="%(wizard_question_deprecate_action)d" string="Deprecate" icon="gtk-go-forward" states="validated"/>
+                        <button type="action" name="%(training_exam_question_validate_wizard_action)d" string="Validate" icon="terp-camera_test" states="draft"/>
+                        <button type="action" name="%(wizard_question_deprecate_action)d" string="Deprecate" icon="gtk-cancel" states="validated"/>
                     </group>
                 </form>
             </field>
@@ -159,17 +159,16 @@
             <field name="arch" type="xml">
                 <search string="Search Exam Question">
                     <filter icon="terp-document-new" string="Draft" domain="[('state','=', 'draft')]"/>
-                    <filter icon="gtk-apply" string="Validate" domain="[('state','=', 'validated')]"/>
-                    <filter icon="terp-dialog-close" string="Deprecate" domain="[('state','=', 'deprecated')]"/>
+                    <filter icon="terp-camera_test" string="Validate" domain="[('state','=', 'validated')]"/>
                     <separator orientation="vertical"/>
                     <field name="type"/>
                     <field name="name"/>
                     <field name="question"/>
                     <newline/>
                     <group expand="0" string="Group By..." >
-                        <filter string="Type" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'type'}"/>
+                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                         <separator orientation="vertical"/>
-                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+                        <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
                     </group>
                 </search>
             </field>
@@ -306,8 +305,8 @@
                     </notebook>
                     <group colspan="4" col="8">
                         <field name="state" />
-                        <button name="signal_teq_deprecate" icon="terp-dialog-close" string="Deprecate" type="workflow" states="inprogress,validated" confirm="Do you want to deprecate this questionnaire ?" />
-                        <button name="signal_teq_validate" icon="gtk-go-up" string="Validate" type="workflow" states="inprogress,draft" confirm="Do you want to validate this questionnaire ?" />
+                        <button name="signal_teq_deprecate" icon="gtk-cancel" string="Deprecate" type="workflow" states="inprogress,validated" confirm="Do you want to deprecate this questionnaire ?" />
+                        <button name="signal_teq_validate" icon="terp-camera_test" string="Validate" type="workflow" states="inprogress,draft" confirm="Do you want to validate this questionnaire ?" />
                         <button name="%(training_exam.exam_questionnaire_new_version_action)d" icon="terp-document-new" string="Create a New Version" type="action" states="validated,deprecated"/>
                     </group>
                 </form>
@@ -378,17 +377,16 @@
             <field name="arch" type="xml">
                 <search string="Search Session">
                     <filter icon="terp-document-new" string="Draft" domain="[('state', '=', 'draft')]"/>
-                    <filter icon="gtk-apply" string="Validate" domain="[('state','=', 'validated')]"/>
-                    <filter icon="terp-dialog-close" string="Deprecate" domain="[('state','=', 'deprecated')]"/>
+                    <filter icon="terp-camera_test" string="Validate" domain="[('state','=', 'validated')]"/>
                     <separator orientation="vertical"/>
                     <field name="kind"/>
                     <field name="name"/>
                     <field name="reference"/>
                     <newline/>
                     <group expand="0" string="Group By...">
-                        <filter string="Type" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'type'}"/>
+                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                         <separator orientation="vertical"/>
-                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+                        <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
                     </group>
                 </search>
             </field>

=== modified file 'training_exam/wizard/training_exam_add_question_view.xml'
--- training_exam/wizard/training_exam_add_question_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_add_question_view.xml	2011-03-21 12:30:59 +0000
@@ -13,6 +13,7 @@
                     <separator colspan="4" string="Questions"/>
                     <field name="question_ids" nolabel="1" colspan="4"
                         context="{'course_id' : course_id}" domain="[('state','in',['draft','validated'])]"/>
+                    <separator colspan="4" string=""/>
                     <group colspan="4" col="2">
                         <button name="cancel_cb" string="Cancel" special="cancel" type="object" icon="gtk-cancel"/>
                         <button name="add_questions_cb" string="Add Questions" type="object" icon="terp-document-new"/>

=== modified file 'training_exam/wizard/training_exam_depricate_question_view.xml'
--- training_exam/wizard/training_exam_depricate_question_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_depricate_question_view.xml	2011-03-21 12:30:59 +0000
@@ -9,6 +9,8 @@
             <form string="Deprecate Questions" col="2">
                 <label string="Are you sure you want to deprecate thoses questions?" align="0.5"/>
                 <field name="note" nolabel="1" colspan="2" height="150"/>
+                <newline/>
+                <separator colspan="4" string=""/>
                 <group colspan="2" col="2">
                     <button type="special" special="cancel" string="Cancel" colspan="1" icon="gtk-cancel"/>
                     <button type="object" name="button_deprecate" string="Deprecate" colspan="1" icon="gtk-execute"/>

=== modified file 'training_exam/wizard/training_exam_print_questionnaire_raw_view.xml'
--- training_exam/wizard/training_exam_print_questionnaire_raw_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_print_questionnaire_raw_view.xml	2011-03-21 12:30:59 +0000
@@ -9,7 +9,12 @@
             <form string="Print RAW Questionnaire" col="2">
                 <field name="lang_id"/>
                 <field name="show_solution"/>
-                <button name="button_create_report" colspan="2" string="Create Report" type="object"/>
+                <newline/>
+                <separator colspan="4" string=""/>
+                <group colspan="2" col="2">
+                    <button type="special" special="cancel" string="Cancel" colspan="1" icon="gtk-cancel"/>
+                    <button name="button_create_report" colspan="2" string="Create Report" type="object"/>
+                </group>
             </form>
         </field>
     </record>

=== modified file 'training_exam/wizard/training_exam_question_create_new_version_view.xml'
--- training_exam/wizard/training_exam_question_create_new_version_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_question_create_new_version_view.xml	2011-03-21 12:30:59 +0000
@@ -10,6 +10,8 @@
                 <form string="Create New Revision">
                     <label string="Are you sure you want to create a new version?"/>
                     <field name="note" nolabel="1" colspan="4"/>
+	                <newline/>
+	                <separator colspan="4"/>
                     <group colspan="4" col="2">
                         <button type="special" icon="gtk-cancel" special="cancel" string="Cancel"/>
                         <button type="object" icon="terp-document-new" name="action_create_new_version" string="Create"/>

=== modified file 'training_exam/wizard/training_exam_question_validate_view.xml'
--- training_exam/wizard/training_exam_question_validate_view.xml	2011-03-18 11:26:51 +0000
+++ training_exam/wizard/training_exam_question_validate_view.xml	2011-03-21 12:30:59 +0000
@@ -9,6 +9,8 @@
                 <form string="Validate Wizard" col="2">
                     <separator string="Confirmation Required" colspan="2"/>
                     <field name="questionnaire_ids" height="300" colspan="2"/>
+	                <newline/>
+	                <separator colspan="4"/>
                     <group colspan="2" col="6">
                         <field name="state" invisible="1"/>
                         <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>

=== modified file 'training_exam/wizard/training_exam_question_view.xml'
--- training_exam/wizard/training_exam_question_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_question_view.xml	2011-03-21 12:30:59 +0000
@@ -9,6 +9,8 @@
                 <form string="Question Wizard" col="4">
                     <separator string="Question Wizard" colspan="4"/>
                     <field name="course_id" colspan="4"/>
+	                <newline/>
+	                <separator colspan="4"/>
                     <group colspan="4">
                         <button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
                         <button name="find_question_with_course" string="_Apply" icon="gtk-apply" type="object" />

=== modified file 'training_exam/wizard/training_exam_questionnaire_create_new_version_view.xml'
--- training_exam/wizard/training_exam_questionnaire_create_new_version_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_questionnaire_create_new_version_view.xml	2011-03-21 12:30:59 +0000
@@ -9,6 +9,8 @@
                 <form string="Create New Revision">
                     <label string="Are you sure you want to create a new version?"/>
                     <field name="note" colspan="4" nolabel="1"/>
+	                <newline/>
+	                <separator colspan="4"/>
                     <group colspan="4" col="2">
                         <button type="special" special="cancel" string="Cancel" icon="gtk-cancel"/>
                         <button type="object" name="action_create_new_version" string="Create" icon="terp-document-new"/>

=== modified file 'training_exam/wizard/training_exam_questionnaire_view.xml'
--- training_exam/wizard/training_exam_questionnaire_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_questionnaire_view.xml	2011-03-21 12:30:59 +0000
@@ -13,7 +13,8 @@
                     <separator string="Information about the questions" colspan="2"/>
                     <field name="kind" />
                     <field name="number_of_question" />
-                    <separator colspan="2" />
+	                <newline/>
+	                <separator colspan="2"/>
                     <group colspan="2">
                         <button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" type="object"/>
                         <button name="action_generate_questionnaire" string="_Apply" icon="gtk-apply" type="object" />

=== modified file 'training_exam/wizard/training_exam_validate_question_view.xml'
--- training_exam/wizard/training_exam_validate_question_view.xml	2011-03-15 10:34:06 +0000
+++ training_exam/wizard/training_exam_validate_question_view.xml	2011-03-21 12:30:59 +0000
@@ -9,6 +9,7 @@
             <form string="Valide Questions" col="2">
                 <label string="Are you sure you want to validate thoses questions?" align="0.5"/>
                 <newline/>
+                <separator colspan="4"/>
                 <group colspan="2" col="2">
                     <button type="special" special="cancel" string="Cancel" colspan="1" icon="gtk-cancel"/>
                     <button type="object" name="button_validate" string="Validate" colspan="1" icon="gtk-ok"/>

=== modified file 'training_intra/report/detail_offer_intra.py'
--- training_intra/report/detail_offer_intra.py	2011-03-15 09:12:30 +0000
+++ training_intra/report/detail_offer_intra.py	2011-03-21 12:30:59 +0000
@@ -22,10 +22,7 @@
 
 import time
 from report import report_sxw
-import tools
-import pooler
 import netsvc
-import base64
 from report.pyPdf import PdfFileReader, PdfFileWriter
 try:
     from cStringIO import StringIO
@@ -58,8 +55,7 @@
     def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None):
         if context is None:
             context = {}
-        pool = pooler.get_pool(cr.dbname)
-        offer_pool = pool.get('training.offer')
+        offer_pool = self.pool.get('training.offer')
         sale_order_report = netsvc.LocalService('report.sale.order')
 
         def merge_data(dest, source_data):

=== modified file 'training_intra/report/offer_intra.py'
--- training_intra/report/offer_intra.py	2010-10-07 14:01:05 +0000
+++ training_intra/report/offer_intra.py	2011-03-21 12:30:59 +0000
@@ -22,7 +22,6 @@
 
 import time
 from report import report_sxw
-import tools
 
 class training_offer_intra_report(report_sxw.rml_parse):
     def __init__(self, cr, uid, name, context):
@@ -36,9 +35,9 @@
         })
 
     def line(self,account_id,userid):
-        res=[]
+        res = []
         self.cr.execute('select name,date from account_analytic_line where  account_id =%d and user_id =%d'%(account_id,userid))
-        res=self.cr.dictfetchall()
+        res = self.cr.dictfetchall()
         return res or []
 
     def _has_one_session(self, offer_id):

=== modified file 'training_intra/training_intra.py'
--- training_intra/training_intra.py	2011-03-15 09:12:30 +0000
+++ training_intra/training_intra.py	2011-03-21 12:30:59 +0000
@@ -213,7 +213,6 @@
             }
         }
 
-
     def _check_product_qty(self, cr, uid, ids, context=None):
         return self.browse(cr, uid, ids[0], context=context).product_qty >= 0
 

=== modified file 'training_intra/training_intra_view.xml'
--- training_intra/training_intra_view.xml	2011-03-18 10:16:47 +0000
+++ training_intra/training_intra_view.xml	2011-03-21 12:30:59 +0000
@@ -64,10 +64,6 @@
                 <search string="Search Training Intra Budget">
                    <field name="product_id"/>
                    <field name="type"/>
-                   <newline/>
-	               <group expand="0" string="Group By..." colspan="4">
-	                   <filter string="Type" icon="terp-stock_symbol-selection" domain="[]"  context="{'group_by':'type'}"/>
-	               </group>
                </search>
             </field>
         </record>
@@ -169,20 +165,20 @@
                                 <group col="5" colspan="4">
                                     <field name="budget_intra_template_id" on_change="on_change_budget_intra_template(budget_intra_template_id)" />
                                     <field name="number_of_participants" />
-                                    <button name="action_add_costs" string="Load Costs From Courses" type="object" />
+                                    <button name="action_add_costs" string="Load Costs From Courses" type="object" icon="gtk-execute"/>
                                 </group>
                                 <field name="budget_intra_line_ids" colspan="4" nolabel="1" context="{'default_offer_id' : active_id}" />
                                 <group colspan="4" col="8">
                                     <field name="costs" />
                                     <field name="revenues" />
                                     <field name="balance" />
-                                    <button name="action_compute_values" string="Compute" type="object" />
-                                    <button name="%(budget_intra_offer)d" string="Zoom" type="action" />
+                                    <button name="action_compute_values" icon="terp-stock_format-scientific" string="Compute" type="object" />
+                                    <button name="%(budget_intra_offer)d" string="Zoom" icon="gtk-zoom-fit" type="action" />
                                 </group>
                                 <group colspan="4" col="5">
                                     <field name="sale_order_id" />
                                     <field name="sale_order_state" />
-                                    <button name="action_create_quotation" string="Create Quotation" type="object" /> <!--attrs="{'invisible' : [('sale_order_id', '!=', False)]}"/> -->
+                                    <button name="action_create_quotation" icon="terp-document-new" string="Create Quotation" type="object" /> <!--attrs="{'invisible' : [('sale_order_id', '!=', False)]}"/> -->
                                 </group>
                             </page>
                             <page string="Notes">
@@ -211,9 +207,9 @@
                         <attribute name="states">deprecated,refused,done</attribute>
                     </button>
                     <button name="draft_cb" position="before">
-                        <button name="signal_draft" string="Draft" states="validated" type="workflow" confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?"/>
+                        <button name="signal_draft" icon="terp-document-new" string="Draft" states="validated" type="workflow" confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?"/>
                         <group col="2" colspan="2" attrs="{'invisible': [('kind','!=','intra')]}">
-                            <button name="signal_refused" string="Refused" icon='gtk-cancel' states="draft" type="workflow" confirm="Are you sure you want to mark this offer as refused ?"/>
+                            <button name="signal_refused" string="Refused" icon='gtk-refresh' states="draft" type="workflow" confirm="Are you sure you want to mark this offer as refused ?"/>
                             <button name="signal_done" string="Done" states="validated" icon='gtk-jump-to' type="workflow" confirm="Are you sure you want to mark this offer as done ?"/>
                         </group>
                     </button>
@@ -302,10 +298,6 @@
                     <field name="course_id"/>
                     <field name="type"/>
                     <field name="product_id"/>
-                    <newline/>
-					<group expand="0" string="Group By..." colspan="4">
-					    <filter string="Type" icon="terp-stock_symbol-selection" domain="[]"  context="{'group_by':'type'}"/>
-					</group>
                 </search>
             </field>
         </record>
@@ -340,6 +332,7 @@
                     <field name="is_standalone"/>
                     <field name="state"/>
 				    <field name="costs"/>
+				    <field name="product_id" invisible="1"/>
 				    <field name="revenues"/>
                     <field name="sale_order_id"/>
                     <field name="sale_order_create_date"/>
@@ -356,10 +349,7 @@
                 <search string="Search Training Offer">
                    <group col='10' colspan='4'>
                         <filter icon="terp-document-new" string="Draft" domain="[('state','=', 'draft')]"/>
-                        <filter icon="terp-accessories-archiver" string="Validated" domain="[('state','=', 'validated')]"/>
-                        <filter icon="terp-dialog-close" string="Deprecated" domain="[('state','=', 'deprecated')]"/>
-                        <filter icon="gtk-go-up" string="Done" domain="[('state','=', 'done')]"/>
-                        <filter icon="gtk-refresh" string="Refused" domain="[('state','=', 'refused')]"/>
+                        <filter icon="terp-camera_test" string="Validated" domain="[('state','=', 'validated')]"/>
                         <separator orientation="vertical"/>
                         <field name="name"/>
                         <field name="type_id"/>
@@ -367,11 +357,11 @@
                        </group>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="20">
-                       <filter string="Category" icon="terp-personal" domain="[]"  context="{'group_by':'categorie_id'}"/>
-                       <filter string="kind" icon="terp-report" domain="[]"  context="{'group_by':'kind'}"/>
+                       <filter string="Product" icon="terp-accessories-archiver" domain="[]"  context="{'group_by':'product_id'}"/>
+                       <separator orientation="vertical"/>
+                       <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]"  context="{'group_by':'state'}"/>
+                       <separator orientation="vertical"/>
                        <filter string="Type" icon="terp-stock_symbol-selection" domain="[]"  context="{'group_by':'type_id'}"/>
-                       <filter string="Product" icon="terp-stage" domain="[]"  context="{'group_by':'product_id'}"/>
-                       <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]"  context="{'group_by':'state'}"/>
                    </group>
                </search>
             </field>
@@ -386,7 +376,7 @@
             <field name="domain">[('kind', '=', 'intra')]</field>
             <field name="search_view_id" ref="view_training_intra_offer_search"/>
         </record>
-        <menuitem id="training_offer_intra_mi" parent="training.training_library_mi" action="training_offer_intra_act" sequence="20"/>
+        <menuitem id="training_offer_intra_mi" parent="training.training_library_offers_menu" action="training_offer_intra_act" sequence="20"/>
 
         <!-- contact function 'intra' doesn't exists -> choose 'standard' lecturers... -->
         <record model='ir.ui.view' id="training_session_form_inherit">

=== modified file 'training_room/training_room.py'
--- training_room/training_room.py	2011-03-15 09:12:30 +0000
+++ training_room/training_room.py	2011-03-21 12:30:59 +0000
@@ -177,11 +177,9 @@
 class training_participation_stakeholder(osv.osv):
     _inherit = 'training.participation.stakeholder'
     _columns = {
-        'seance_location_id': fields.related('seance_id', 'location_id', type='many2one',
-                                             relation='training.location',
-                                             string='Location',
-                                             readonly=True),
+        'seance_location_id': fields.related('seance_id', 'location_id', type='many2one', relation='training.location', string='Location', readonly=True),
     }
+
 training_participation_stakeholder()
 
 class purchase_order_line_seance_room(osv.osv):
@@ -191,6 +189,7 @@
         'location_id': fields.related('seance_id', 'location_id', type='many2one', relation='training.location', string='Training Location', readonly=True),
         'delivery_location_id': fields.related('seance_id', 'delivery_location_id', type='many2one', relation='training.location', string='Delivery Location', readonly=True),
     }
+
 purchase_order_line_seance_room()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== modified file 'training_room/wizard/training_create_session_wizard.py'
--- training_room/wizard/training_create_session_wizard.py	2011-03-15 09:12:30 +0000
+++ training_room/wizard/training_create_session_wizard.py	2011-03-21 12:30:59 +0000
@@ -38,10 +38,7 @@
         session_pool = self.pool.get('training.session')
         active_id = context and context.get('active_id') or None
         vals = session_pool.on_change_offer(cr, uid, None, active_id)
-        try:
-            return vals['value'][field]
-        except KeyError:
-            return False
+        return vals.get('value',{}).get(field,False)
 
     def _default_get_delivery_location(self, cr, uid, context=None):
         return self._default_get_location(cr, uid, context=context, field='delivery_location_id')
@@ -62,3 +59,5 @@
         return resdict
 
 training_session_create_wizard_room()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


Follow ups