Merge lp:~vauxoo/addons-vauxoo/7.0_pylint_warnings-dev-amurillo into lp:addons-vauxoo/7.0

Proposed by Alejandro Ramirez Murillo
Status: Merged
Merged at revision: 1157
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0_pylint_warnings-dev-amurillo
Merge into: lp:addons-vauxoo/7.0
Diff against target: 390 lines (+80/-73)
6 files modified
account_advance_payment/model/res_partner.py (+2/-2)
account_aged_partner_balance_vw/model/account_aged_partner_balance_vw.py (+60/-54)
account_aged_partner_balance_vw/wizard/wizard_open_move_line.py (+7/-5)
invoice_datetime/invoice.py (+1/-2)
invoice_report_per_journal/wizard/invoice_report_per_journal.py (+3/-3)
stock_picking_cancel/stock.py (+7/-7)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0_pylint_warnings-dev-amurillo
Reviewer Review Type Date Requested Status
Sabrina Romero - http://www.vauxoo.com Pending
Alejandro Ramirez Murillo Pending
Review via email: mp+240291@code.launchpad.net
To post a comment you must log in.
1159. By Alejandro Ramirez Murillo

[FIX][account_aged_partner_balance_vw] Fix warnings pylint about attribute defined outside init

1160. By Alejandro Ramirez Murillo

[FIX][account_aged_partner_balance_vw] Fix warning pylint caused by code line: import wizard

1161. By Alejandro Ramirez Murillo

