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
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py'
--- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-11-09 08:28:09 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-11-25 16:15:46 +0000
@@ -30,6 +30,7 @@
30from osv import osv30from osv import osv
31import pooler31import pooler
32from tools.translate import _32from tools.translate import _
33import tools
3334
34from msf_order_date import TRANSPORT_TYPE35from msf_order_date import TRANSPORT_TYPE
35from msf_outgoing import INTEGRITY_STATUS_SELECTION36from msf_outgoing import INTEGRITY_STATUS_SELECTION
@@ -551,7 +552,7 @@
551 file_line_error = []552 file_line_error = []
552 line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False553 line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False
553 ext_ref = values.get(x, [False, False])[1]554 ext_ref = values.get(x, [False, False])[1]
554 ext_ref = ext_ref and str(ext_ref) or False555 ext_ref = ext_ref and tools.ustr(ext_ref) or False
555 for manda_field in LINES_COLUMNS:556 for manda_field in LINES_COLUMNS:
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]]:
557 not_ok = True558 not_ok = True
@@ -617,9 +618,9 @@
617 except ValueError:618 except ValueError:
618 exp_value = False619 exp_value = False
619620
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])):
621 prodlot_cache.setdefault(product_id, {})622 prodlot_cache.setdefault(product_id, {})
622 prodlot_cache[product_id].setdefault(str(vals[8]), exp_value)623 prodlot_cache[product_id].setdefault(tools.ustr(vals[8]), exp_value)
623624
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)
625626
@@ -1122,12 +1123,12 @@
11221123
1123 # UoM1124 # UoM
1124 uom_value = values[4]1125 uom_value = values[4]
1125 if str(uom_value) == line.move_uom_id.name:1126 if tools.ustr(uom_value) == line.move_uom_id.name:
1126 write_vals['imp_uom_id'] = line.move_uom_id.id1127 write_vals['imp_uom_id'] = line.move_uom_id.id
1127 else:1128 else:
1128 uom_id = UOM_NAME_ID.get(str(uom_value))1129 uom_id = UOM_NAME_ID.get(tools.ustr(uom_value))
1129 if not uom_id:1130 if not uom_id:
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)
1131 if uom_ids:1132 if uom_ids:
1132 write_vals['imp_uom_id'] = uom_ids[0]1133 write_vals['imp_uom_id'] = uom_ids[0]
1133 else:1134 else:
@@ -1160,7 +1161,7 @@
11601161
1161 if line_currency:1162 if line_currency:
1162 write_vals['imp_currency_id'] = line_currency.id1163 write_vals['imp_currency_id'] = line_currency.id
1163 if str(currency_value) != line_currency.name:1164 if tools.ustr(currency_value) != line_currency.name:
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.')
1165 errors.append(err_msg)1166 errors.append(err_msg)
11661167
@@ -1174,35 +1175,35 @@
1174 if not lot_check and not exp_check and batch_value:1175 if not lot_check and not exp_check and batch_value:
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'))
1176 elif batch_value:1177 elif batch_value:
1177 batch_id = PRODLOT_NAME_ID.get(str(batch_value))1178 batch_id = PRODLOT_NAME_ID.get(tools.ustr(batch_value))
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)
1179 if not batch_id or batch_id not in batch_ids:1180 if not batch_id or batch_id not in batch_ids:
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!
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)
1182 if batch_ids:1183 if batch_ids:
1183 batch_id = batch_ids[0]1184 batch_id = batch_ids[0]
1184 PRODLOT_NAME_ID.setdefault(str(batch_value), batch_id)1185 PRODLOT_NAME_ID.setdefault(tools.ustr(batch_value), batch_id)
1185 else:1186 else:
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)):
1187 write_vals.update({1188 write_vals.update({
1188 'imp_batch_name': str(batch_value),1189 'imp_batch_name': tools.ustr(batch_value),
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)],
1190 })1191 })
1191 else:1192 else:
1192 write_vals['imp_batch_name'] = str(batch_value)1193 write_vals['imp_batch_name'] = tools.ustr(batch_value)
11931194
1194 if batch_id:1195 if batch_id:
1195 write_vals.update({1196 write_vals.update({
1196 'imp_batch_id': batch_id,1197 'imp_batch_id': batch_id,
1197 'imp_batch_name': str(batch_value),1198 'imp_batch_name': tools.ustr(batch_value),
1198 })1199 })
1199 else:1200 else:
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!)
1201 # If the batch is a completely new, no need to warn.1202 # If the batch is a completely new, no need to warn.
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)
1203 if batch_ids:1204 if batch_ids:
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.'))
1205 write_vals.update({'imp_batch_name': str(batch_value),})1206 write_vals.update({'imp_batch_name': tools.ustr(batch_value),})
12061207
1207 # Expired date1208 # Expired date
1208 exp_value = values[8]1209 exp_value = values[8]
@@ -1256,9 +1257,9 @@
1256 if batch_value and exp_date:1257 if batch_value and exp_date:
1257 # If a name and an expiry date for batch are defined, create a new batch1258 # If a name and an expiry date for batch are defined, create a new batch
1258 prodlot_cache.setdefault(product.id, {})1259 prodlot_cache.setdefault(product.id, {})
1259 prodlot_cache[product.id].setdefault(str(batch_value), exp_date)1260 prodlot_cache[product.id].setdefault(tools.ustr(batch_value), exp_date)
1260 write_vals.update({1261 write_vals.update({
1261 'imp_batch_name': str(batch_value),1262 'imp_batch_name': tools.ustr(batch_value),
1262 'imp_exp_date': exp_date,1263 'imp_exp_date': exp_date,
1263 })1264 })
12641265
12651266
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py'
--- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-11-17 08:36:31 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-11-25 16:15:46 +0000
@@ -366,13 +366,13 @@
366 dtd = etree.DTD(dtd_path)366 dtd = etree.DTD(dtd_path)
367 tree = etree.fromstring(xml_file)367 tree = etree.fromstring(xml_file)
368 except XMLSyntaxError as ex:368 except XMLSyntaxError as ex:
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))
370370
371 if not dtd.validate(tree):371 if not dtd.validate(tree):
372 # build error message:372 # build error message:
373 error_msg = ""373 error_msg = ""
374 for line_obj in dtd.error_log.filter_from_errors():374 for line_obj in dtd.error_log.filter_from_errors():
375 line = str(line_obj)375 line = tools.ustr(line_obj)
376 err_line = line.split(':')[1]376 err_line = line.split(':')[1]
377 err_str = line.split(':')[-1]377 err_str = line.split(':')[-1]
378 err_type = line.split(':')[5]378 err_type = line.split(':')[5]
@@ -576,10 +576,10 @@
576 LN_BY_EXT_REF.setdefault(wiz.id, {})576 LN_BY_EXT_REF.setdefault(wiz.id, {})
577 EXT_REF_BY_LN.setdefault(wiz.id, {})577 EXT_REF_BY_LN.setdefault(wiz.id, {})
578 if line.in_ext_ref:578 if line.in_ext_ref:
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), [])
580 EXT_REF_BY_LN[wiz.id].setdefault(l_num, [])580 EXT_REF_BY_LN[wiz.id].setdefault(l_num, [])
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)
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))
583583
584 # Variables584 # Variables
585 lines_to_ignored = [] # Bad formatting lines585 lines_to_ignored = [] # Bad formatting lines
@@ -803,7 +803,7 @@
803 file_line_error.append(err1)803 file_line_error.append(err1)
804804
805 line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False805 line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False
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])
807807
808 if not line_number and not ext_ref:808 if not line_number and not ext_ref:
809 not_ok = True809 not_ok = True
@@ -1409,12 +1409,12 @@
14091409
1410 # UoM1410 # UoM
1411 uom_value = values[5]1411 uom_value = values[5]
1412 if str(uom_value) == line.in_uom.name:1412 if tools.ustr(uom_value) == line.in_uom.name:
1413 write_vals['imp_uom'] = line.in_uom.id1413 write_vals['imp_uom'] = line.in_uom.id
1414 else:1414 else:
1415 uom_id = UOM_NAME_ID.get(str(uom_value))1415 uom_id = UOM_NAME_ID.get(str(uom_value))
1416 if not uom_id:1416 if not uom_id:
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)
1418 if uom_ids:1418 if uom_ids:
1419 write_vals['imp_uom'] = uom_ids[0]1419 write_vals['imp_uom'] = uom_ids[0]
1420 else:1420 else:
@@ -1452,7 +1452,7 @@
14521452
1453 # Currency1453 # Currency
1454 currency_value = values[7]1454 currency_value = values[7]
1455 if str(currency_value) == line.in_currency.name:1455 if tools.ustr(currency_value) == line.in_currency.name:
1456 write_vals['imp_currency'] = line.in_currency.id1456 write_vals['imp_currency'] = line.in_currency.id
1457 elif line.in_currency.name:1457 elif line.in_currency.name:
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.')

Subscribers

People subscribed via source and target branches

to all changes: