Merge lp:~openerp-dev/openobject-addons/6.1-opw-581503-rgo into lp:openobject-addons/6.1

Proposed by Ravi Gohil (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-581503-rgo
Merge into: lp:openobject-addons/6.1
Diff against target: 36 lines (+10/-2)
2 files modified
mrp/mrp.py (+5/-1)
stock/stock.py (+5/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-581503-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+132676@code.launchpad.net

Description of the change

Hello,

In web-client, log message shown when confirming `Sale Order` isn't considering date format set in user locale.

Steps to reproduce(After installing Sale Module):
1) Load another translation(Lets take French),
2) Create and confirm Sale Order,
3) You will mark `Scheduled Date` in log message in `%m/%d/%Y` format but it should be in `%d/%m/%Y`.

Same things happens when confirming production order, I have fixed this issue, kindly review the fix.

Thanks.

To post a comment you must log in.

Unmerged revisions

7054. By Ravi Gohil (OpenERP)

[FIX] stock: In web client, log message shown when confirming the Sale Order does not consider user locale date format: (Maintenance Case : 581503)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2012-10-05 10:44:47 +0000
+++ mrp/mrp.py 2012-11-02 10:58:58 +0000
@@ -1020,10 +1020,14 @@
1020 self._make_production_line_procurement(cr, uid, line, shipment_move_id, context=context)1020 self._make_production_line_procurement(cr, uid, line, shipment_move_id, context=context)
1021 1021
1022 wf_service.trg_validate(uid, 'stock.picking', shipment_id, 'button_confirm', cr)1022 wf_service.trg_validate(uid, 'stock.picking', shipment_id, 'button_confirm', cr)
1023 user_info = self.pool.get('res.users').context_get(cr, uid, context=context)
1024 lang_obj = self.pool.get('res.lang')
1025 date_format = lang_obj.browse(cr, uid, lang_obj.search(cr, uid, [('code', '=', user_info.get('lang'))], context=context), context=context)[0].date_format
1026 date_planned = tools.server_to_local_timestamp(production.date_planned, '%Y-%m-%d %H:%M:%S', date_format, user_info.get('tz'))
1023 production.write({'state':'confirmed'}, context=context)1027 production.write({'state':'confirmed'}, context=context)
1024 message = _("Manufacturing order '%s' is scheduled for the %s.") % (1028 message = _("Manufacturing order '%s' is scheduled for the %s.") % (
1025 production.name,1029 production.name,
1026 datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%m/%d/%Y'),1030 date_planned,
1027 )1031 )
1028 self.log(cr, uid, production.id, message)1032 self.log(cr, uid, production.id, message)
1029 return shipment_id1033 return shipment_id
10301034
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-10-05 07:47:57 +0000
+++ stock/stock.py 2012-11-02 10:58:58 +0000
@@ -1349,7 +1349,11 @@
1349 }1349 }
1350 message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or '?') + "' "1350 message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or '?') + "' "
1351 if pick.min_date:1351 if pick.min_date:
1352 msg= _(' for the ')+ datetime.strptime(pick.min_date, '%Y-%m-%d %H:%M:%S').strftime('%m/%d/%Y')1352 user_info = self.pool.get('res.users').context_get(cr, uid, context=context)
1353 lang_obj = self.pool.get('res.lang')
1354 date_format = lang_obj.browse(cr, uid, lang_obj.search(cr, uid, [('code', '=', user_info.get('lang'))], context=context), context=context)[0].date_format
1355 picking_date = tools.server_to_local_timestamp(pick.min_date, '%Y-%m-%d %H:%M:%S', date_format, user_info.get('tz'))
1356 msg= _(' for the ') + picking_date
1353 state_list = {1357 state_list = {
1354 'confirmed': _('is scheduled %s.') % msg,1358 'confirmed': _('is scheduled %s.') % msg,
1355 'assigned': _('is ready to process.'),1359 'assigned': _('is ready to process.'),