[FIX] addons: incorrect new-api invocation of method write() with context
authorRaphael Collet <rco@openerp.com>
Thu, 13 Nov 2014 11:30:26 +0000 (12:30 +0100)
committerRaphael Collet <rco@openerp.com>
Thu, 13 Nov 2014 12:34:55 +0000 (13:34 +0100)
This fixes #3411.

addons/crm/crm_lead.py
addons/google_calendar/google_calendar.py
addons/hr_recruitment/hr_recruitment.py
addons/mrp/mrp.py
addons/product/product.py
addons/sale/sale.py
addons/website_sale_delivery/models/sale_order.py

index 866680e..992e4f3 100644 (file)
@@ -793,7 +793,7 @@ class crm_lead(format_address, osv.osv):
                 partner_id = self._create_lead_partner(cr, uid, lead, context)
                 self.pool['res.partner'].write(cr, uid, partner_id, {'section_id': lead.section_id and lead.section_id.id or False})
             if partner_id:
-                lead.write({'partner_id': partner_id}, context=context)
+                lead.write({'partner_id': partner_id})
             partner_ids[lead.id] = partner_id
         return partner_ids
 
index 03a311d..3d1a876 100644 (file)
@@ -494,7 +494,7 @@ class google_calendar(osv.AbstractModel):
 
         all_my_attendees = self.pool['calendar.attendee'].search(cr, uid, [('partner_id', '=', current_user.partner_id.id)], context=context)
         self.pool['calendar.attendee'].write(cr, uid, all_my_attendees, {'oe_synchro_date': False, 'google_internal_event_id': False}, context=context)
-        current_user.write(reset_data, context=context)
+        current_user.write(reset_data)
         return True
 
     def synchronize_events_cron(self, cr, uid, context=None):
@@ -552,7 +552,7 @@ class google_calendar(osv.AbstractModel):
                 lastSync = False
                 _logger.info("[%s] Calendar Synchro - MODE FULL SYNCHRO FORCED" % user_to_sync)
         else:
-            current_user.write({'google_calendar_cal_id': current_google}, context=context)
+            current_user.write({'google_calendar_cal_id': current_google})
             lastSync = False
             _logger.info("[%s] Calendar Synchro - MODE FULL SYNCHRO - NEW CAL ID" % user_to_sync)
 
@@ -562,7 +562,7 @@ class google_calendar(osv.AbstractModel):
 
         res = self.update_events(cr, uid, lastSync, context)
 
-        current_user.write({'google_calendar_last_sync_date': ask_time}, context=context)
+        current_user.write({'google_calendar_last_sync_date': ask_time})
         return {
             "status": res and "need_refresh" or "no_new_event_form_google",
             "url": ''
index 38777eb..911c019 100644 (file)
@@ -488,7 +488,7 @@ class hr_applicant(osv.Model):
                 address_id = self.pool.get('res.partner').address_get(cr, uid, [applicant.partner_id.id], ['contact'])['contact']
                 contact_name = self.pool.get('res.partner').name_get(cr, uid, [applicant.partner_id.id])[0][1]
             if applicant.job_id and (applicant.partner_name or contact_name):
-                applicant.job_id.write({'no_of_hired_employee': applicant.job_id.no_of_hired_employee + 1}, context=context)
+                applicant.job_id.write({'no_of_hired_employee': applicant.job_id.no_of_hired_employee + 1})
                 create_ctx = dict(context, mail_broadcast=True)
                 emp_id = hr_employee.create(cr, uid, {'name': applicant.partner_name or contact_name,
                                                      'job_id': applicant.job_id.id,
index 2a59733..2f8d399 100644 (file)
@@ -1184,7 +1184,7 @@ class mrp_production(osv.osv):
                     self._make_service_procurement(cr, uid, line, context=context)
             if stock_moves:
                 self.pool.get('stock.move').action_confirm(cr, uid, stock_moves, context=context)
-            production.write({'state': 'confirmed'}, context=context)
+            production.write({'state': 'confirmed'})
         return 0
 
     def action_assign(self, cr, uid, ids, context=None):
index 7060a4f..4a94c00 100644 (file)
@@ -854,7 +854,7 @@ class product_product(osv.osv):
                     context['uom'], value, uom.id)
         value =  value - product.price_extra
         
-        return product.write({'list_price': value}, context=context)
+        return product.write({'list_price': value})
 
     def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context=None):
         for supinfo in product.seller_ids:
@@ -905,8 +905,8 @@ class product_product(osv.osv):
         res = self.write(cr, uid, [id], {'image_variant': image}, context=context)
         product = self.browse(cr, uid, id, context=context)
         if not product.product_tmpl_id.image:
-            product.write({'image_variant': None}, context=context)
-            product.product_tmpl_id.write({'image': image}, context=context)
+            product.write({'image_variant': None})
+            product.product_tmpl_id.write({'image': image})
         return res
 
     def _get_price_extra(self, cr, uid, ids, name, args, context=None):
index 30cec29..d1736a2 100644 (file)
@@ -702,7 +702,7 @@ class sale_order(osv.osv):
             vals = self._prepare_procurement_group(cr, uid, order, context=context)
             if not order.procurement_group_id:
                 group_id = self.pool.get("procurement.group").create(cr, uid, vals, context=context)
-                order.write({'procurement_group_id': group_id}, context=context)
+                order.write({'procurement_group_id': group_id})
 
             for line in order.order_line:
                 #Try to fix exception procurement (possible when after a shipping exception the user choose to recreate)
index 6e71d3f..2fbe081 100644 (file)
@@ -63,7 +63,7 @@ class SaleOrder(orm.Model):
         if not order:
             return False
         if all(line.product_id.type == "service" for line in order.website_order_line):
-            order.write({'carrier_id': None}, context=context)
+            order.write({'carrier_id': None})
             self.pool['sale.order']._delivery_unset(cr, SUPERUSER_ID, [order.id], context=context)
             return True
         else: 
@@ -81,11 +81,11 @@ class SaleOrder(orm.Model):
                     if grid_id:
                         carrier_id = delivery_id
                         break
-                order.write({'carrier_id': carrier_id}, context=context)
+                order.write({'carrier_id': carrier_id})
             if carrier_id:
-                order.delivery_set(context=context)
+                order.delivery_set()
             else:
-                order._delivery_unset(context=context)                    
+                order._delivery_unset()                    
 
         return bool(carrier_id)