Merge lp:~unifield-team/unifield-server/us-2030 into lp:unifield-server
- us-2030
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+311840@code.launchpad.net |
Commit message
Description of the change
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 | 30 | from osv import osv | 30 | from osv import osv |
6 | 31 | import pooler | 31 | import pooler |
7 | 32 | from tools.translate import _ | 32 | from tools.translate import _ |
8 | 33 | import tools | ||
9 | 33 | 34 | ||
10 | 34 | from msf_order_date import TRANSPORT_TYPE | 35 | from msf_order_date import TRANSPORT_TYPE |
11 | 35 | from msf_outgoing import INTEGRITY_STATUS_SELECTION | 36 | from msf_outgoing import INTEGRITY_STATUS_SELECTION |
12 | @@ -551,7 +552,7 @@ | |||
13 | 551 | file_line_error = [] | 552 | file_line_error = [] |
14 | 552 | line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False | 553 | line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False |
15 | 553 | ext_ref = values.get(x, [False, False])[1] | 554 | ext_ref = values.get(x, [False, False])[1] |
17 | 554 | ext_ref = ext_ref and str(ext_ref) or False | 555 | ext_ref = ext_ref and tools.ustr(ext_ref) or False |
18 | 555 | for manda_field in LINES_COLUMNS: | 556 | for manda_field in LINES_COLUMNS: |
19 | 556 | if manda_field[2] == 'mandatory' and not values.get(x, [])[manda_field[0]]: | 557 | if manda_field[2] == 'mandatory' and not values.get(x, [])[manda_field[0]]: |
20 | 557 | not_ok = True | 558 | not_ok = True |
21 | @@ -617,9 +618,9 @@ | |||
22 | 617 | except ValueError: | 618 | except ValueError: |
23 | 618 | exp_value = False | 619 | exp_value = False |
24 | 619 | 620 | ||
26 | 620 | if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[8])): | 621 | if exp_value and not prodlot_cache.get(product_id, {}).get(tools.ustr(vals[8])): |
27 | 621 | prodlot_cache.setdefault(product_id, {}) | 622 | prodlot_cache.setdefault(product_id, {}) |
29 | 622 | prodlot_cache[product_id].setdefault(str(vals[8]), exp_value) | 623 | prodlot_cache[product_id].setdefault(tools.ustr(vals[8]), exp_value) |
30 | 623 | 624 | ||
31 | 624 | file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref) | 625 | file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref) |
32 | 625 | 626 | ||
33 | @@ -1122,12 +1123,12 @@ | |||
34 | 1122 | 1123 | ||
35 | 1123 | # UoM | 1124 | # UoM |
36 | 1124 | uom_value = values[4] | 1125 | uom_value = values[4] |
38 | 1125 | if str(uom_value) == line.move_uom_id.name: | 1126 | if tools.ustr(uom_value) == line.move_uom_id.name: |
39 | 1126 | write_vals['imp_uom_id'] = line.move_uom_id.id | 1127 | write_vals['imp_uom_id'] = line.move_uom_id.id |
40 | 1127 | else: | 1128 | else: |
42 | 1128 | uom_id = UOM_NAME_ID.get(str(uom_value)) | 1129 | uom_id = UOM_NAME_ID.get(tools.ustr(uom_value)) |
43 | 1129 | if not uom_id: | 1130 | if not uom_id: |
45 | 1130 | uom_ids = uom_obj.search(cr, uid, [('name', '=', str(uom_value))], context=context) | 1131 | uom_ids = uom_obj.search(cr, uid, [('name', '=', tools.ustr(uom_value))], context=context) |
46 | 1131 | if uom_ids: | 1132 | if uom_ids: |
47 | 1132 | write_vals['imp_uom_id'] = uom_ids[0] | 1133 | write_vals['imp_uom_id'] = uom_ids[0] |
48 | 1133 | else: | 1134 | else: |
49 | @@ -1160,7 +1161,7 @@ | |||
50 | 1160 | 1161 | ||
51 | 1161 | if line_currency: | 1162 | if line_currency: |
52 | 1162 | write_vals['imp_currency_id'] = line_currency.id | 1163 | write_vals['imp_currency_id'] = line_currency.id |
54 | 1163 | if str(currency_value) != line_currency.name: | 1164 | if tools.ustr(currency_value) != line_currency.name: |
55 | 1164 | 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.') | 1165 | 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 | 1165 | errors.append(err_msg) | 1166 | errors.append(err_msg) |
57 | 1166 | 1167 | ||
58 | @@ -1174,35 +1175,35 @@ | |||
59 | 1174 | if not lot_check and not exp_check and batch_value: | 1175 | if not lot_check and not exp_check and batch_value: |
60 | 1175 | warnings.append(_('A batch is defined on the imported file but the product doesn\'t require batch number - Batch ignored')) | 1176 | warnings.append(_('A batch is defined on the imported file but the product doesn\'t require batch number - Batch ignored')) |
61 | 1176 | elif batch_value: | 1177 | elif batch_value: |
63 | 1177 | batch_id = PRODLOT_NAME_ID.get(str(batch_value)) | 1178 | batch_id = PRODLOT_NAME_ID.get(tools.ustr(batch_value)) |
64 | 1178 | batch_ids = prodlot_obj.search(cr, uid, [('product_id', '=', write_vals['imp_product_id'])], context=context) | 1179 | batch_ids = prodlot_obj.search(cr, uid, [('product_id', '=', write_vals['imp_product_id'])], context=context) |
65 | 1179 | if not batch_id or batch_id not in batch_ids: | 1180 | if not batch_id or batch_id not in batch_ids: |
66 | 1180 | 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! | 1181 | 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! |
68 | 1181 | batch_ids = prodlot_obj.search(cr, uid, [('name', '=', str(batch_value)), ('product_id', '=', write_vals['imp_product_id'])], context=context) | 1182 | batch_ids = prodlot_obj.search(cr, uid, [('name', '=', tools.ustr(batch_value)), ('product_id', '=', write_vals['imp_product_id'])], context=context) |
69 | 1182 | if batch_ids: | 1183 | if batch_ids: |
70 | 1183 | batch_id = batch_ids[0] | 1184 | batch_id = batch_ids[0] |
72 | 1184 | PRODLOT_NAME_ID.setdefault(str(batch_value), batch_id) | 1185 | PRODLOT_NAME_ID.setdefault(tools.ustr(batch_value), batch_id) |
73 | 1185 | else: | 1186 | else: |
75 | 1186 | if lot_check and prodlot_cache.get(write_vals['imp_product_id'], {}).get(str(batch_value)): | 1187 | if lot_check and prodlot_cache.get(write_vals['imp_product_id'], {}).get(tools.ustr(batch_value)): |
76 | 1187 | write_vals.update({ | 1188 | write_vals.update({ |
79 | 1188 | 'imp_batch_name': str(batch_value), | 1189 | 'imp_batch_name': tools.ustr(batch_value), |
80 | 1189 | 'imp_exp_date': prodlot_cache[write_vals['imp_product_id']][str(batch_value)], | 1190 | 'imp_exp_date': prodlot_cache[write_vals['imp_product_id']][tools.ustr(batch_value)], |
81 | 1190 | }) | 1191 | }) |
82 | 1191 | else: | 1192 | else: |
84 | 1192 | write_vals['imp_batch_name'] = str(batch_value) | 1193 | write_vals['imp_batch_name'] = tools.ustr(batch_value) |
85 | 1193 | 1194 | ||
86 | 1194 | if batch_id: | 1195 | if batch_id: |
87 | 1195 | write_vals.update({ | 1196 | write_vals.update({ |
88 | 1196 | 'imp_batch_id': batch_id, | 1197 | 'imp_batch_id': batch_id, |
90 | 1197 | 'imp_batch_name': str(batch_value), | 1198 | 'imp_batch_name': tools.ustr(batch_value), |
91 | 1198 | }) | 1199 | }) |
92 | 1199 | else: | 1200 | else: |
93 | 1200 | # UFTP-386: Add the warning message indicating that the batch does not exist for THIS product (but for others!) | 1201 | # UFTP-386: Add the warning message indicating that the batch does not exist for THIS product (but for others!) |
94 | 1201 | # If the batch is a completely new, no need to warn. | 1202 | # If the batch is a completely new, no need to warn. |
96 | 1202 | batch_ids = prodlot_obj.search(cr, uid, [('name', '=', str(batch_value))], context=context) | 1203 | batch_ids = prodlot_obj.search(cr, uid, [('name', '=', tools.ustr(batch_value))], context=context) |
97 | 1203 | if batch_ids: | 1204 | if batch_ids: |
98 | 1204 | warnings.append(_('The given batch does not exist for the given product, but will be created automatically during the process.')) | 1205 | warnings.append(_('The given batch does not exist for the given product, but will be created automatically during the process.')) |
100 | 1205 | write_vals.update({'imp_batch_name': str(batch_value),}) | 1206 | write_vals.update({'imp_batch_name': tools.ustr(batch_value),}) |
101 | 1206 | 1207 | ||
102 | 1207 | # Expired date | 1208 | # Expired date |
103 | 1208 | exp_value = values[8] | 1209 | exp_value = values[8] |
104 | @@ -1256,9 +1257,9 @@ | |||
105 | 1256 | if batch_value and exp_date: | 1257 | if batch_value and exp_date: |
106 | 1257 | # If a name and an expiry date for batch are defined, create a new batch | 1258 | # If a name and an expiry date for batch are defined, create a new batch |
107 | 1258 | prodlot_cache.setdefault(product.id, {}) | 1259 | prodlot_cache.setdefault(product.id, {}) |
109 | 1259 | prodlot_cache[product.id].setdefault(str(batch_value), exp_date) | 1260 | prodlot_cache[product.id].setdefault(tools.ustr(batch_value), exp_date) |
110 | 1260 | write_vals.update({ | 1261 | write_vals.update({ |
112 | 1261 | 'imp_batch_name': str(batch_value), | 1262 | 'imp_batch_name': tools.ustr(batch_value), |
113 | 1262 | 'imp_exp_date': exp_date, | 1263 | 'imp_exp_date': exp_date, |
114 | 1263 | }) | 1264 | }) |
115 | 1264 | 1265 | ||
116 | 1265 | 1266 | ||
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 | 366 | dtd = etree.DTD(dtd_path) | 366 | dtd = etree.DTD(dtd_path) |
122 | 367 | tree = etree.fromstring(xml_file) | 367 | tree = etree.fromstring(xml_file) |
123 | 368 | except XMLSyntaxError as ex: | 368 | except XMLSyntaxError as ex: |
125 | 369 | raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !\nTechnical details:\n%s') % str(ex)) | 369 | raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !\nTechnical details:\n%s') % tools.ustr(ex)) |
126 | 370 | 370 | ||
127 | 371 | if not dtd.validate(tree): | 371 | if not dtd.validate(tree): |
128 | 372 | # build error message: | 372 | # build error message: |
129 | 373 | error_msg = "" | 373 | error_msg = "" |
130 | 374 | for line_obj in dtd.error_log.filter_from_errors(): | 374 | for line_obj in dtd.error_log.filter_from_errors(): |
132 | 375 | line = str(line_obj) | 375 | line = tools.ustr(line_obj) |
133 | 376 | err_line = line.split(':')[1] | 376 | err_line = line.split(':')[1] |
134 | 377 | err_str = line.split(':')[-1] | 377 | err_str = line.split(':')[-1] |
135 | 378 | err_type = line.split(':')[5] | 378 | err_type = line.split(':')[5] |
136 | @@ -576,10 +576,10 @@ | |||
137 | 576 | LN_BY_EXT_REF.setdefault(wiz.id, {}) | 576 | LN_BY_EXT_REF.setdefault(wiz.id, {}) |
138 | 577 | EXT_REF_BY_LN.setdefault(wiz.id, {}) | 577 | EXT_REF_BY_LN.setdefault(wiz.id, {}) |
139 | 578 | if line.in_ext_ref: | 578 | if line.in_ext_ref: |
141 | 579 | LN_BY_EXT_REF[wiz.id].setdefault(str(line.in_ext_ref), []) | 579 | LN_BY_EXT_REF[wiz.id].setdefault(tools.ustr(line.in_ext_ref), []) |
142 | 580 | EXT_REF_BY_LN[wiz.id].setdefault(l_num, []) | 580 | EXT_REF_BY_LN[wiz.id].setdefault(l_num, []) |
143 | 581 | LN_BY_EXT_REF[wiz.id][line.in_ext_ref].append(l_num) | 581 | LN_BY_EXT_REF[wiz.id][line.in_ext_ref].append(l_num) |
145 | 582 | EXT_REF_BY_LN[wiz.id][l_num].append(str(line.in_ext_ref)) | 582 | EXT_REF_BY_LN[wiz.id][l_num].append(tools.ustr(line.in_ext_ref)) |
146 | 583 | 583 | ||
147 | 584 | # Variables | 584 | # Variables |
148 | 585 | lines_to_ignored = [] # Bad formatting lines | 585 | lines_to_ignored = [] # Bad formatting lines |
149 | @@ -803,7 +803,7 @@ | |||
150 | 803 | file_line_error.append(err1) | 803 | file_line_error.append(err1) |
151 | 804 | 804 | ||
152 | 805 | line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False | 805 | line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False |
154 | 806 | ext_ref = values.get(x, ['', ''])[1] and str(values.get(x, ['', ''])[1]) | 806 | ext_ref = values.get(x, ['', ''])[1] and tools.ustr(values.get(x, ['', ''])[1]) |
155 | 807 | 807 | ||
156 | 808 | if not line_number and not ext_ref: | 808 | if not line_number and not ext_ref: |
157 | 809 | not_ok = True | 809 | not_ok = True |
158 | @@ -1409,12 +1409,12 @@ | |||
159 | 1409 | 1409 | ||
160 | 1410 | # UoM | 1410 | # UoM |
161 | 1411 | uom_value = values[5] | 1411 | uom_value = values[5] |
163 | 1412 | if str(uom_value) == line.in_uom.name: | 1412 | if tools.ustr(uom_value) == line.in_uom.name: |
164 | 1413 | write_vals['imp_uom'] = line.in_uom.id | 1413 | write_vals['imp_uom'] = line.in_uom.id |
165 | 1414 | else: | 1414 | else: |
166 | 1415 | uom_id = UOM_NAME_ID.get(str(uom_value)) | 1415 | uom_id = UOM_NAME_ID.get(str(uom_value)) |
167 | 1416 | if not uom_id: | 1416 | if not uom_id: |
169 | 1417 | uom_ids = uom_obj.search(cr, uid, [('name', '=', str(uom_value))], context=context) | 1417 | uom_ids = uom_obj.search(cr, uid, [('name', '=', tools.ustr(uom_value))], context=context) |
170 | 1418 | if uom_ids: | 1418 | if uom_ids: |
171 | 1419 | write_vals['imp_uom'] = uom_ids[0] | 1419 | write_vals['imp_uom'] = uom_ids[0] |
172 | 1420 | else: | 1420 | else: |
173 | @@ -1452,7 +1452,7 @@ | |||
174 | 1452 | 1452 | ||
175 | 1453 | # Currency | 1453 | # Currency |
176 | 1454 | currency_value = values[7] | 1454 | currency_value = values[7] |
178 | 1455 | if str(currency_value) == line.in_currency.name: | 1455 | if tools.ustr(currency_value) == line.in_currency.name: |
179 | 1456 | write_vals['imp_currency'] = line.in_currency.id | 1456 | write_vals['imp_currency'] = line.in_currency.id |
180 | 1457 | elif line.in_currency.name: | 1457 | elif line.in_currency.name: |
181 | 1458 | 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.') | 1458 | 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.') |