Merge lp:~therp-nl/therp-addons/7.0-fetchmail_invoice_fix_context_lang into lp:~therp-nl/therp-addons/7.0

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 89
Proposed branch: lp:~therp-nl/therp-addons/7.0-fetchmail_invoice_fix_context_lang
Merge into: lp:~therp-nl/therp-addons/7.0
Diff against target: 14 lines (+2/-2)
1 file modified
fetchmail_invoice/model/fetchmail_invoice.py (+2/-2)
To merge this branch: bzr merge lp:~therp-nl/therp-addons/7.0-fetchmail_invoice_fix_context_lang
Reviewer Review Type Date Requested Status
Ronald Portier (Therp) Approve
Holger Brunn (Therp) code review Approve
Review via email: mp+184325@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Stefan,

The code looks good to me. I just wonder: why bother about setting the language at all?

As far as I can see, it does not effect the creation of the invoice. And when printing, the language of the partner is (or should be) used.

Or am I missing something?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

The reason is a couple of lines below, where I craft an easily recognizable name for each invoice:

_("Received by email from %s") % email_from

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Tested and it works.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'fetchmail_invoice/model/fetchmail_invoice.py'
2--- fetchmail_invoice/model/fetchmail_invoice.py 2013-08-23 06:53:00 +0000
3+++ fetchmail_invoice/model/fetchmail_invoice.py 2013-09-06 14:57:34 +0000
4@@ -42,8 +42,8 @@
5 # As the scheduler is run without language,
6 # set the administrator's language
7 if not context.get('lang'):
8- context['lang'] = users_pool.read(
9- cr, uid, uid, ['context_lang'])['context_lang']
10+ user = users_pool.browse(cr, uid, uid, context=context)
11+ context['lang'] = user.partner_id.lang
12
13 if custom_values is None:
14 custom_values = {}

Subscribers

People subscribed via source and target branches

to all changes: