[FIX] addons: incorrect new-api invocation of method write() with context

This fixes #3411.
This commit is contained in:
Raphael Collet 2014-11-13 12:30:26 +01:00
parent 124b0a3f5d
commit b8071bbaca
7 changed files with 14 additions and 14 deletions

View 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

View 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": ''

View 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,

View 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):

View 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):

View 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)

View 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)