Merge lp:~unifield-team/unifield-server/us-2030 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4088
Proposed branch: lp:~unifield-team/unifield-server/us-2030
Merge into: lp:unifield-server
Diff against target: 181 lines (+28/-27)
2 files modified
bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py (+20/-19)
bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py (+8/-8)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-2030
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+311840@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py'
2--- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-11-09 08:28:09 +0000
3+++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-11-25 16:15:46 +0000
4@@ -30,6 +30,7 @@
5 from osv import osv
6 import pooler
7 from tools.translate import _
8+import tools
9
10 from msf_order_date import TRANSPORT_TYPE
11 from msf_outgoing import INTEGRITY_STATUS_SELECTION
12@@ -551,7 +552,7 @@
13 file_line_error = []
14 line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False
15 ext_ref = values.get(x, [False, False])[1]
16- ext_ref = ext_ref and str(ext_ref) or False
17+ ext_ref = ext_ref and tools.ustr(ext_ref) or False
18 for manda_field in LINES_COLUMNS:
19 if manda_field[2] == 'mandatory' and not values.get(x, [])[manda_field[0]]:
20 not_ok = True
21@@ -617,9 +618,9 @@
22 except ValueError:
23 exp_value = False
24
25- if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[8])):
26+ if exp_value and not prodlot_cache.get(product_id, {}).get(tools.ustr(vals[8])):
27 prodlot_cache.setdefault(product_id, {})
28- prodlot_cache[product_id].setdefault(str(vals[8]), exp_value)
29+ prodlot_cache[product_id].setdefault(tools.ustr(vals[8]), exp_value)
30
31 file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref)
32
33@@ -1122,12 +1123,12 @@
34
35 # UoM
36 uom_value = values[4]
37- if str(uom_value) == line.move_uom_id.name:
38+ if tools.ustr(uom_value) == line.move_uom_id.name:
39 write_vals['imp_uom_id'] = line.move_uom_id.id
40 else:
41- uom_id = UOM_NAME_ID.get(str(uom_value))
42+ uom_id = UOM_NAME_ID.get(tools.ustr(uom_value))
43 if not uom_id:
44- uom_ids = uom_obj.search(cr, uid, [('name', '=', str(uom_value))], context=context)
45+ uom_ids = uom_obj.search(cr, uid, [('name', '=', tools.ustr(uom_value))], context=context)
46 if uom_ids:
47 write_vals['imp_uom_id'] = uom_ids[0]
48 else:
49@@ -1160,7 +1161,7 @@
50
51 if line_currency:
52 write_vals['imp_currency_id'] = line_currency.id
53- if str(currency_value) != line_currency.name:
54+ if tools.ustr(currency_value) != line_currency.name:
55 err_msg = _('The currency on the Excel file is not the same as the currency of the IN line - You must have the same currency on both side - Currency of the initial line kept.')
56 errors.append(err_msg)
57
58@@ -1174,35 +1175,35 @@
59 if not lot_check and not exp_check and batch_value:
60 warnings.append(_('A batch is defined on the imported file but the product doesn\'t require batch number - Batch ignored'))
61 elif batch_value:
62- batch_id = PRODLOT_NAME_ID.get(str(batch_value))
63+ batch_id = PRODLOT_NAME_ID.get(tools.ustr(batch_value))
64 batch_ids = prodlot_obj.search(cr, uid, [('product_id', '=', write_vals['imp_product_id'])], context=context)
65 if not batch_id or batch_id not in batch_ids:
66 batch_id = None # UFTP-386: If the batch number does not belong to the batch_idS of the given product --> set it to None again!
67- batch_ids = prodlot_obj.search(cr, uid, [('name', '=', str(batch_value)), ('product_id', '=', write_vals['imp_product_id'])], context=context)
68+ batch_ids = prodlot_obj.search(cr, uid, [('name', '=', tools.ustr(batch_value)), ('product_id', '=', write_vals['imp_product_id'])], context=context)
69 if batch_ids:
70 batch_id = batch_ids[0]
71- PRODLOT_NAME_ID.setdefault(str(batch_value), batch_id)
72+ PRODLOT_NAME_ID.setdefault(tools.ustr(batch_value), batch_id)
73 else:
74- if lot_check and prodlot_cache.get(write_vals['imp_product_id'], {}).get(str(batch_value)):
75+ if lot_check and prodlot_cache.get(write_vals['imp_product_id'], {}).get(tools.ustr(batch_value)):
76 write_vals.update({
77- 'imp_batch_name': str(batch_value),
78- 'imp_exp_date': prodlot_cache[write_vals['imp_product_id']][str(batch_value)],
79+ 'imp_batch_name': tools.ustr(batch_value),
80+ 'imp_exp_date': prodlot_cache[write_vals['imp_product_id']][tools.ustr(batch_value)],
81 })
82 else:
83- write_vals['imp_batch_name'] = str(batch_value)
84+ write_vals['imp_batch_name'] = tools.ustr(batch_value)
85
86 if batch_id:
87 write_vals.update({
88 'imp_batch_id': batch_id,
89- 'imp_batch_name': str(batch_value),
90+ 'imp_batch_name': tools.ustr(batch_value),
91 })
92 else:
93 # UFTP-386: Add the warning message indicating that the batch does not exist for THIS product (but for others!)
94 # If the batch is a completely new, no need to warn.
95- batch_ids = prodlot_obj.search(cr, uid, [('name', '=', str(batch_value))], context=context)
96+ batch_ids = prodlot_obj.search(cr, uid, [('name', '=', tools.ustr(batch_value))], context=context)
97 if batch_ids:
98 warnings.append(_('The given batch does not exist for the given product, but will be created automatically during the process.'))
99- write_vals.update({'imp_batch_name': str(batch_value),})
100+ write_vals.update({'imp_batch_name': tools.ustr(batch_value),})
101
102 # Expired date
103 exp_value = values[8]
104@@ -1256,9 +1257,9 @@
105 if batch_value and exp_date:
106 # If a name and an expiry date for batch are defined, create a new batch
107 prodlot_cache.setdefault(product.id, {})
108- prodlot_cache[product.id].setdefault(str(batch_value), exp_date)
109+ prodlot_cache[product.id].setdefault(tools.ustr(batch_value), exp_date)
110 write_vals.update({
111- 'imp_batch_name': str(batch_value),
112+ 'imp_batch_name': tools.ustr(batch_value),
113 'imp_exp_date': exp_date,
114 })
115
116
117=== modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py'
118--- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-11-17 08:36:31 +0000
119+++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-11-25 16:15:46 +0000
120@@ -366,13 +366,13 @@
121 dtd = etree.DTD(dtd_path)
122 tree = etree.fromstring(xml_file)
123 except XMLSyntaxError as ex:
124- raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !\nTechnical details:\n%s') % str(ex))
125+ raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !\nTechnical details:\n%s') % tools.ustr(ex))
126
127 if not dtd.validate(tree):
128 # build error message:
129 error_msg = ""
130 for line_obj in dtd.error_log.filter_from_errors():
131- line = str(line_obj)
132+ line = tools.ustr(line_obj)
133 err_line = line.split(':')[1]
134 err_str = line.split(':')[-1]
135 err_type = line.split(':')[5]
136@@ -576,10 +576,10 @@
137 LN_BY_EXT_REF.setdefault(wiz.id, {})
138 EXT_REF_BY_LN.setdefault(wiz.id, {})
139 if line.in_ext_ref:
140- LN_BY_EXT_REF[wiz.id].setdefault(str(line.in_ext_ref), [])
141+ LN_BY_EXT_REF[wiz.id].setdefault(tools.ustr(line.in_ext_ref), [])
142 EXT_REF_BY_LN[wiz.id].setdefault(l_num, [])
143 LN_BY_EXT_REF[wiz.id][line.in_ext_ref].append(l_num)
144- EXT_REF_BY_LN[wiz.id][l_num].append(str(line.in_ext_ref))
145+ EXT_REF_BY_LN[wiz.id][l_num].append(tools.ustr(line.in_ext_ref))
146
147 # Variables
148 lines_to_ignored = [] # Bad formatting lines
149@@ -803,7 +803,7 @@
150 file_line_error.append(err1)
151
152 line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False
153- ext_ref = values.get(x, ['', ''])[1] and str(values.get(x, ['', ''])[1])
154+ ext_ref = values.get(x, ['', ''])[1] and tools.ustr(values.get(x, ['', ''])[1])
155
156 if not line_number and not ext_ref:
157 not_ok = True
158@@ -1409,12 +1409,12 @@
159
160 # UoM
161 uom_value = values[5]
162- if str(uom_value) == line.in_uom.name:
163+ if tools.ustr(uom_value) == line.in_uom.name:
164 write_vals['imp_uom'] = line.in_uom.id
165 else:
166 uom_id = UOM_NAME_ID.get(str(uom_value))
167 if not uom_id:
168- uom_ids = uom_obj.search(cr, uid, [('name', '=', str(uom_value))], context=context)
169+ uom_ids = uom_obj.search(cr, uid, [('name', '=', tools.ustr(uom_value))], context=context)
170 if uom_ids:
171 write_vals['imp_uom'] = uom_ids[0]
172 else:
173@@ -1452,7 +1452,7 @@
174
175 # Currency
176 currency_value = values[7]
177- if str(currency_value) == line.in_currency.name:
178+ if tools.ustr(currency_value) == line.in_currency.name:
179 write_vals['imp_currency'] = line.in_currency.id
180 elif line.in_currency.name:
181 err_msg = _('The currency on the file is not the same as the currency of the PO line - You must have the same currency on both side - Currency of the initial line kept.')

Subscribers

People subscribed via source and target branches

to all changes: