[FIX] mail: Work order translation

The action_confirm function losses the context when called by a workflow.
To have the right translation, the lang of the user must be written in the context.

opw:632873
This commit is contained in:
Goffin Simon 2015-04-20 08:39:07 +02:00
parent 0422df2ad7
commit 1aed46d2a8
1 changed files with 3 additions and 1 deletions

View File

@ -724,7 +724,7 @@ class mrp_production(osv.osv):
#reset workcenter_lines in production order
for line in results2:
line['production_id'] = production.id
workcenter_line_obj.create(cr, uid, line)
workcenter_line_obj.create(cr, uid, line, context)
return results
def action_compute(self, cr, uid, ids, properties=None, context=None):
@ -1221,6 +1221,8 @@ class mrp_production(osv.osv):
""" Confirms production order.
@return: Newly generated Shipment Id.
"""
user_lang = self.pool.get('res.users').browse(cr, uid, [uid]).partner_id.lang
context = dict(context, lang=user_lang)
uncompute_ids = filter(lambda x: x, [not x.product_lines and x.id or False for x in self.browse(cr, uid, ids, context=context)])
self.action_compute(cr, uid, uncompute_ids, context=context)
for production in self.browse(cr, uid, ids, context=context):