[Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-23 Thread Katja Matthes
Katja Matthes has proposed merging 
lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into 
lp:account-invoice-report.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109

Steps to reproduce:
1) In invoice tree view klick 'Create' to open draft formular for a new invoice
2) Choose for partner_id a partner with an other language than English
3) Set text_condition{1,2}

Result
English version of condition text is set to note{1,2}.

Expected Result:
Use language of set partner while setting note{1,2}.

Solution:
Add partner_id as parameter to on_change function for text_condition{1,2}
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.
=== modified file 'invoice_webkit/invoice.py'
--- invoice_webkit/invoice.py	2013-02-01 08:46:04 +
+++ invoice_webkit/invoice.py	2014-06-23 11:29:29 +
@@ -18,6 +18,8 @@
 #along with this program.  If not, see .
 ##
 from openerp.osv.orm import Model, fields
+from openerp.osv import osv
+from openerp.tools.translate import _
 
 
 class InvoiceConditionText(Model):
@@ -38,22 +40,21 @@
 
 _inherit = "account.invoice"
 
-def _set_condition(self, cr, uid, inv_id, commentid, key):
+def _set_condition(self, cr, uid, inv_id, commentid, key, partner_id=False):
 """Set the text of the notes in invoices"""
 if not commentid:
 return {}
-try :
-lang = self.browse(cr, uid, inv_id)[0].partner_id.lang
-except :
-lang = 'en_US'
+if not partner_id:
+raise osv.except_osv(_('No Customer Defined !'), _('Before choosing condition text select a customer.'))
+lang = self.pool.get('res.partner').browse(cr, uid, partner_id).lang or 'en_US'
 cond = self.pool.get('account.condition_text').browse(cr, uid, commentid, {'lang': lang})
 return {'value': {key: cond.text}}
 
-def set_header(self, cr, uid, inv_id, commentid):
-return self._set_condition(cr, uid, inv_id, commentid, 'note1')
+def set_header(self, cursor, uid, inv_id, commentid, partner_id=False):
+return self._set_condition(cursor, uid, inv_id, commentid, 'note1', partner_id)
 
-def set_footer(self, cr, uid, inv_id, commentid):
-return self._set_condition(cr, uid, inv_id, commentid, 'note2')
+def set_footer(self, cursor, uid, inv_id, commentid, partner_id=False):
+return self._set_condition(cursor, uid, inv_id, commentid, 'note2', partner_id)
 
 _columns = {'text_condition1': fields.many2one('account.condition_text', 'Header condition',
domain=[('type', '=', 'header')]),

=== modified file 'invoice_webkit/view/invoice_view.xml'
--- invoice_webkit/view/invoice_view.xml	2013-03-04 06:52:00 +
+++ invoice_webkit/view/invoice_view.xml	2014-06-23 11:29:29 +
@@ -53,9 +53,9 @@
   
 
 
+   on_change="set_header(text_condition1, partner_id)" colspan="2"/>
 
+   on_change="set_footer(text_condition2, partner_id)" colspan="2"/>
 
 
 

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


[Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-30 Thread Yannick Vaucher @ Camptocamp
The proposal to merge 
lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into 
lp:account-invoice-report has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


[Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-30 Thread noreply
The proposal to merge 
lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into 
lp:account-invoice-report has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-23 Thread Pedro Manuel Baeza
Review: Needs Fixing code review

Hi, Katja,

You're right that current code doesn't work, but this is because the line that 
made the work is incorrect:

try :
lang = self.browse(cr, uid, inv_id).partner_id.lang

inv_id is an id, not a list of ids, so you don't need to put index 0 to access 
browse_record.

I think it's better to simply fix this instead of changing all the code you put.

Regards.
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-23 Thread Katja Matthes
Hi Pedro,

thanks for reviewing.

Well I debug this and actually inv_id is a list. It would be better to rename 
it to inv_ids. I can add this, if it's wished.

I think you don't understand the issue in detail. The problem occure, when 
creating an invoice. At this point there's no invoice id, cause the object 
isn't stored yet. To get the customer's language at this point the only 
solution I see is to modify the on_change method like the way I did.

If I'm missing something fundamental, please let me know.

Greetings,
Katja
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-24 Thread Markus Schneider
Review: Approve review & testing

solve the problem with multi language installation
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-30 Thread Yannick Vaucher @ Camptocamp
Review: Approve code review, no test

LGTM
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp


Re: [Openerp-community-reviewer] [Merge] lp:~initos.com/account-invoice-report/7.0-fix_lang_for_draft into lp:account-invoice-report

2014-06-30 Thread Yannick Vaucher @ Camptocamp
Thanks for the fix.
-- 
https://code.launchpad.net/~initos.com/account-invoice-report/7.0-fix_lang_for_draft/+merge/224109
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch 
lp:account-invoice-report.

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp