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

Proposed by jftempo
Status: Merged
Merged at revision: 4145
Proposed branch: lp:~unifield-team/unifield-server/us-1937
Merge into: lp:unifield-server
Diff against target: 92 lines (+26/-6)
2 files modified
bin/addons/msf_doc_import/wizard/abstract_wizard_import.py (+11/-3)
bin/addons/msf_doc_import/wizard/wizard_import_batch.py (+15/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1937
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+314810@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/abstract_wizard_import.py'
--- bin/addons/msf_doc_import/wizard/abstract_wizard_import.py 2016-08-03 14:52:14 +0000
+++ bin/addons/msf_doc_import/wizard/abstract_wizard_import.py 2017-01-16 10:08:29 +0000
@@ -82,7 +82,8 @@
82 d = False82 d = False
83 for dformat in date_format:83 for dformat in date_format:
84 try:84 try:
85 d = str(DateTime.strptime(date_value, dformat))85 d = DateTime.strptime(date_value, dformat)
86 d = d.strftime('%Y-%m-%d %H:%M:%S')
86 except ValueError:87 except ValueError:
87 continue88 continue
8889
@@ -363,7 +364,14 @@
363364
364 file_obj.getNbRows()365 file_obj.getNbRows()
365 # iterator on rows366 # iterator on rows
366 return file_obj.getRows(), file_obj.getNbRows()367 try:
368 res = file_obj.getRows(), file_obj.getNbRows()
369 return res
370 except TypeError as e:
371 raise osv.except_osv(
372 _('Error'),
373 _('An error occurs during the reading of the file. Please contact an administrator and give him the import file and this error: %s') % e,
374 )
367375
368 def check_headers(self, headers_row, headers_title, context=None):376 def check_headers(self, headers_row, headers_title, context=None):
369 """377 """
@@ -454,4 +462,4 @@
454462
455 return p_ids[0]463 return p_ids[0]
456464
457abstract_wizard_import()
458\ No newline at end of file465\ No newline at end of file
466abstract_wizard_import()
459467
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_import_batch.py'
--- bin/addons/msf_doc_import/wizard/wizard_import_batch.py 2016-09-05 12:33:07 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_import_batch.py 2017-01-16 10:08:29 +0000
@@ -24,6 +24,8 @@
2424
25import pooler25import pooler
2626
27from datetime import datetime
28
27from osv import osv29from osv import osv
28from tools.translate import _30from tools.translate import _
2931
@@ -128,6 +130,7 @@
128 prodlot_obj = self.pool.get('stock.production.lot')130 prodlot_obj = self.pool.get('stock.production.lot')
129 product_obj = self.pool.get('product.product')131 product_obj = self.pool.get('product.product')
130 sequence_obj = self.pool.get('ir.sequence')132 sequence_obj = self.pool.get('ir.sequence')
133 date_tools = self.pool.get('date.tools')
131134
132 if context is None:135 if context is None:
133 context = {}136 context = {}
@@ -170,13 +173,13 @@
170 # Product173 # Product
171 product_id = None174 product_id = None
172 try:175 try:
173 product_id = self.get_product_by_default_code(cr, uid, get_cell(line_data, 'product_id'),176 product_id = self.get_product_by_default_code(cr, uid, get_cell(line_data, 'product_id').strip(),
174 context=context)177 context=context)
175 except UnifieldImportException as e:178 except UnifieldImportException as e:
176 save_error(e)179 save_error(e)
177180
178 # Batch number type181 # Batch number type
179 batch_type = get_cell(line_data, 'type')182 batch_type = get_cell(line_data, 'type').strip()
180 if batch_type.upper() not in (_('Standard').upper(), _('Internal').upper()):183 if batch_type.upper() not in (_('Standard').upper(), _('Internal').upper()):
181 save_error(184 save_error(
182 _('The Type of the batch number should be \'Standard\' or \'Internal\''),185 _('The Type of the batch number should be \'Standard\' or \'Internal\''),
@@ -192,8 +195,17 @@
192 continue195 continue
193196
194 # Make consistency checks197 # Make consistency checks
195 name = get_cell(line_data, 'name')198 name = get_cell(line_data, 'name').strip()
196 life_date = get_cell(line_data, 'life_date')199 life_date = get_cell(line_data, 'life_date')
200 if life_date and datetime.strptime(life_date, '%Y-%m-%d %H:%M:%S') < datetime(1900, 01, 01, 0, 0, 0):
201 date_format = date_tools.get_date_format(cr, uid, context=context)
202 save_error(
203 _('You cannot create a batch number with an expiry date before %s') % (
204 datetime(1900, 01, 01, 0, 0, 0).strftime(date_format),
205 ),
206 )
207 continue
208
197 product_brw = product_obj.read(cr, uid, product_id, ['batch_management', 'perishable'], context=context)209 product_brw = product_obj.read(cr, uid, product_id, ['batch_management', 'perishable'], context=context)
198210
199 if not product_brw['batch_management'] and not product_brw['perishable']:211 if not product_brw['batch_management'] and not product_brw['perishable']:

Subscribers

People subscribed via source and target branches

to all changes: