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
1=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
2--- bin/addons/msf_profile/i18n/fr_MF.po 2019-02-19 14:49:35 +0000
3+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-02-25 14:57:39 +0000
4@@ -62807,12 +62807,13 @@
5 msgid "Virgin Islands (British)"
6 msgstr "Iles Vierges (Britanniques)"
7
8-#. modules: msf_doc_import, kit, sale
9+#. modules: msf_doc_import, kit, sale, msf_supply_doc_export
10 #: code:addons/kit/wizard/kit_mass_import.py:210
11 #: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:527
12 #: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:540
13 #: code:addons/sale/wizard/internal_request_import.py:162
14 #: code:addons/sale/wizard/internal_request_import.py:222
15+#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:330
16 #, python-format
17 msgid "No file to import"
18 msgstr "Aucun fichier à importer"
19@@ -105002,13 +105003,13 @@
20 #. module: msf_supply_doc_export
21 #: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:209
22 #, python-format
23-msgid "Line %s: Given batch number with this expiry date doesn't exists in database"
24+msgid "Line %s: The given batch number with this expiry date doesn't exist in database"
25 msgstr "Ligne %s: Le numéro de lot avec cette date d'expiration n'existe pas en base"
26
27 #. module: msf_supply_doc_export
28 #: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:222
29 #, python-format
30-msgid "Line %s: Given expiry date doesn't exists in database"
31+msgid "Line %s: The given expiry date doesn't exist in database"
32 msgstr "Ligne %s: La date d'expiration donnée n'existe pas en base"
33
34 #. module: msf_doc_import
35@@ -105310,3 +105311,21 @@
36 #, python-format
37 msgid "Document date (%s) should be in posting date FY"
38 msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation"
39+
40+#. module: msf_supply_doc_export
41+#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:84
42+#, python-format
43+msgid "Line %s: Column \"Qty Picked\" must be a number"
44+msgstr "Ligne %s: La Colonne \"Qté prélevée\" doit être un nombre"
45+
46+#. module: msf_supply_doc_export
47+#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:95
48+#, python-format
49+msgid "Line %s: Column \"Qty to Pick\" must be a number"
50+msgstr "Ligne %s: La Colonne \"Qté à prélever\" doit être un nombre"
51+
52+#. module: msf_supply_doc_export
53+#: code:addons/msf_supply_doc_export/wizard/wizard_pick_import.py:346
54+#, python-format
55+msgid "File line %s: Column \"Item\" must be an integer"
56+msgstr "Fichier ligne %s: La Colonne \"Article\" doit être un entier"
57
58=== modified file 'bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako'
59--- bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako 2019-01-29 10:21:42 +0000
60+++ bin/addons/msf_supply_doc_export/report/report_pick_export_xls.mako 2019-02-25 14:57:39 +0000
61@@ -169,11 +169,15 @@
62 <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>
63 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.comment or '' | x}</Data></Cell>
64 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.location_id.name or '' | x}</Data></Cell>
65- <Cell ss:StyleID="line" ><Data ss:Type="String">${formatLang(getStock(m) or 0.00) | x}</Data></Cell>
66+ <Cell ss:StyleID="line" ><Data ss:Type="Number">${getStock(move) or 0.00}</Data></Cell>
67 <Cell ss:StyleID="line" ><Data ss:Type="Number">${move.product_qty or 0.00 | x}</Data></Cell>
68 <Cell ss:StyleID="line" ><Data ss:Type="String">${0 | x}</Data></Cell>
69 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.prodlot_id and move.prodlot_id.name or '' | x}</Data></Cell>
70- <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${move.expired_date or '' | n}T00:00:00.000</Data></Cell>
71+ % if move.expired_date and isDate(move.expired_date):
72+ <Cell ss:StyleID="short_date"><Data ss:Type="DateTime">${move.expired_date or '' | n}T00:00:00.000</Data></Cell>
73+ % else:
74+ <Cell ss:StyleID="line"><Data ss:Type="String"></Data></Cell>
75+ % endif
76 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.kc_check and _('Yes') or '' | x}</Data></Cell>
77 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.dg_check and _('Yes') or '' | x}</Data></Cell>
78 <Cell ss:StyleID="line" ><Data ss:Type="String">${move.np_check and _('Yes') or '' | x}</Data></Cell>
79
80=== modified file 'bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py'
81--- bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py 2019-02-15 10:46:11 +0000
82+++ bin/addons/msf_supply_doc_export/wizard/wizard_pick_import.py 2019-02-25 14:57:39 +0000
83@@ -60,6 +60,7 @@
84 'cs',
85 ]
86
87+
88 class wizard_pick_import(osv.osv_memory):
89 _name = 'wizard.pick.import'
90 _description = 'PICK import wizard'
91@@ -68,24 +69,33 @@
92 'picking_id': fields.many2one('stock.picking', string="PICK ref", required=True),
93 'picking_processor_id': fields.many2one('create.picking.processor', string="PICK processor ref"),
94 'validate_processor_id': fields.many2one('validate.picking.processor', string="PICK processor ref"),
95- 'import_file': fields.binary('PICK import file'),
96+ 'import_file': fields.binary('PICK import file', required=True),
97 }
98
99-
100- def normalize_data(self, cr, uid, data, xls_line_number):
101- if 'qty_picked' in data: # set to float
102+ def normalize_data(self, cr, uid, data):
103+ if 'qty_picked' in data: # set to float
104 if not data['qty_picked']:
105 data['qty_picked'] = 0.0
106 if isinstance(data['qty_picked'], (str,unicode)):
107- data['qty_picked'] = float(data['qty_picked'])
108+ try:
109+ data['qty_picked'] = float(data['qty_picked'])
110+ except:
111+ raise osv.except_osv(
112+ _('Error'), _('Line %s: Column "Qty Picked" must be a number') % data['item']
113+ )
114
115- if 'qty_to_pick' in data: # set to float
116+ if 'qty_to_pick' in data: # set to float
117 if not data['qty_to_pick']:
118 data['qty_to_pick'] = 0.0
119 if isinstance(data['qty_to_pick'], (str,unicode)):
120- data['qty_to_pick'] = float(data['qty_to_pick'])
121+ try:
122+ data['qty_to_pick'] = float(data['qty_to_pick'])
123+ except:
124+ raise osv.except_osv(
125+ _('Error'), _('Line %s: Column "Qty to Pick" must be a number') % data['item']
126+ )
127
128- if 'batch' in data: # set to str
129+ if 'batch' in data: # set to str
130 if not data['batch']:
131 data['batch'] = ''
132
133@@ -97,18 +107,17 @@
134 data['expiry_date'] = datetime(data['expiry_date'].year, data['expiry_date'].month, data['expiry_date'].day)
135 except:
136 raise osv.except_osv(
137- _('Error'), _('Line %s: Column "Expiry Date" must be a date') % xls_line_number
138+ _('Error'), _('Line %s: Column "Expiry Date" must be a date') % data['item']
139 )
140
141 if data['qty_picked'] > data['qty_to_pick']:
142 raise osv.except_osv(
143 _('Error'),
144- _('Line %s: Column "Qty Picked" cannot be greater than "Qty to pick"') % xls_line_number
145+ _('Line %s: Column "Qty Picked" cannot be greater than "Qty to pick"') % data['item']
146 )
147
148 return data
149
150-
151 def cancel(self, cr, uid, ids, context=None):
152 if context is None:
153 context = {}
154@@ -125,7 +134,6 @@
155 'context': context,
156 }
157
158-
159 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):
160 if context is None:
161 context = {}
162@@ -191,28 +199,26 @@
163 else:
164 raise osv.except_osv(
165 _('Error'),
166- _('Line %s: Matching move not found') % xls_line_number
167+ _('Line %s: Matching move not found') % line_data['item']
168 )
169
170 return move_proc_ids[0]
171
172-
173- def checks_on_batch(self, cr, uid, ids, move_proc, line_data, xls_line_number, context=None):
174+ def checks_on_batch(self, cr, uid, ids, move_proc, line_data, context=None):
175 if context is None:
176 context = {}
177
178 if move_proc.product_id.batch_management and not line_data['batch']:
179 raise osv.except_osv(
180 _('Error'),
181- _('Line %s: Product is batch number mandatory and no batch number is given') % xls_line_number
182+ _('Line %s: Product is batch number mandatory and no batch number is given') % line_data['item']
183 )
184 if not move_proc.product_id.batch_management and move_proc.product_id.perishable and not line_data['expiry_date']:
185 raise osv.except_osv(
186 _('Error'),
187- _('Line %s: Product is expiry date mandatory and no expiry date is given') % xls_line_number
188+ _('Line %s: Product is expiry date mandatory and no expiry date is given') % line_data['item']
189 )
190
191-
192 def get_import_data(self, cr, uid, ids, import_file, context=None):
193 if context is None:
194 context = {}
195@@ -289,7 +295,7 @@
196
197 import_data = {}
198 for xls_line_number, line_data in sorted(import_data_lines.items()):
199- line_data = self.normalize_data(cr, uid, line_data, xls_line_number)
200+ line_data = self.normalize_data(cr, uid, line_data)
201
202 if line_data['item'] in ln_with_cancelled: # ignore cancelled/done lines
203 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)
204@@ -315,12 +321,13 @@
205 _('The total quantity of line #%s in the import file doesn\'t match with the total qty on screen') % ln
206 )
207
208-
209 def import_pick_xls(self, cr, uid, ids, context=None):
210 if context is None:
211 context = {}
212
213 wiz = self.browse(cr, uid, ids[0], context=context)
214+ if not wiz.import_file:
215+ raise osv.except_osv(_('Error'), _('No file to import'))
216 import_file = SpreadsheetXML(xmlstring=base64.decodestring(wiz.import_file))
217 res_model = 'create.picking.processor' if wiz.picking_processor_id else 'validate.picking.processor'
218 move_proc_model = 'create.picking.move.processor' if wiz.picking_processor_id else 'validate.move.processor'
219@@ -335,10 +342,15 @@
220 self.check_matching_qty_per_line_number(cr, uid, ids, import_data_lines, wiz, context=context)
221
222 for xls_line_number, line_data in sorted(import_data_lines.items()):
223+ try:
224+ line_data['item'] = int(line_data['item'])
225+ except:
226+ raise osv.except_osv(_('Error'), _('File line %s: Column "Item" must be an integer') % xls_line_number)
227+
228 if line_data['qty_picked'] is None:
229- 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)
230+ 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'])
231
232- line_data = self.normalize_data(cr, uid, line_data, xls_line_number)
233+ line_data = self.normalize_data(cr, uid, line_data)
234
235 if line_data['qty_picked'] and line_data['qty_to_pick']:
236 product_id = self.get_product_id(cr, uid, ids, line_data, context=context)
237@@ -350,7 +362,7 @@
238 move_proc = self.pool.get(move_proc_model).browse(cr, uid, move_proc_id, context=context)
239 to_write = {}
240
241- self.checks_on_batch(cr, uid, ids, move_proc, line_data, xls_line_number, context=context)
242+ self.checks_on_batch(cr, uid, ids, move_proc, line_data, context=context)
243
244 to_write['quantity'] = line_data['qty_picked']
245
246@@ -366,12 +378,12 @@
247 else:
248 raise osv.except_osv(
249 _('Error'),
250- _('Line %s: Given batch number with this expiry date doesn\'t exists in database') % xls_line_number
251+ _('Line %s: The given batch number with this expiry date doesn\'t exist in database') % line_data['item']
252 )
253 else:
254 raise osv.except_osv(_('Error'),
255 _('Line %s: Product %s must have a batch number and an expiry date')
256- % (xls_line_number, line_data['code']))
257+ % (line_data['item'], line_data['code']))
258 elif not move_proc.product_id.batch_management and move_proc.product_id.perishable and line_data['expiry_date']:
259 prodlot_ids = self.pool.get('stock.production.lot').search(cr, uid, [
260 ('life_date', '=', line_data['expiry_date']),
261@@ -383,7 +395,7 @@
262 else:
263 raise osv.except_osv(
264 _('Error'),
265- _('Line %s: Given expiry date doesn\'t exists in database') % xls_line_number
266+ _('Line %s: The given expiry date doesn\'t exist in database') % line_data['item']
267 )
268
269 self.pool.get(move_proc_model).write(cr, uid, [move_proc.id], to_write, context=context)

Subscribers

People subscribed via source and target branches