Merge lp:~dorian-kemps/unifield-server/US-5755 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5297
Proposed branch: lp:~dorian-kemps/unifield-server/US-5755
Merge into: lp:unifield-server
Diff against target: 269 lines (+66/-31)
3 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+22/-3)
bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako (+6/-2)
bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py (+38/-26)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5755
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+363563@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_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-02-19 14:49:35 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-02-25 14:57:39 +0000
@@ -62807,12 +62807,13 @@
62807msgid "Virgin Islands (British)"62807msgid "Virgin Islands (British)"
62808msgstr "Iles Vierges (Britanniques)"62808msgstr "Iles Vierges (Britanniques)"
6280962809
62810#. modules: msf_doc_import, kit, sale62810#. modules: msf_doc_import, kit, sale, msf_supply_doc_export
62811#: code:addons/kit/wizard/kit_mass_import.py:21062811#: code:addons/kit/wizard/kit_mass_import.py:210
62812#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:52762812#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:527
62813#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:54062813#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:540
62814#: code:addons/sale/wizard/internal_request_import.py:16262814#: code:addons/sale/wizard/internal_request_import.py:162
62815#: code:addons/sale/wizard/internal_request_import.py:22262815#: code:addons/sale/wizard/internal_request_import.py:222
62816#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:330
62816#, python-format62817#, python-format
62817msgid "No file to import"62818msgid "No file to import"
62818msgstr "Aucun fichier à importer"62819msgstr "Aucun fichier à importer"
@@ -105002,13 +105003,13 @@
105002#. module: msf_supply_doc_export105003#. module: msf_supply_doc_export
105003#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:209105004#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:209
105004#, python-format105005#, python-format
105005msgid "Line %s: Given batch number with this expiry date doesn't exists in database"105006msgid "Line %s: The given batch number with this expiry date doesn't exist in database"
105006msgstr "Ligne %s: Le numéro de lot avec cette date d'expiration n'existe pas en base"105007msgstr "Ligne %s: Le numéro de lot avec cette date d'expiration n'existe pas en base"
105007105008
105008#. module: msf_supply_doc_export105009#. module: msf_supply_doc_export
105009#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:222105010#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:222
105010#, python-format105011#, python-format
105011msgid "Line %s: Given expiry date doesn't exists in database"105012msgid "Line %s: The given expiry date doesn't exist in database"
105012msgstr "Ligne %s: La date d'expiration donnée n'existe pas en base"105013msgstr "Ligne %s: La date d'expiration donnée n'existe pas en base"
105013105014
105014#. module: msf_doc_import105015#. module: msf_doc_import
@@ -105310,3 +105311,21 @@
105310#, python-format105311#, python-format
105311msgid "Document date (%s) should be in posting date FY"105312msgid "Document date (%s) should be in posting date FY"
105312msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation"105313msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation"
105314
105315#. module: msf_supply_doc_export
105316#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:84
105317#, python-format
105318msgid "Line %s: Column \"Qty Picked\" must be a number"
105319msgstr "Ligne %s: La Colonne \"Qté prélevée\" doit être un nombre"
105320
105321#. module: msf_supply_doc_export
105322#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:95
105323#, python-format
105324msgid "Line %s: Column \"Qty to Pick\" must be a number"
105325msgstr "Ligne %s: La Colonne \"Qté à prélever\" doit être un nombre"
105326
105327#. module: msf_supply_doc_export
105328#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:346
105329#, python-format
105330msgid "File line %s: Column \"Item\" must be an integer"
105331msgstr "Fichier ligne %s: La Colonne \"Article\" doit être un entier"
105313105332
=== modified file 'bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako'
--- bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako 2019-01-29 10:21:42 +0000
+++ bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako 2019-02-25 14:57:39 +0000
@@ -169,11 +169,15 @@
169 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.sale_line_id and move.sale_line_id.product_id != move.product_id and '[%s] %s' % (move.product_id.default_code, move.product_id.name) or '' | x}</Data></Cell>169 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.sale_line_id and move.sale_line_id.product_id != move.product_id and '[%s] %s' % (move.product_id.default_code, move.product_id.name) or '' | x}</Data></Cell>
170 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.comment or '' | x}</Data></Cell>170 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.comment or '' | x}</Data></Cell>
171 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.location_id.name or '' | x}</Data></Cell>171 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.location_id.name or '' | x}</Data></Cell>
172 <Cell ss:StyleID="line" ><Data ss:Type="String">${formatLang(getStock(m) or 0.00) | x}</Data></Cell>172 <Cell ss:StyleID="line" ><Data ss:Type="Number">${getStock(move) or 0.00}</Data></Cell>
173 <Cell ss:StyleID="line" ><Data ss:Type="Number">${move.product_qty or 0.00 | x}</Data></Cell>173 <Cell ss:StyleID="line" ><Data ss:Type="Number">${move.product_qty or 0.00 | x}</Data></Cell>
174 <Cell ss:StyleID="line" ><Data ss:Type="String">${0 | x}</Data></Cell>174 <Cell ss:StyleID="line" ><Data ss:Type="String">${0 | x}</Data></Cell>
175 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.prodlot_id and move.prodlot_id.name or '' | x}</Data></Cell>175 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.prodlot_id and move.prodlot_id.name or '' | x}</Data></Cell>
176 <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${move.expired_date or '' | n}T00:00:00.000</Data></Cell>176 % if move.expired_date and isDate(move.expired_date):
177 <Cell ss:StyleID="short_date"><Data ss:Type="DateTime">${move.expired_date or '' | n}T00:00:00.000</Data></Cell>
178 % else:
179 <Cell ss:StyleID="line"><Data ss:Type="String"></Data></Cell>
180 % endif
177 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.kc_check and _('Yes') or '' | x}</Data></Cell>181 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.kc_check and _('Yes') or '' | x}</Data></Cell>
178 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.dg_check and _('Yes') or '' | x}</Data></Cell>182 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.dg_check and _('Yes') or '' | x}</Data></Cell>
179 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.np_check and _('Yes') or '' | x}</Data></Cell>183 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.np_check and _('Yes') or '' | x}</Data></Cell>
180184
=== modified file 'bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py'
--- bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py 2019-02-15 10:46:11 +0000
+++ bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py 2019-02-25 14:57:39 +0000
@@ -60,6 +60,7 @@
60 'cs',60 'cs',
61]61]
6262
63
63class wizard_pick_import(osv.osv_memory):64class wizard_pick_import(osv.osv_memory):
64 _name = 'wizard.pick.import'65 _name = 'wizard.pick.import'
65 _description = 'PICK import wizard'66 _description = 'PICK import wizard'
@@ -68,24 +69,33 @@
68 'picking_id': fields.many2one('stock.picking', string="PICK ref", required=True),69 'picking_id': fields.many2one('stock.picking', string="PICK ref", required=True),
69 'picking_processor_id': fields.many2one('create.picking.processor', string="PICK processor ref"),70 'picking_processor_id': fields.many2one('create.picking.processor', string="PICK processor ref"),
70 'validate_processor_id': fields.many2one('validate.picking.processor', string="PICK processor ref"),71 'validate_processor_id': fields.many2one('validate.picking.processor', string="PICK processor ref"),
71 'import_file': fields.binary('PICK import file'),72 'import_file': fields.binary('PICK import file', required=True),
72 }73 }
7374
7475 def normalize_data(self, cr, uid, data):
75 def normalize_data(self, cr, uid, data, xls_line_number):76 if 'qty_picked' in data: # set to float
76 if 'qty_picked' in data: # set to float
77 if not data['qty_picked']:77 if not data['qty_picked']:
78 data['qty_picked'] = 0.078 data['qty_picked'] = 0.0
79 if isinstance(data['qty_picked'], (str,unicode)):79 if isinstance(data['qty_picked'], (str,unicode)):
80 data['qty_picked'] = float(data['qty_picked'])80 try:
81 data['qty_picked'] = float(data['qty_picked'])
82 except:
83 raise osv.except_osv(
84 _('Error'), _('Line %s: Column "Qty Picked" must be a number') % data['item']
85 )
8186
82 if 'qty_to_pick' in data: # set to float87 if 'qty_to_pick' in data: # set to float
83 if not data['qty_to_pick']:88 if not data['qty_to_pick']:
84 data['qty_to_pick'] = 0.089 data['qty_to_pick'] = 0.0
85 if isinstance(data['qty_to_pick'], (str,unicode)):90 if isinstance(data['qty_to_pick'], (str,unicode)):
86 data['qty_to_pick'] = float(data['qty_to_pick'])91 try:
92 data['qty_to_pick'] = float(data['qty_to_pick'])
93 except:
94 raise osv.except_osv(
95 _('Error'), _('Line %s: Column "Qty to Pick" must be a number') % data['item']
96 )
8797
88 if 'batch' in data: # set to str98 if 'batch' in data: # set to str
89 if not data['batch']:99 if not data['batch']:
90 data['batch'] = ''100 data['batch'] = ''
91101
@@ -97,18 +107,17 @@
97 data['expiry_date'] = datetime(data['expiry_date'].year, data['expiry_date'].month, data['expiry_date'].day)107 data['expiry_date'] = datetime(data['expiry_date'].year, data['expiry_date'].month, data['expiry_date'].day)
98 except:108 except:
99 raise osv.except_osv(109 raise osv.except_osv(
100 _('Error'), _('Line %s: Column "Expiry Date" must be a date') % xls_line_number110 _('Error'), _('Line %s: Column "Expiry Date" must be a date') % data['item']
101 )111 )
102112
103 if data['qty_picked'] > data['qty_to_pick']:113 if data['qty_picked'] > data['qty_to_pick']:
104 raise osv.except_osv(114 raise osv.except_osv(
105 _('Error'),115 _('Error'),
106 _('Line %s: Column "Qty Picked" cannot be greater than "Qty to pick"') % xls_line_number116 _('Line %s: Column "Qty Picked" cannot be greater than "Qty to pick"') % data['item']
107 )117 )
108118
109 return data119 return data
110120
111
112 def cancel(self, cr, uid, ids, context=None):121 def cancel(self, cr, uid, ids, context=None):
113 if context is None:122 if context is None:
114 context = {}123 context = {}
@@ -125,7 +134,6 @@
125 'context': context,134 'context': context,
126 }135 }
127136
128
129 def get_matching_move(self, cr, uid, ids, wizard_id, move_proc_model, xls_line_number, line_data, product_id, location_id, picking_id, context=None):137 def get_matching_move(self, cr, uid, ids, wizard_id, move_proc_model, xls_line_number, line_data, product_id, location_id, picking_id, context=None):
130 if context is None:138 if context is None:
131 context = {}139 context = {}
@@ -191,28 +199,26 @@
191 else:199 else:
192 raise osv.except_osv(200 raise osv.except_osv(
193 _('Error'),201 _('Error'),
194 _('Line %s: Matching move not found') % xls_line_number202 _('Line %s: Matching move not found') % line_data['item']
195 )203 )
196204
197 return move_proc_ids[0]205 return move_proc_ids[0]
198206
199207 def checks_on_batch(self, cr, uid, ids, move_proc, line_data, context=None):
200 def checks_on_batch(self, cr, uid, ids, move_proc, line_data, xls_line_number, context=None):
201 if context is None:208 if context is None:
202 context = {}209 context = {}
203210
204 if move_proc.product_id.batch_management and not line_data['batch']:211 if move_proc.product_id.batch_management and not line_data['batch']:
205 raise osv.except_osv(212 raise osv.except_osv(
206 _('Error'),213 _('Error'),
207 _('Line %s: Product is batch number mandatory and no batch number is given') % xls_line_number214 _('Line %s: Product is batch number mandatory and no batch number is given') % line_data['item']
208 )215 )
209 if not move_proc.product_id.batch_management and move_proc.product_id.perishable and not line_data['expiry_date']:216 if not move_proc.product_id.batch_management and move_proc.product_id.perishable and not line_data['expiry_date']:
210 raise osv.except_osv(217 raise osv.except_osv(
211 _('Error'),218 _('Error'),
212 _('Line %s: Product is expiry date mandatory and no expiry date is given') % xls_line_number219 _('Line %s: Product is expiry date mandatory and no expiry date is given') % line_data['item']
213 )220 )
214221
215
216 def get_import_data(self, cr, uid, ids, import_file, context=None):222 def get_import_data(self, cr, uid, ids, import_file, context=None):
217 if context is None:223 if context is None:
218 context = {}224 context = {}
@@ -289,7 +295,7 @@
289295
290 import_data = {}296 import_data = {}
291 for xls_line_number, line_data in sorted(import_data_lines.items()):297 for xls_line_number, line_data in sorted(import_data_lines.items()):
292 line_data = self.normalize_data(cr, uid, line_data, xls_line_number)298 line_data = self.normalize_data(cr, uid, line_data)
293299
294 if line_data['item'] in ln_with_cancelled: # ignore cancelled/done lines300 if line_data['item'] in ln_with_cancelled: # ignore cancelled/done lines
295 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)301 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)
@@ -315,12 +321,13 @@
315 _('The total quantity of line #%s in the import file doesn\'t match with the total qty on screen') % ln321 _('The total quantity of line #%s in the import file doesn\'t match with the total qty on screen') % ln
316 )322 )
317323
318
319 def import_pick_xls(self, cr, uid, ids, context=None):324 def import_pick_xls(self, cr, uid, ids, context=None):
320 if context is None:325 if context is None:
321 context = {}326 context = {}
322327
323 wiz = self.browse(cr, uid, ids[0], context=context)328 wiz = self.browse(cr, uid, ids[0], context=context)
329 if not wiz.import_file:
330 raise osv.except_osv(_('Error'), _('No file to import'))
324 import_file = SpreadsheetXML(xmlstring=base64.decodestring(wiz.import_file))331 import_file = SpreadsheetXML(xmlstring=base64.decodestring(wiz.import_file))
325 res_model = 'create.picking.processor' if wiz.picking_processor_id else 'validate.picking.processor'332 res_model = 'create.picking.processor' if wiz.picking_processor_id else 'validate.picking.processor'
326 move_proc_model = 'create.picking.move.processor' if wiz.picking_processor_id else 'validate.move.processor'333 move_proc_model = 'create.picking.move.processor' if wiz.picking_processor_id else 'validate.move.processor'
@@ -335,10 +342,15 @@
335 self.check_matching_qty_per_line_number(cr, uid, ids, import_data_lines, wiz, context=context)342 self.check_matching_qty_per_line_number(cr, uid, ids, import_data_lines, wiz, context=context)
336343
337 for xls_line_number, line_data in sorted(import_data_lines.items()):344 for xls_line_number, line_data in sorted(import_data_lines.items()):
345 try:
346 line_data['item'] = int(line_data['item'])
347 except:
348 raise osv.except_osv(_('Error'), _('File line %s: Column "Item" must be an integer') % xls_line_number)
349
338 if line_data['qty_picked'] is None:350 if line_data['qty_picked'] is None:
339 raise osv.except_osv(_('Error'), _('Line %s: Column "Qty Picked" should contains the quantity to process and cannot be empty, please fill it with "0" instead') % xls_line_number)351 raise osv.except_osv(_('Error'), _('Line %s: Column "Qty Picked" should contains the quantity to process and cannot be empty, please fill it with "0" instead') % line_data['item'])
340352
341 line_data = self.normalize_data(cr, uid, line_data, xls_line_number)353 line_data = self.normalize_data(cr, uid, line_data)
342354
343 if line_data['qty_picked'] and line_data['qty_to_pick']:355 if line_data['qty_picked'] and line_data['qty_to_pick']:
344 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)356 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)
@@ -350,7 +362,7 @@
350 move_proc = self.pool.get(move_proc_model).browse(cr, uid, move_proc_id, context=context)362 move_proc = self.pool.get(move_proc_model).browse(cr, uid, move_proc_id, context=context)
351 to_write = {}363 to_write = {}
352364
353 self.checks_on_batch(cr, uid, ids, move_proc, line_data, xls_line_number, context=context)365 self.checks_on_batch(cr, uid, ids, move_proc, line_data, context=context)
354366
355 to_write['quantity'] = line_data['qty_picked']367 to_write['quantity'] = line_data['qty_picked']
356368
@@ -366,12 +378,12 @@
366 else:378 else:
367 raise osv.except_osv(379 raise osv.except_osv(
368 _('Error'),380 _('Error'),
369 _('Line %s: Given batch number with this expiry date doesn\'t exists in database') % xls_line_number381 _('Line %s: The given batch number with this expiry date doesn\'t exist in database') % line_data['item']
370 )382 )
371 else:383 else:
372 raise osv.except_osv(_('Error'),384 raise osv.except_osv(_('Error'),
373 _('Line %s: Product %s must have a batch number and an expiry date')385 _('Line %s: Product %s must have a batch number and an expiry date')
374 % (xls_line_number, line_data['code']))386 % (line_data['item'], line_data['code']))
375 elif not move_proc.product_id.batch_management and move_proc.product_id.perishable and line_data['expiry_date']:387 elif not move_proc.product_id.batch_management and move_proc.product_id.perishable and line_data['expiry_date']:
376 prodlot_ids = self.pool.get('stock.production.lot').search(cr, uid, [388 prodlot_ids = self.pool.get('stock.production.lot').search(cr, uid, [
377 ('life_date', '=', line_data['expiry_date']),389 ('life_date', '=', line_data['expiry_date']),
@@ -383,7 +395,7 @@
383 else:395 else:
384 raise osv.except_osv(396 raise osv.except_osv(
385 _('Error'),397 _('Error'),
386 _('Line %s: Given expiry date doesn\'t exists in database') % xls_line_number398 _('Line %s: The given expiry date doesn\'t exist in database') % line_data['item']
387 )399 )
388400
389 self.pool.get(move_proc_model).write(cr, uid, [move_proc.id], to_write, context=context)401 self.pool.get(move_proc_model).write(cr, uid, [move_proc.id], to_write, context=context)

Subscribers

People subscribed via source and target branches