Merge lp:~vauxoo/addons-vauxoo/7.0-invoice-datetime-dev-sabrina into lp:addons-vauxoo/7.0

Proposed by Sabrina Romero - http://www.vauxoo.com
Status: Merged
Merged at revision: 1134
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-invoice-datetime-dev-sabrina
Merge into: lp:addons-vauxoo/7.0
Diff against target: 106 lines (+15/-15)
2 files modified
invoice_datetime/invoice.py (+13/-14)
invoice_datetime/res_config.py (+2/-1)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-invoice-datetime-dev-sabrina
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Sabrina Romero - http://www.vauxoo.com Pending
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Review via email: mp+235475@code.launchpad.net

Description of the change

Variable 'ids' not defined error fixed.

To post a comment you must log in.
1133. By Luis Ernesto García Medina - http://www.vauxoo.com

[REF][invoice_datetime] fix warnings of pylint test of variables names.

Revision history for this message
Sabrina Romero - http://www.vauxoo.com (sabrina) wrote :

Les dejo el diff de los errores arrojados por pylint:

diff --git a/before b/after
index 2e69268..297c382 100644
--- a/before
+++ b/after
@@ -1,17 +1,3 @@
-************* Module openerp.addons.invoice_datetime.res_config
-openerp.addons.invoice_datetime.res_config:43: [W0621(redefined-outer-name), account_config_settings.get_default_select_date] Redefining name 'fields' from outer scope (line 30)
-openerp.addons.invoice_datetime.res_config:51: [E0602(undefined-variable), account_config_settings.set_default_select_date] Undefined variable 'openerp'
-************* Module openerp.addons.invoice_datetime.invoice
-openerp.addons.invoice_datetime.invoice:45: [W0622(redefined-builtin), account_payment_term.compute] Redefining built-in 'id'
-openerp.addons.invoice_datetime.invoice:52: [W0702(bare-except), account_payment_term.compute] No exception type(s) specified
-openerp.addons.invoice_datetime.invoice:67: [W0612(unused-variable), account_invoice._get_date_invoice_tz] Unused variable 'dt_format'
-openerp.addons.invoice_datetime.invoice:113: [W0622(redefined-builtin), account_invoice.copy] Redefining built-in 'id'
-openerp.addons.invoice_datetime.invoice:126: [C0103(invalid-name), account_invoice._get_time_zone] Invalid variable name "a"
-openerp.addons.invoice_datetime.invoice:136: [C0103(invalid-name), account_invoice._get_time_zone] Invalid variable name "s"
-openerp.addons.invoice_datetime.invoice:137: [C0103(invalid-name), account_invoice._get_time_zone] Invalid variable name "s"
-openerp.addons.invoice_datetime.invoice:139: [C0103(invalid-name), account_invoice._get_time_zone] Invalid variable name "a"
-openerp.addons.invoice_datetime.invoice:175: [E0602(undefined-variable), account_invoice.assigned_datetime] Undefined variable 'ids'
-openerp.addons.invoice_datetime.invoice:181: [E0602(undefined-variable), account_invoice.assigned_datetime] Undefined variable 'ids'
 ************* Module openerp.addons.account_aged_partner_balance_vw.wizard.wizard_open_move_line
 openerp.addons.account_aged_partner_balance_vw.wizard.wizard_open_move_line:43: [W0622(redefined-builtin), wizard_open_move_line._open_window] Redefining built-in 'id'
 openerp.addons.account_aged_partner_balance_vw.wizard.wizard_open_move_line:31: [W0102(dangerous-default-value), wizard_open_move_line._open_window] Dangerous default value {} as argument

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 'invoice_datetime/invoice.py'
2--- invoice_datetime/invoice.py 2014-08-05 16:41:41 +0000
3+++ invoice_datetime/invoice.py 2014-09-22 22:48:18 +0000
4@@ -42,16 +42,16 @@
5 class account_payment_term(osv.Model):
6 _inherit = "account.payment.term"
7
8- def compute(self, cr, uid, id, value, date_ref=False, context=None):
9+ def compute(self, cr, uid, ids, value, date_ref=False, context=None):
10 if context is None:
11 context = {}
12 if date_ref:
13 try:
14 date_ref = time.strftime('%Y-%m-%d', time.strptime(
15 date_ref, '%Y-%m-%d %H:%M:%S'))
16- except:
17+ except Exception, e:
18 pass
19- return super(account_payment_term, self).compute(cr, uid, id, value,
20+ return super(account_payment_term, self).compute(cr, uid, ids, value,
21 date_ref, context=context)
22
23
24@@ -64,7 +64,6 @@
25 context = {}
26 res = {}
27 if release.version >= '6':
28- dt_format = tools.DEFAULT_SERVER_DATETIME_FORMAT
29 tz = self.pool.get('res.users').browse(cr, uid, uid).tz
30 for invoice in self.browse(cr, uid, ids, context=context):
31 res[invoice.id] = invoice.invoice_datetime and tools.\
32@@ -110,20 +109,20 @@
33 "date_type": _get_default_type
34 }
35
36- def copy(self, cr, uid, id, default=None, context=None):
37+ def copy(self, cr, uid, ids, default=None, context=None):
38 if context is None:
39 context = {}
40 if default is None:
41 default = {}
42 default.update({'invoice_datetime': False, 'date_invoice' : False})
43- return super(account_invoice, self).copy(cr, uid, id, default, context)
44+ return super(account_invoice, self).copy(cr, uid, ids, default, context)
45
46 def _get_time_zone(self, cr, uid, invoice_id, context=None):
47 if context is None:
48 context = {}
49 res_users_obj = self.pool.get('res.users')
50 userstz = res_users_obj.browse(cr, uid, [uid])[0].partner_id.tz
51- a = 0
52+ result = 0
53 if userstz:
54 hours = timezone(userstz)
55 fmt = '%Y-%m-%d %H:%M:%S %Z%z'
56@@ -133,14 +132,14 @@
57 timezone_loc = (loc_dt.strftime(fmt))
58 diff_timezone_original = timezone_loc[-5:-2]
59 timezone_original = int(diff_timezone_original)
60- s = str(datetime.datetime.now(pytz.timezone(userstz)))
61- s = s[-6:-3]
62- timezone_present = int(s)*-1
63- a = timezone_original + ((
64+ str_datetime = str(datetime.datetime.now(pytz.timezone(userstz)))
65+ str_datetime = str_datetime[-6:-3]
66+ timezone_present = int(str_datetime)*-1
67+ result = timezone_original + ((
68 timezone_present + timezone_original)*-1)
69- return a
70+ return result
71
72- def assigned_datetime(self, cr, uid, values, context=None):
73+ def assigned_datetime(self, cr, uid, ids, values, context=None):
74 if context is None:
75 context = {}
76 res = {}
77@@ -205,7 +204,7 @@
78 def action_move_create(self, cr, uid, ids, context=None):
79 for inv in self.browse(cr, uid, ids, context=context):
80 if inv.type in ('out_invoice', 'out_refund'):
81- vals_date = self.assigned_datetime(cr, uid,
82+ vals_date = self.assigned_datetime(cr, uid, ids,
83 {'invoice_datetime': inv.invoice_datetime,
84 'date_invoice': inv.date_invoice},
85 context=context)
86
87=== modified file 'invoice_datetime/res_config.py'
88--- invoice_datetime/res_config.py 2014-08-04 13:52:04 +0000
89+++ invoice_datetime/res_config.py 2014-09-22 22:48:18 +0000
90@@ -21,6 +21,7 @@
91
92 import time
93 import datetime
94+import openerp
95 from dateutil.relativedelta import relativedelta
96 from operator import itemgetter
97 from os.path import join as opj
98@@ -40,7 +41,7 @@
99 'select_date' : fields.selection([('date', 'Date'), ('datetime', 'Datetime')], string="Default date of invoices", help="Select the field you want to displayed in the invoice for the selected company."),
100 }
101
102- def get_default_select_date(self, cr, uid, fields, context=None):
103+ def get_default_select_date(self, cr, uid, fields_name, context=None):
104 key_by_company_id = "acc_invoice.date_invoice_type_" + str(self._default_company(cr, uid))
105 type_show_date = self.pool.get("ir.config_parameter").get_param(cr, uid, key_by_company_id, default='date', context=context)
106 return {'select_date': type_show_date}