[FIX][invoice_datetime][stock_picking_cancel]. Fix warning pylint caused by exception BaseException, add linecode pass

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_advance_payment/model/res_partner.py'
2--- account_advance_payment/model/res_partner.py 2014-10-03 07:19:35 +0000
3+++ account_advance_payment/model/res_partner.py 2014-11-05 16:44:14 +0000
4@@ -31,8 +31,8 @@
5
6 def _supplier_customer_advance_get(self, cr, uid, ids, field, arg, context=None):
7 res = {}
8- for id in ids:
9- res = {id: {'customer_advance': 0.0, 'supplier_advance': 0.0}}
10+ for record_id in ids:
11+ res = {record_id: {'customer_advance': 0.0, 'supplier_advance': 0.0}}
12 return res
13
14 _columns = {
15
16=== modified file 'account_aged_partner_balance_vw/model/account_aged_partner_balance_vw.py'
17--- account_aged_partner_balance_vw/model/account_aged_partner_balance_vw.py 2014-10-03 07:19:35 +0000
18+++ account_aged_partner_balance_vw/model/account_aged_partner_balance_vw.py 2014-11-05 16:44:14 +0000
19@@ -78,6 +78,14 @@
20 class account_aged_trial_balance(osv.TransientModel):
21 _inherit = 'account.aged.trial.balance'
22
23+ account_type = None
24+ date_from = None
25+ total_account = None
26+ query = None
27+ target = None
28+ direction_selection = None
29+ target_move =None
30+
31 _columns = {
32 'partner_doc_ids': fields.one2many('account.aged.partner.document',
33 'aatb_id', 'Partner Aged Trail Balance',
34@@ -143,11 +151,11 @@
35 self.set_context(cr, uid, ids, data, context=context)
36 if wzd_brw.type in ('variation', 'distributed'):
37 res = self._get_lines(cr, uid, ids, form, context=context)
38- res = map(lambda x: (0, 0, x), res)
39+ res = [(0, 0, x) for x in res]
40 wzd_brw.write({'partner_line_ids': res})
41 elif wzd_brw.type == 'by_document':
42 res = self._get_doc_lines(cr, uid, ids, form, context=context)
43- res = map(lambda x: (0, 0, x), res)
44+ res = [(0, 0, x) for x in res]
45 wzd_brw.write({'partner_doc_ids': res})
46 return {}
47
48@@ -164,16 +172,15 @@
49 self.date_from = data['form'].get(
50 'date_from',
51 time.strftime('%Y-%m-%d'))
52- if (data['form']['result_selection'] == 'customer'):
53- self.ACCOUNT_TYPE = ['receivable']
54- elif (data['form']['result_selection'] == 'supplier'):
55- self.ACCOUNT_TYPE = ['payable']
56+ if data['form']['result_selection'] == 'customer':
57+ self.account_type = ['receivable']
58+ elif data['form']['result_selection'] == 'supplier':
59+ self.account_type = ['payable']
60 else:
61- self.ACCOUNT_TYPE = ['payable', 'receivable']
62+ self.account_type = ['payable', 'receivable']
63
64 def _get_partners(self, cr, uid, ids, form, context=None):
65 context = context or {}
66- wzd_brw = self.browse(cr, uid, ids[0], context=context)
67 move_state = ['draft', 'posted']
68 if self.target_move == 'posted':
69 move_state = ['posted']
70@@ -190,7 +197,7 @@
71 AND (l.partner_id=res_partner.id)\
72 AND (l.date <= %s)\
73 AND ' + self.query + ' \
74- ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
75+ ORDER BY res_partner.name', (tuple(move_state), tuple(self.account_type), self.date_from, self.date_from,))
76 return cr.dictfetchall()
77
78 def _get_lines(self, cr, uid, ids, form, context=None):
79@@ -237,9 +244,9 @@
80 AND ' + self.query + '\
81 AND account_account.active\
82 AND (l.date <= %s)\
83- GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,))
84- t = cr.fetchall()
85- for i in t:
86+ GROUP BY l.partner_id ', (tuple(move_state), tuple(self.account_type), tuple(partner_ids), self.date_from, self.date_from,))
87+ t_var = cr.fetchall()
88+ for i in t_var:
89 totals[i[0]] = i[1]
90 if wzd_brw.type == 'distributed':
91 if wzd_brw.result_selection in ('customer', 'supplier'):
92@@ -260,9 +267,9 @@
93 AND ' + self.query + '\
94 AND account_account.active\
95 AND (l.date <= %s)\
96- GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
97- t = cr.fetchall()
98- for i in t:
99+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.account_type), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
100+ t_var = cr.fetchall()
101+ for i in t_var:
102 future_past[i[0]] = i[1]
103 # Using elif so people could extend without this breaking
104 elif self.direction_selection == 'past':
105@@ -279,18 +286,18 @@
106 AND ' + self.query + '\
107 AND account_account.active\
108 AND (l.date <= %s)\
109- GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
110- t = cr.fetchall()
111+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.account_type), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
112+ t_var = cr.fetchall()
113 if wzd_brw.type == 'distributed':
114 if wzd_brw.result_selection in ('customer', 'supplier'):
115- for i in t:
116+ for i in t_var:
117 future_past[i[0]] = wzd_brw.result_selection == 'customer' \
118 and i[2] or -(i[2])
119 else:
120- for i in t:
121+ for i in t_var:
122 future_past[i[0]] = i[1]
123 else:
124- for i in t:
125+ for i in t_var:
126 future_past[i[0]] = i[1]
127
128 # Use one query per period and store results in history (a list variable)
129@@ -300,7 +307,7 @@
130 for i in range(5):
131 args_list = (
132 tuple(move_state),
133- tuple(self.ACCOUNT_TYPE),
134+ tuple(self.account_type),
135 tuple(partner_ids),
136 self.date_from,
137 )
138@@ -329,29 +336,29 @@
139 AND ''' + dates_query + '''
140 AND (l.date <= %s)
141 GROUP BY l.partner_id''', args_list)
142- t = cr.fetchall()
143- d = {}
144+ t_var = cr.fetchall()
145+ d_var = {}
146 if wzd_brw.type == 'distributed':
147 if wzd_brw.result_selection in ('customer', 'supplier'):
148- for i in t:
149+ for i in t_var:
150 if advances[i[0]] >= i[2]:
151- d[i[0]] = 0.0
152+ d_var[i[0]] = 0.0
153 advances[i[0]] -= i[2]
154 elif advances[i[0]] < i[2] and advances[i[0]]:
155- d[i[0]] = wzd_brw.result_selection == 'customer' \
156+ d_var[i[0]] = wzd_brw.result_selection == 'customer' \
157 and i[2] - advances[i[0]] or \
158 -(i[2] - advances[i[0]])
159 advances[i[0]] = 0.0
160 else:
161- d[i[0]] = wzd_brw.result_selection == 'customer' \
162+ d_var[i[0]] = wzd_brw.result_selection == 'customer' \
163 and i[2] or -(i[2])
164 else:
165- for i in t:
166- d[i[0]] = i[1]
167+ for i in t_var:
168+ d_var[i[0]] = i[1]
169 else:
170- for i in t:
171- d[i[0]] = i[1]
172- history.append(d)
173+ for i in t_var:
174+ d_var[i[0]] = i[1]
175+ history.append(d_var)
176
177 for partner in partners:
178 values = {}
179@@ -420,11 +427,11 @@
180
181 total = 0.0
182 totals = {}
183- for r in res:
184- total += float(r['total'] or 0.0)
185+ for r_var in res:
186+ total += float(r_var['total'] or 0.0)
187 for i in range(5) + ['direction']:
188 totals.setdefault(str(i), 0.0)
189- totals[str(i)] += float(r[str(i)] or 0.0)
190+ totals[str(i)] += float(r_var[str(i)] or 0.0)
191 mapping = {
192 'direction': 'not_due',
193 '4': 'days_due_01to30',
194@@ -434,17 +441,16 @@
195 '0': 'days_due_121togr',
196 }
197 res2 = []
198- for r in res:
199- for j, k in mapping.iteritems():
200- r[k] = r.pop(j)
201- r.pop('name')
202- res2.append(r)
203+ for r_var in res:
204+ for v, k in mapping.iteritems():
205+ r_var[k] = r_var.pop(v)
206+ r_var.pop('name')
207+ res2.append(r_var)
208 return res2
209
210 def _get_doc_lines(self, cr, uid, ids, form, context=None):
211 context = context or {}
212 res = []
213- wzd_brw = self.browse(cr, uid, ids[0], context=context)
214 partners = self._get_partners(cr, uid, ids, form, context=context)
215 partner_ids = [x['id'] for x in partners]
216 if not partner_ids:
217@@ -461,20 +467,20 @@
218 res2 = []
219 if not res:
220 return []
221- for r in res:
222- if form['0']['stop'] >= r['date_due']:
223- r['days_due_121togr'] = r['residual']
224- elif form['1']['start'] <= r['date_due'] and form['1']['stop'] >= r['date_due']:
225- r['days_due_91to120'] = r['residual']
226- elif form['2']['start'] <= r['date_due'] and form['2']['stop'] >= r['date_due']:
227- r['days_due_61to90'] = r['residual']
228- elif form['3']['start'] <= r['date_due'] and form['3']['stop'] >= r['date_due']:
229- r['days_due_31to60'] = r['residual']
230- elif form['4']['start'] <= r['date_due'] and form['4']['stop'] >= r['date_due']:
231- r['days_due_01to30'] = r['residual']
232+ for r_var in res:
233+ if form['0']['stop'] >= r_var['date_due']:
234+ r_var['days_due_121togr'] = r_var['residual']
235+ elif form['1']['start'] <= r_var['date_due'] and form['1']['stop'] >= r_var['date_due']:
236+ r_var['days_due_91to120'] = r_var['residual']
237+ elif form['2']['start'] <= r_var['date_due'] and form['2']['stop'] >= r_var['date_due']:
238+ r_var['days_due_61to90'] = r_var['residual']
239+ elif form['3']['start'] <= r_var['date_due'] and form['3']['stop'] >= r_var['date_due']:
240+ r_var['days_due_31to60'] = r_var['residual']
241+ elif form['4']['start'] <= r_var['date_due'] and form['4']['stop'] >= r_var['date_due']:
242+ r_var['days_due_01to30'] = r_var['residual']
243 else:
244- r['not_due'] = r['residual']
245- res2.append(r)
246+ r_var['not_due'] = r_var['residual']
247+ res2.append(r_var)
248 return res2
249
250 def _get_invoice_by_partner(self, cr, uid, ids, rp_ids, context=None):
251
252=== modified file 'account_aged_partner_balance_vw/wizard/wizard_open_move_line.py'
253--- account_aged_partner_balance_vw/wizard/wizard_open_move_line.py 2014-10-03 07:19:35 +0000
254+++ account_aged_partner_balance_vw/wizard/wizard_open_move_line.py 2014-11-05 16:44:14 +0000
255@@ -24,13 +24,13 @@
256 #
257 ##############################################################################
258
259+'''
260 import pooler
261-import wizard
262-
263+from . import wizard
264
265 class wizard_open_move_line(wizard.interface):
266
267- def _open_window(self, cr, uid, data, context={}):
268+ def _open_window(self, cr, uid, data, context=None):
269 if not context:
270 context = {}
271 mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
272@@ -42,8 +42,8 @@
273 # result = mod_obj._get_id(cr, uid, 'account',
274 # 'action_account_moves_all_a')
275 result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_select')
276- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
277- result = act_obj.read(cr, uid, [id])[0]
278+ ids = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
279+ result = act_obj.read(cr, uid, [ids])[0]
280 # result['context'] = {'partner_id': partner_ids}
281 # result['domain'] = [('partner_id','in',partner_ids),
282 # ('account_id.type','=','receivable')]
283@@ -93,4 +93,6 @@
284 }
285 }
286 wizard_open_move_line('wizard.open.move.line')
287+'''
288 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
289+
290
291=== modified file 'invoice_datetime/invoice.py'
292--- invoice_datetime/invoice.py 2014-10-03 07:19:35 +0000
293+++ invoice_datetime/invoice.py 2014-11-05 16:44:14 +0000
294@@ -32,7 +32,6 @@
295 import datetime
296 from pytz import timezone
297 import pytz
298-
299 import time
300
301
302@@ -46,7 +45,7 @@
303 try:
304 date_ref = time.strftime('%Y-%m-%d', time.strptime(
305 date_ref, '%Y-%m-%d %H:%M:%S'))
306- except Exception, e:
307+ except BaseException:
308 pass
309 return super(account_payment_term, self).compute(cr, uid, ids, value,
310 date_ref, context=context)
311
312=== modified file 'invoice_report_per_journal/wizard/invoice_report_per_journal.py'
313--- invoice_report_per_journal/wizard/invoice_report_per_journal.py 2014-10-03 07:19:35 +0000
314+++ invoice_report_per_journal/wizard/invoice_report_per_journal.py 2014-11-05 16:44:14 +0000
315@@ -112,7 +112,7 @@
316 try:
317 (result, _) = self._prepare_service(cr, uid, report,
318 context=context)
319- except Exception:
320+ except BaseException, e:
321 if report:
322 _logger.warning("Error occurred in the report, the "
323 "report set to the journal will be "
324@@ -137,7 +137,7 @@
325 wiz_id = wiz_obj.create(cr, uid, {}, context=ctx_cpy)
326 wiz_brw = wiz_obj.browse(cr, uid, wiz_id, context=context)
327 result = base64.decodestring(wiz_brw.fname_txt)
328- except Exception:
329+ except BaseException:
330 if report:
331 _logger.info(
332 "txt report not defined for the report assigned to "
333@@ -164,7 +164,7 @@
334 try:
335 (_, _) = self._prepare_service(
336 cr, uid, report, context=context)
337- except Exception:
338+ except BaseException:
339 if report:
340 _logger.warning(
341 "Error occurred in the report, the report set to the "
342
343=== modified file 'stock_picking_cancel/stock.py'
344--- stock_picking_cancel/stock.py 2014-10-03 07:19:35 +0000
345+++ stock_picking_cancel/stock.py 2014-11-05 16:44:14 +0000
346@@ -43,9 +43,9 @@
347 # Deleting the existing instance of workflow for PO
348 wf_service.trg_delete(uid, 'stock.picking', p_id, cr)
349 wf_service.trg_create(uid, 'stock.picking', p_id, cr)
350- for (id, name) in self.name_get(cr, uid, ids):
351+ for (ids, name) in self.name_get(cr, uid, ids):
352 message = _("Picking '%s' has been set in draft state.") % name
353- self.log(cr, uid, id, message)
354+ self.log(cr, uid, ids, message)
355 return True
356
357
358@@ -64,9 +64,9 @@
359 # Deleting the existing instance of workflow for PO
360 wf_service.trg_delete(uid, 'stock.picking', p_id, cr)
361 wf_service.trg_create(uid, 'stock.picking', p_id, cr)
362- for (id, name) in self.name_get(cr, uid, ids):
363+ for (ids, name) in self.name_get(cr, uid, ids):
364 message = _("Picking '%s' has been set in draft state.") % name
365- self.log(cr, uid, id, message)
366+ self.log(cr, uid, ids, message)
367 return True
368
369
370@@ -85,9 +85,9 @@
371 # Deleting the existing instance of workflow for PO
372 wf_service.trg_delete(uid, 'stock.picking', p_id, cr)
373 wf_service.trg_create(uid, 'stock.picking', p_id, cr)
374- for (id, name) in self.name_get(cr, uid, ids):
375+ for (ids, name) in self.name_get(cr, uid, ids):
376 message = _("Picking '%s' has been set in draft state.") % name
377- self.log(cr, uid, id, message)
378+ self.log(cr, uid, ids, message)
379 return True
380
381
382@@ -111,7 +111,7 @@
383 if len(account_production.line_id) == 0:
384 try:
385 account_move.button_cancel(cr, uid, [lin[0]], context=context)
386- except:
387+ except BaseException:
388 pass
389 account_move.unlink(cr, uid, [lin[0]])
390 return super(stock_move, self).action_cancel(cr, uid, ids, context=context)