Merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-pylint-dev-julio into lp:addons-vauxoo/7.0

Proposed by Julio Serna-http://www.vauxoo.com
Status: Merged
Merged at revision: 1159
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-pylint-dev-julio
Merge into: lp:addons-vauxoo/7.0
Diff against target: 440 lines (+83/-80)
9 files modified
account_invoice_tax/account_invoice_tax.py (+5/-5)
account_move_line_base_tax/account.py (+15/-15)
account_voucher_tax/account_voucher.py (+19/-15)
account_voucher_tax/invoice.py (+2/-2)
email_template_att_dinamic/model/email_template.py (+2/-1)
hr_expense_analytic/hr_expense_analytic.py (+3/-1)
hr_expense_replenishment/model/account_invoice.py (+2/-2)
hr_expense_replenishment/model/hr_expense.py (+25/-33)
hr_expense_replenishment_tax/model/hr_expense.py (+10/-6)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-addons-vauxoo-pylint-dev-julio
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Review via email: mp+241630@code.launchpad.net

Description of the change

Resolved errors of pylint

To post a comment you must log in.
1159. By Julio Serna-http://www.vauxoo.com

[IMP][pylint] applied pylint

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_tax/account_invoice_tax.py'
2--- account_invoice_tax/account_invoice_tax.py 2014-10-03 07:19:35 +0000
3+++ account_invoice_tax/account_invoice_tax.py 2014-11-13 00:58:25 +0000
4@@ -113,9 +113,9 @@
5 tax_grouped[key]['base_amount'] += val['base_amount']
6 tax_grouped[key]['tax_amount'] += val['tax_amount']
7
8- for t in tax_grouped.values():
9- t['base'] = cur_obj.round(cr, uid, cur, t['base'])
10- t['amount'] = cur_obj.round(cr, uid, cur, t['amount'])
11- t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount'])
12- t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
13+ for dat_tax in tax_grouped.values():
14+ dat_tax['base'] = cur_obj.round(cr, uid, cur, dat_tax['base'])
15+ dat_tax['amount'] = cur_obj.round(cr, uid, cur, dat_tax['amount'])
16+ dat_tax['base_amount'] = cur_obj.round(cr, uid, cur, dat_tax['base_amount'])
17+ dat_tax['tax_amount'] = cur_obj.round(cr, uid, cur, dat_tax['tax_amount'])
18 return tax_grouped
19
20=== modified file 'account_move_line_base_tax/account.py'
21--- account_move_line_base_tax/account.py 2014-10-03 07:19:35 +0000
22+++ account_move_line_base_tax/account.py 2014-11-13 00:58:25 +0000
23@@ -90,21 +90,21 @@
24 super(account_invoice_tax, self).move_line_get(cr, uid, invoice_id)
25 tax_invoice_ids = self.search(cr, uid, [
26 ('invoice_id', '=', invoice_id)], context=context)
27- for t in self.browse(cr, uid, tax_invoice_ids, context=context):
28- if not t.amount and not t.tax_code_id and not t.tax_amount:
29+ for inv_t in self.browse(cr, uid, tax_invoice_ids, context=context):
30+ if not inv_t.amount and not inv_t.tax_code_id and not inv_t.tax_amount:
31 continue
32 res.append({
33 'type': 'tax',
34- 'name': t.name,
35- 'price_unit': t.amount,
36+ 'name': inv_t.name,
37+ 'price_unit': inv_t.amount,
38 'quantity': 1,
39- 'price': t.amount or 0.0,
40- 'account_id': t.account_id.id or False,
41- 'tax_code_id': t.tax_code_id.id or False,
42- 'tax_amount': t.tax_amount or False,
43- 'account_analytic_id': t.account_analytic_id.id or False,
44- 'amount_base': t.base_amount or 0.0,
45- 'tax_id_secondary': t.tax_id.id or False,
46+ 'price': inv_t.amount or 0.0,
47+ 'account_id': inv_t.account_id.id or False,
48+ 'tax_code_id': inv_t.tax_code_id.id or False,
49+ 'tax_amount': inv_t.tax_amount or False,
50+ 'account_analytic_id': inv_t.account_analytic_id.id or False,
51+ 'amount_base': inv_t.base_amount or 0.0,
52+ 'tax_id_secondary': inv_t.tax_id.id or False,
53 })
54 return res
55
56@@ -112,11 +112,11 @@
57 class account_invoice(osv.Model):
58 _inherit = 'account.invoice'
59
60- def line_get_convert(self, cr, uid, x, part, date, context=None):
61- res = super(account_invoice, self).line_get_convert(cr, uid, x, part,
62+ def line_get_convert(self, cr, uid, value, part, date, context=None):
63+ res = super(account_invoice, self).line_get_convert(cr, uid, value, part,
64 date, context=context)
65 res.update({
66- 'amount_base': x.get('amount_base', False),
67- 'tax_id_secondary': x.get('tax_id_secondary', False),
68+ 'amount_base': value.get('amount_base', False),
69+ 'tax_id_secondary': value.get('tax_id_secondary', False),
70 })
71 return res
72
73=== modified file 'account_voucher_tax/account_voucher.py'
74--- account_voucher_tax/account_voucher.py 2014-10-03 07:19:35 +0000
75+++ account_voucher_tax/account_voucher.py 2014-11-13 00:58:25 +0000
76@@ -182,17 +182,21 @@
77 credit_line_vals.update({'debit': credit_line_vals.get('credit', 0.0), 'credit': 0.0})
78
79 if type in ('payment', 'purchase'):
80- reference_amount < 0 and\
81- [credit_line_vals.pop('analytic_account_id'),
82- credit_line_vals.update({'amount_base': abs(amount_base),
83- 'tax_id_secondary': tax_secondary})] or\
84- [debit_line_vals.pop('analytic_account_id'),
85- debit_line_vals.update({'tax_id_secondary': tax_secondary,
86- 'amount_base': abs(amount_base)})]
87+ if reference_amount < 0:
88+ credit_line_vals.pop('analytic_account_id')
89+ credit_line_vals.update({
90+ 'amount_base': abs(amount_base),
91+ 'tax_id_secondary': tax_secondary})
92+ else:
93+ debit_line_vals.pop('analytic_account_id')
94+ debit_line_vals.update({
95+ 'tax_id_secondary': tax_secondary,
96+ 'amount_base': abs(amount_base)})
97 else:
98- reference_amount < 0 and\
99- [debit_line_vals.pop('analytic_account_id'),
100- debit_line_vals.pop('tax_id_secondary')] or\
101+ if reference_amount < 0:
102+ debit_line_vals.pop('analytic_account_id')
103+ debit_line_vals.pop('tax_id_secondary')
104+ else:
105 credit_line_vals.pop('analytic_account_id')
106
107 if not amount_tax_unround:
108@@ -233,7 +237,7 @@
109
110 def voucher_move_line_create(self, cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None):
111 res = super(account_voucher, self).voucher_move_line_create(cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None)
112- new = self.voucher_move_line_tax_create(cr, uid, voucher_id, move_id, context=context)
113+ self.voucher_move_line_tax_create(cr, uid, voucher_id, move_id, context=context)
114 #~ res[1] and res[1][0]+new
115 return res
116
117@@ -539,7 +543,7 @@
118 for res_diff_id in res_round.items():
119 diff_val = abs(res_without_round[res_diff_id[0]]) - abs(res_round[res_diff_id[0]])
120 diff_val = round(diff_val, 2)
121- if diff_val <> 0.00:
122+ if diff_val != 0.00:
123 move_diff_id = [res_ids[res_diff_id[0]]]
124 for move in self.browse(cr, uid, move_diff_id, context=context):
125 move_line_ids = self.search(cr, uid, [('move_id', '=', move.move_id.id), ('tax_id', '=', move.tax_id.id)])
126@@ -564,11 +568,11 @@
127 res = {}
128
129 for line_tax in self.browse(cr, uid, ids, context=context):
130- sum = 0.0
131+ tax_sum = 0.0
132 old_ids = self.search(cr, uid, [('move_line_id', '=', line_tax.move_line_id.id), ('id', '!=', line_tax.id)])
133 for lin_sum in self.browse(cr, uid, old_ids, context=context):
134- sum += lin_sum.amount_tax
135- res[line_tax.id] = line_tax.original_tax - sum
136+ tax_sum += lin_sum.amount_tax
137+ res[line_tax.id] = line_tax.original_tax - tax_sum
138 return res
139
140 def onchange_amount_tax(self, cr, uid, ids, amount, tax):
141
142=== modified file 'account_voucher_tax/invoice.py'
143--- account_voucher_tax/invoice.py 2014-10-03 07:19:35 +0000
144+++ account_voucher_tax/invoice.py 2014-11-13 00:58:25 +0000
145@@ -38,13 +38,13 @@
146 inv = self.browse(cr, uid, ids[0], context=context)
147 inv_ids = []
148 result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'action_voucher_list')
149- id = result and result[1] or False
150+ id_pay = result and result[1] or False
151 if inv.type == 'out_invoice' or inv.type == 'out_refund':
152 view_type = 'view_vendor_receipt_form'
153 else:
154 view_type = 'view_vendor_payment_form'
155 res = mod_obj.get_object_reference(cr, uid, 'account_voucher', view_type)
156- result = act_obj.read(cr, uid, [id], context=context)[0]
157+ result = act_obj.read(cr, uid, [id_pay], context=context)[0]
158 result['views'] = [(res and res[1] or False, 'form')]
159 result['context'] = {
160 'default_partner_id': self.pool.get('res.partner')._find_accounting_partner(inv.partner_id).id,
161
162=== modified file 'email_template_att_dinamic/model/email_template.py'
163--- email_template_att_dinamic/model/email_template.py 2014-10-03 07:19:35 +0000
164+++ email_template_att_dinamic/model/email_template.py 2014-11-13 00:58:25 +0000
165@@ -23,6 +23,7 @@
166
167
168 from openerp.osv import osv, fields
169+import ast
170
171
172 class email_template(osv.Model):
173@@ -62,7 +63,7 @@
174 if template and template.att_other_field:
175 att_field_render = template_obj.render_template(cr, uid,
176 template.att_other_field, template.model, res_id, context=context)
177- attach += [id_att for id_att in eval("[" + att_field_render + "]") if att_field_render]
178+ attach += [id_att for id_att in ast.literal_eval("[" + att_field_render + "]") if att_field_render]
179
180 attach += res.get('value', {}).pop('attachment_ids', [])
181 res.get('value', {}).update({'attachment_ids': [(6, 0, attach)]})
182
183=== modified file 'hr_expense_analytic/hr_expense_analytic.py'
184--- hr_expense_analytic/hr_expense_analytic.py 2014-05-09 21:51:34 +0000
185+++ hr_expense_analytic/hr_expense_analytic.py 2014-11-13 00:58:25 +0000
186@@ -38,7 +38,9 @@
187 class hr_expense_line(osv.Model):
188 _inherit = "hr.expense.line"
189
190- def _get_analytic(self, cr, uid, context={}):
191+ def _get_analytic(self, cr, uid, context=None):
192+ if context is None:
193+ context = {}
194 if context['depto']:
195 depto = self.pool.get('hr.department').browse(
196 cr, uid, [context['depto']])[0]
197
198=== modified file 'hr_expense_replenishment/model/account_invoice.py'
199--- hr_expense_replenishment/model/account_invoice.py 2014-10-03 07:19:35 +0000
200+++ hr_expense_replenishment/model/account_invoice.py 2014-11-13 00:58:25 +0000
201@@ -58,12 +58,12 @@
202 exp_obj.write(cr, uid, exp_id, {'line_ids': data}, context=context)
203 return True
204
205- def copy(self, cr, uid, id, default=None, context=None):
206+ def copy(self, cr, uid, ids, default=None, context=None):
207 if default is None:
208 default = {}
209 default = default.copy()
210 default.update({'expense_id': False})
211- return super(account_invoice, self).copy(cr, uid, id, default, context=context)
212+ return super(account_invoice, self).copy(cr, uid, ids, default, context=context)
213
214
215 class account_invoice_line(osv.Model):
216
217=== modified file 'hr_expense_replenishment/model/hr_expense.py'
218--- hr_expense_replenishment/model/hr_expense.py 2014-10-03 07:19:35 +0000
219+++ hr_expense_replenishment/model/hr_expense.py 2014-11-13 00:58:25 +0000
220@@ -61,8 +61,6 @@
221 cur_obj = self.pool.get('res.currency')
222 res = super(hr_expense_expense, self)._amount(
223 cr, uid, ids, field_name, arg, context=context)
224- acc_payable_ids = self.pool.get('account.account').search(
225- cr, uid, [('type', '=', 'payable')], context=context)
226 for expense in self.browse(cr, uid, res.keys(), context=context):
227 for invoice in expense.invoice_ids:
228 if expense.state in ('draft', 'confirm', 'accepted', 'cancelled'):
229@@ -180,7 +178,7 @@
230 'Status', readonly=True, track_visibility='onchange',
231 help=_('When the expense request is created the status is '
232 '\'Draft\'.\n It is confirmed by the user and request is sent to '
233- 'admin, the status is \'Waiting Confirmation\'.\ \nIf the admin '
234+ 'admin, the status is \'Waiting Confirmation\'. \nIf the admin '
235 'accepts it, the status is \'Accepted\'.\n If the accounting '
236 'entries are made for the expense request, the status is '
237 '\'Waiting Payment\'.')),
238@@ -250,7 +248,7 @@
239 inv_brws = self.browse(cr, uid, ids[0], context=context).invoice_ids
240 res = [True]
241 if inv_brws:
242- res += map(lambda x: x.state == 'open' and True or False, inv_brws)
243+ res += [inv.state == 'open' and True or False for inv in inv_brws]
244 res = all(res)
245 if not res:
246 raise osv.except_osv(
247@@ -300,7 +298,7 @@
248 cr.execute(('SELECT aml_id FROM expense_advance_rel '
249 'WHERE expense_id != %s'), (exp.id,))
250 already_use_aml = cr.fetchall()
251- already_use_aml = map(lambda x: x[0], already_use_aml)
252+ already_use_aml = [dat[0] for dat in already_use_aml]
253 aml_ids = list(set(aml_ids) - set(already_use_aml))
254 vals['advance_ids'] = \
255 [(6, 0, aml_ids)]
256@@ -352,10 +350,6 @@
257 [brw.id
258 for brw in exp.account_move_id.line_id
259 if brw.credit > 0.0]
260- if not exp_credit:
261- [brw.id for brw in exp.account_move_id.line_id]
262- # Really!!!
263- #aml_obj.unlink(cr, uid, empty_aml_ids, context=context)
264
265 #~ manage the expense move lines
266 exp_aml_brws = exp.account_move_id and \
267@@ -445,7 +439,7 @@
268 try:
269 aml_obj.reconcile(
270 cr, uid, line_pair, 'manual', context=context)
271- except:
272+ except BaseException:
273 new_line_pair = self.invoice_counter_move_lines(cr, uid, exp.id,
274 am_id=exp.account_move_id.id, aml_ids=line_pair,
275 context=context)
276@@ -459,7 +453,7 @@
277 cr, uid, line_pair, 'manual', context=context)
278 return aml
279
280- def expense_reconcile_partial_deduction(self, cr, uid, ids, d, context=None):
281+ def expense_reconcile_partial_deduction(self, cr, uid, ids, aml, context=None):
282 """
283 This method make a distribution of the advances, whenever applies
284 paying fully those invoice that can be paid and leaving just a remaining
285@@ -471,23 +465,22 @@
286 ids = isinstance(ids, (int, long)) and [ids] or ids
287 exp = self.browse(cr, uid, ids[0], context=context)
288
289- adv_ids = d['advances']
290- exp_ids = d['exp']
291-
292- sum_adv = d['debit']
293- d['exp_sum']
294- sum_inv = d['inv_sum']
295-
296- ld = sum_adv - d['credit'] # Remaining Advance
297- ld and self.expense_debit_lines(cr, uid, exp.id, exp.account_move_id.id,
298- ld)
299- lc = sum_adv - d['credit'] + sum_inv
300+ adv_ids = aml['advances']
301+ exp_ids = aml['exp']
302+
303+ sum_adv = aml['debit']
304+ sum_inv = aml['inv_sum']
305+
306+ ld = sum_adv - aml['credit'] # Remaining Advance
307+ if ld:
308+ self.expense_debit_lines(cr, uid, exp.id, exp.account_move_id.id, ld)
309+ lc = sum_adv - aml['credit'] + sum_inv
310 lc = self.expense_credit_lines(cr, uid, exp.id, exp.account_move_id.id,
311 lc)
312
313 return adv_ids + exp_ids + [lc], []
314
315- def expense_reconcile_partial_payment(self, cr, uid, ids, d, context=None):
316+ def expense_reconcile_partial_payment(self, cr, uid, ids, aml, context=None):
317 """
318 This method make a distribution of the advances, whenever applies
319 paying fully those invoice that can be paid and leaving just a remaining
320@@ -499,12 +492,12 @@
321 ids = isinstance(ids, (int, long)) and [ids] or ids
322 exp = self.browse(cr, uid, ids[0], context=context)
323
324- adv_ids = d['advances']
325- exp_ids = d['exp']
326+ adv_ids = aml['advances']
327+ exp_ids = aml['exp']
328
329- sum_adv = d['debit']
330- sum_exp = d['exp_sum']
331- sum_inv = d['inv_sum']
332+ sum_adv = aml['debit']
333+ sum_exp = aml['exp_sum']
334+ sum_inv = aml['inv_sum']
335 partial_rec = []
336 full_rec = []
337
338@@ -960,19 +953,18 @@
339 self.write(cr, uid, exp.id, {'state': 'paid'}, context=context)
340 return True
341
342- def copy(self, cr, uid, id, default=None, context=None):
343+ def copy(self, cr, uid, ids, default=None, context=None):
344 if default is None:
345 default = {}
346 default = default.copy()
347 default.update({'advance_ids': [],
348 'invoice_ids': [],
349 'payment_ids': [],
350- 'advance_ids': [],
351 'ail_ids': [],
352 'ait_ids': [],
353 'date_post': False,
354 })
355- return super(hr_expense_expense, self).copy(cr, uid, id, default,
356+ return super(hr_expense_expense, self).copy(cr, uid, ids, default,
357 context=context)
358
359 def show_entries(self, cr, uid, ids, context=None):
360@@ -988,7 +980,7 @@
361 for move2 in inv.move_id.line_id]
362 return {
363 'domain': "[('id','in',\
364- [" + ','.join(map(str, res_exp + res_adv + res_pay + res_inv)) + "])]",
365+ [" + ','.join([str(dat) for dat in res_exp + res_adv + res_pay + res_inv]) + "])]",
366 'name': _('Entries'),
367 'view_type': 'form',
368 'view_mode': 'tree,form',
369@@ -1109,7 +1101,7 @@
370 class hr_expense_line(osv.Model):
371 _inherit = "hr.expense.line"
372
373- def _get_analytic(self, cr, uid, context={}):
374+ def _get_analytic(self, cr, uid, context=None):
375 context = context or {}
376 res = super(hr_expense_line, self)._get_analytic(cr, uid,
377 context=context)
378
379=== modified file 'hr_expense_replenishment_tax/model/hr_expense.py'
380--- hr_expense_replenishment_tax/model/hr_expense.py 2014-10-03 07:19:35 +0000
381+++ hr_expense_replenishment_tax/model/hr_expense.py 2014-11-13 00:58:25 +0000
382@@ -35,13 +35,13 @@
383 digits_compute=dp.get_precision('Account'))
384 }
385
386- def copy(self, cr, uid, id, default=None, context=None):
387+ def copy(self, cr, uid, ids, default=None, context=None):
388 if default is None:
389 default = {}
390 default = default.copy()
391 default.update({'fully_applied_vat': False,
392 })
393- return super(hr_expense_expense, self).copy(cr, uid, id, default,
394+ return super(hr_expense_expense, self).copy(cr, uid, ids, default,
395 context=context)
396
397 def payment_reconcile(self, cr, uid, ids, context=None):
398@@ -69,10 +69,12 @@
399 self.apply_round_tax(cr, uid, exp.id, context=context)
400 return True
401
402- def create_her_tax(self, cr, uid, ids, aml={}, context=None):
403+ def create_her_tax(self, cr, uid, ids, aml=None, context=None):
404 aml_obj = self.pool.get('account.move.line')
405 acc_voucher_obj = self.pool.get('account.voucher')
406 context = context or {}
407+ if aml is None:
408+ aml = {}
409 ids = isinstance(ids, (int, long)) and [ids] or ids
410 exp = self.browse(cr, uid, ids, context=context)[0]
411
412@@ -136,7 +138,7 @@
413 tax.base_amount, factor, context=context)
414
415 for move_line_tax in move_lines_tax:
416- move_create = aml_obj.create(cr, uid, move_line_tax,
417+ aml_obj.create(cr, uid, move_line_tax,
418 context=context)
419
420 self.write(cr, uid, ids,
421@@ -171,7 +173,9 @@
422 ])
423 return move_tax_ids
424
425- def unlink_move_tax(self, cr, uid, exp, context={}):
426+ def unlink_move_tax(self, cr, uid, exp, context=None):
427+ if context is None:
428+ context = {}
429 aml_obj = self.pool.get('account.move.line')
430 move_ids = self.move_tax_expense(cr, uid, exp, context=context)
431 aml_obj.unlink(cr, uid, move_ids)
432@@ -191,7 +195,7 @@
433 move_without_round += abs(move.amount_tax_unround)
434 move_diff = abs(move_without_round) - abs(move_round)
435 move_diff = round(move_diff, 2)
436- if move_diff <> 0.00:
437+ if move_diff != 0.00:
438 move_ids.sort()
439 for move_line in aml_obj.browse(cr, uid, move_ids[-2:],
440 context=context):