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

Proposed by jftempo
Status: Merged
Merged at revision: 6085
Proposed branch: lp:~dorian-kemps/unifield-server/US-9110
Merge into: lp:unifield-server
Diff against target: 251 lines (+58/-68)
2 files modified
bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py (+40/-34)
bin/addons/msf_profile/i18n/fr_MF.po (+18/-34)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-9110
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+409651@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_doc_import/wizard/wizard_return_from_unit_import.py'
2--- bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py 2021-08-09 10:20:01 +0000
3+++ bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py 2021-10-05 14:45:55 +0000
4@@ -92,8 +92,8 @@
5 header_message += _('\nYou must fill "To" with an Internal location.')
6
7 lines = []
8- line_warn = []
9- line_err = []
10+ lines_err = []
11+ lines_warn = []
12 message = ''
13 db_datetime_format = self.pool.get('date.tools').get_db_datetime_format(cr, uid, context=context)
14 today = time.strftime(db_datetime_format)
15@@ -103,15 +103,16 @@
16 if not cell[1].value: # Stop looking at lines if there is no product
17 break
18 line = def_line.copy()
19+ line_err = ''
20+ line_warn = ''
21
22 line_num = cell[0].row or ''
23
24 # Product Code and BN/ED
25- prod = False
26 prod_name = cell[1].value
27 prod_ids = prod_obj.search(cr, uid, [('default_code', '=ilike', prod_name)], context=context)
28 if not prod_ids:
29- line_err.append(_('Line %s: There is no active product %s. ') % (line_num, prod_name))
30+ lines.append([{}, _('Line %s: There is no active product %s. ') % (line_num, prod_name), ''])
31 continue
32
33 ftf = ['name', 'list_price', 'uom_id', 'perishable', 'batch_management']
34@@ -122,26 +123,20 @@
35 if prod.batch_management or prod.perishable:
36 bn_name = cell[5].value
37 ed = cell[6].value
38- if prod.batch_management and not bn_name:
39- line_err.append(_('Line: %s: The Batch Number is mandatory for %s. ') % (line_num, prod_name))
40- continue
41 if prod.perishable:
42- if not ed:
43- line_err.append(_('Line %s: The Expiry Date is mandatory for %s. ') % (line_num, prod_name))
44- continue
45- elif cell[6].data_type != 'd' or not cell[6].is_date:
46- line_err.append(_('Line %s %s: The Expiry Date must be a date.') % (line_num, prod_name))
47- continue
48+ if ed and (cell[6].data_type != 'd' or not cell[6].is_date):
49+ line_warn += _('%s: The Expiry Date must be a date.') % (prod_name, )
50+ ed = False
51 if not prod.batch_management and bn_name:
52- line_warn.append(_("Line %s %s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored") % (line_num, prod_name))
53+ line_warn += _("%s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored") % (prod_name, )
54 bn_name = False
55- try:
56- ed = ed.strftime('%Y-%m-%d') # Fix format
57- except ValueError:
58- line_err.append(_('Line %s %s the Expiry Date %s is not correct.') % (line_num, prod_name, ed))
59- continue
60+ if ed:
61+ try:
62+ ed = ed.strftime('%Y-%m-%d') # Fix format
63+ except ValueError:
64+ line_warn += _('%s the Expiry Date %s is not correct.') % (prod_name, ed)
65
66- if bn_name or ed:
67+ if (bn_name and ed) or ed:
68 bn_id = lot_obj._get_or_create_lot(cr, uid, bn_name, ed, prod.id, context=context)
69 line.update({'prodlot_id': bn_id, 'expired_date': ed})
70
71@@ -151,9 +146,9 @@
72 if cell[3].data_type == 'n':
73 line.update({'product_qty': qty})
74 else:
75- line_err.append(_('Line %s: The Quantity must be a number. ') % (line_num, ))
76+ line_err += _('The Quantity must be a number. ')
77 else:
78- line_err.append(_('Line %s: The Quantity is mandatory for each line. ') % (line_num, ))
79+ line_err += _('The Quantity is mandatory for each line. ')
80
81 # UoM
82 uom_name = cell[4].value
83@@ -164,37 +159,48 @@
84 # Check the uom category consistency
85 if prod and not self.pool.get('uom.tools').check_uom(cr, uid, prod.id, uom_id, context):
86 uom_id = prod.uom_id.id
87- line_err.append(_('Line %s: The UoM imported was not in the same category than the UoM of the product. The UoM of the product was taken instead. ') % (line_num, ))
88+ line_err += _('The UoM imported was not in the same category than the UoM of the product. The UoM of the product was taken instead. ')
89 line.update({'product_uom': uom_id})
90 else:
91- line_err.append(_('Line %s: The UoM is mandatory for each line. ') % (line_num, ))
92+ line_err += _('The UoM is mandatory for each line. ')
93
94 # Comment
95 if cell[7].value:
96 line.update({'comment': tools.ustr(cell[7].value)})
97
98- lines.append(line)
99+ if line_err:
100+ line_err = _('Line %s: ') % (line_num, ) + line_err
101+ if line_warn:
102+ line_warn = _('Line %s: ') % (line_num, ) + line_warn
103+ lines.append([line, line_err, line_warn])
104
105 wiz_state = 'done'
106- if not line_err and not header_message:
107- for line in lines:
108+ imp_lines = 0
109+ for line, line_err, line_warn in lines:
110+ if not line_err and not header_message:
111 self.pool.get('stock.move').create(cr, uid, line, context=context)
112- else:
113- if line_err:
114- message = '%s:\n%s' % (_('Errors'), "\n".join(line_err))
115+ imp_lines += 1
116+ elif line_err:
117+ lines_err.append(line_err)
118+ if line_warn:
119+ lines_warn.append(line_warn)
120+ if lines_err or header_message:
121+ if lines_err:
122+ message = '%s:\n%s' % (_('Errors'), "\n".join(lines_err))
123 wiz_state = 'error'
124
125 end_time = time.time()
126 total_time = str(round(end_time - start_time)) + _(' second(s)')
127 final_message = _('''
128 Importation completed in %s!
129-# of imported lines : %s lines
130+# of imported lines : %s on %s lines
131+# of ignored lines: %s
132 # of errors to correct: %s
133
134 %s
135-%s''') % (total_time, len(lines), len(line_err), header_message, message)
136- if line_warn:
137- final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(line_warn))
138+%s''') % (total_time, imp_lines, len(lines), len(lines) - imp_lines, len(lines_err), header_message, message)
139+ if lines_warn:
140+ final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(lines_warn))
141
142 self.write(cr, uid, wiz.id, {'state': wiz_state, 'message': final_message}, context=context)
143
144
145=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
146--- bin/addons/msf_profile/i18n/fr_MF.po 2021-08-25 14:50:30 +0000
147+++ bin/addons/msf_profile/i18n/fr_MF.po 2021-10-05 14:45:55 +0000
148@@ -112587,28 +112587,10 @@
149 "Vous devez remplir \"Vers\" avec une zone Interne."
150
151 #. module: msf_doc_import
152-#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:125
153-#, python-format
154-msgid "Line: %s: The Batch Number is mandatory for %s. "
155-msgstr "Ligne %s: Le Numéro de Lot est obligatoire pour %s. "
156-
157-#. module: msf_doc_import
158-#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:128
159-#, python-format
160-msgid "Line %s: The Expiry Date is mandatory for %s. "
161-msgstr "Ligne %s: La Date d'Expiration est obligatoire pour %s. "
162-
163-#. module: msf_doc_import
164-#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:139
165-#, python-format
166-msgid "No Batch Number was found with the name %s and the expiry date %s. "
167-msgstr "Aucun Numéro de Lot a été trouvé avec le nom %s et la date d'expiration %s. "
168-
169-#. module: msf_doc_import
170 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:151
171 #, python-format
172-msgid "Line %s %s: The Expiry Date must be a date."
173-msgstr "Ligne %s %s: La Date d'Expiration doit être une date. "
174+msgid "%s: The Expiry Date must be a date."
175+msgstr "%s: La Date d'Expiration doit être une date. "
176
177 #. module: msf_doc_import
178 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:154
179@@ -112619,26 +112601,26 @@
180 #. module: msf_doc_import
181 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:163
182 #, python-format
183-msgid "Line %s: The Quantity must be a number. "
184-msgstr "Ligne %s: La Quantité doit être un nombre. "
185+msgid "The Quantity must be a number. "
186+msgstr "La Quantité doit être un nombre. "
187
188 #. module: msf_doc_import
189 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:166
190 #, python-format
191-msgid "Line %s: The Quantity is mandatory for each line. "
192-msgstr "Ligne %s: La Quantité est obligatoire pour chaque ligne. "
193+msgid "The Quantity is mandatory for each line. "
194+msgstr "La Quantité est obligatoire pour chaque ligne. "
195
196 #. module: msf_doc_import
197 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:178
198 #, python-format
199-msgid "Line %s: The UoM imported was not in the same category than the UoM of the product. The UoM of the product was taken instead. "
200-msgstr "Ligne %s: l'UdM importée n'a pas la même catégorie que l'UdM du produit. L'UdM du produit sera utilisée à la place. "
201+msgid "The UoM imported was not in the same category than the UoM of the product. The UoM of the product was taken instead. "
202+msgstr "L'UdM importée n'a pas la même catégorie que l'UdM du produit. L'UdM du produit sera utilisée à la place. "
203
204 #. module: msf_doc_import
205 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:181
206 #, python-format
207-msgid "Line %s: The UoM is mandatory for each line. "
208-msgstr "Ligne %s: L'UdM est obligatoire pour chaque ligne. "
209+msgid "The UoM is mandatory for each line. "
210+msgstr "L'UdM est obligatoire pour chaque ligne. "
211
212 #. module: msf_doc_import
213 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:201
214@@ -112653,14 +112635,16 @@
215 #, python-format
216 msgid " \n"
217 "Importation completed in %s!\n"
218-"# of imported lines : %s lines\n"
219+"# of imported lines : %s on %s lines\n"
220+"# of ignored lines: %s\n"
221 "# of errors to correct: %s\n"
222 "\n"
223 "%s\n"
224 "%s"
225 msgstr " \n"
226 "Import effectué en %s!\n"
227-"# de lignes importées : %s lignes\n"
228+"# de lignes importées : %s sur %s lignes\n"
229+"# de lignes ignorées: %s\n"
230 "# d'erreurs à corriger: %s\n"
231 "\n"
232 "%s\n"
233@@ -112717,14 +112701,14 @@
234 #. module: msf_doc_import
235 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:141
236 #, python-format
237-msgid "Line %s %s the Expiry Date %s is not correct."
238-msgstr "Ligne %s %s la Date d'Expiration %s est incorrecte."
239+msgid "%s the Expiry Date %s is not correct."
240+msgstr "%s la Date d'Expiration %s est incorrecte."
241
242 #. module: msf_doc_import
243 #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:136
244 #, python-format
245-msgid "Line %s %s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored"
246-msgstr "Ligne %s %s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré"
247+msgid "%s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored"
248+msgstr "%s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré"
249
250 #. modules: msf_order_date, purchase
251 #: code:addons/msf_order_date/order_dates.py:696

Subscribers

People subscribed via source and target branches