Merge lp:~dorian-kemps/unifield-server/US-9110 into lp:unifield-server
- US-9110
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email:
|
Commit message
Description of the change
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 | 92 | header_message += _('\nYou must fill "To" with an Internal location.') | 92 | header_message += _('\nYou must fill "To" with an Internal location.') |
6 | 93 | 93 | ||
7 | 94 | lines = [] | 94 | lines = [] |
10 | 95 | line_warn = [] | 95 | lines_err = [] |
11 | 96 | line_err = [] | 96 | lines_warn = [] |
12 | 97 | message = '' | 97 | message = '' |
13 | 98 | db_datetime_format = self.pool.get('date.tools').get_db_datetime_format(cr, uid, context=context) | 98 | db_datetime_format = self.pool.get('date.tools').get_db_datetime_format(cr, uid, context=context) |
14 | 99 | today = time.strftime(db_datetime_format) | 99 | today = time.strftime(db_datetime_format) |
15 | @@ -103,15 +103,16 @@ | |||
16 | 103 | if not cell[1].value: # Stop looking at lines if there is no product | 103 | if not cell[1].value: # Stop looking at lines if there is no product |
17 | 104 | break | 104 | break |
18 | 105 | line = def_line.copy() | 105 | line = def_line.copy() |
19 | 106 | line_err = '' | ||
20 | 107 | line_warn = '' | ||
21 | 106 | 108 | ||
22 | 107 | line_num = cell[0].row or '' | 109 | line_num = cell[0].row or '' |
23 | 108 | 110 | ||
24 | 109 | # Product Code and BN/ED | 111 | # Product Code and BN/ED |
25 | 110 | prod = False | ||
26 | 111 | prod_name = cell[1].value | 112 | prod_name = cell[1].value |
27 | 112 | prod_ids = prod_obj.search(cr, uid, [('default_code', '=ilike', prod_name)], context=context) | 113 | prod_ids = prod_obj.search(cr, uid, [('default_code', '=ilike', prod_name)], context=context) |
28 | 113 | if not prod_ids: | 114 | if not prod_ids: |
30 | 114 | line_err.append(_('Line %s: There is no active product %s. ') % (line_num, prod_name)) | 115 | lines.append([{}, _('Line %s: There is no active product %s. ') % (line_num, prod_name), '']) |
31 | 115 | continue | 116 | continue |
32 | 116 | 117 | ||
33 | 117 | ftf = ['name', 'list_price', 'uom_id', 'perishable', 'batch_management'] | 118 | ftf = ['name', 'list_price', 'uom_id', 'perishable', 'batch_management'] |
34 | @@ -122,26 +123,20 @@ | |||
35 | 122 | if prod.batch_management or prod.perishable: | 123 | if prod.batch_management or prod.perishable: |
36 | 123 | bn_name = cell[5].value | 124 | bn_name = cell[5].value |
37 | 124 | ed = cell[6].value | 125 | ed = cell[6].value |
38 | 125 | if prod.batch_management and not bn_name: | ||
39 | 126 | line_err.append(_('Line: %s: The Batch Number is mandatory for %s. ') % (line_num, prod_name)) | ||
40 | 127 | continue | ||
41 | 128 | if prod.perishable: | 126 | if prod.perishable: |
48 | 129 | if not ed: | 127 | if ed and (cell[6].data_type != 'd' or not cell[6].is_date): |
49 | 130 | line_err.append(_('Line %s: The Expiry Date is mandatory for %s. ') % (line_num, prod_name)) | 128 | line_warn += _('%s: The Expiry Date must be a date.') % (prod_name, ) |
50 | 131 | continue | 129 | ed = False |
45 | 132 | elif cell[6].data_type != 'd' or not cell[6].is_date: | ||
46 | 133 | line_err.append(_('Line %s %s: The Expiry Date must be a date.') % (line_num, prod_name)) | ||
47 | 134 | continue | ||
51 | 135 | if not prod.batch_management and bn_name: | 130 | if not prod.batch_management and bn_name: |
53 | 136 | 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)) | 131 | 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 | 137 | bn_name = False | 132 | bn_name = False |
60 | 138 | try: | 133 | if ed: |
61 | 139 | ed = ed.strftime('%Y-%m-%d') # Fix format | 134 | try: |
62 | 140 | except ValueError: | 135 | ed = ed.strftime('%Y-%m-%d') # Fix format |
63 | 141 | line_err.append(_('Line %s %s the Expiry Date %s is not correct.') % (line_num, prod_name, ed)) | 136 | except ValueError: |
64 | 142 | continue | 137 | line_warn += _('%s the Expiry Date %s is not correct.') % (prod_name, ed) |
65 | 143 | 138 | ||
67 | 144 | if bn_name or ed: | 139 | if (bn_name and ed) or ed: |
68 | 145 | bn_id = lot_obj._get_or_create_lot(cr, uid, bn_name, ed, prod.id, context=context) | 140 | bn_id = lot_obj._get_or_create_lot(cr, uid, bn_name, ed, prod.id, context=context) |
69 | 146 | line.update({'prodlot_id': bn_id, 'expired_date': ed}) | 141 | line.update({'prodlot_id': bn_id, 'expired_date': ed}) |
70 | 147 | 142 | ||
71 | @@ -151,9 +146,9 @@ | |||
72 | 151 | if cell[3].data_type == 'n': | 146 | if cell[3].data_type == 'n': |
73 | 152 | line.update({'product_qty': qty}) | 147 | line.update({'product_qty': qty}) |
74 | 153 | else: | 148 | else: |
76 | 154 | line_err.append(_('Line %s: The Quantity must be a number. ') % (line_num, )) | 149 | line_err += _('The Quantity must be a number. ') |
77 | 155 | else: | 150 | else: |
79 | 156 | line_err.append(_('Line %s: The Quantity is mandatory for each line. ') % (line_num, )) | 151 | line_err += _('The Quantity is mandatory for each line. ') |
80 | 157 | 152 | ||
81 | 158 | # UoM | 153 | # UoM |
82 | 159 | uom_name = cell[4].value | 154 | uom_name = cell[4].value |
83 | @@ -164,37 +159,48 @@ | |||
84 | 164 | # Check the uom category consistency | 159 | # Check the uom category consistency |
85 | 165 | if prod and not self.pool.get('uom.tools').check_uom(cr, uid, prod.id, uom_id, context): | 160 | if prod and not self.pool.get('uom.tools').check_uom(cr, uid, prod.id, uom_id, context): |
86 | 166 | uom_id = prod.uom_id.id | 161 | uom_id = prod.uom_id.id |
88 | 167 | 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, )) | 162 | 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 | 168 | line.update({'product_uom': uom_id}) | 163 | line.update({'product_uom': uom_id}) |
90 | 169 | else: | 164 | else: |
92 | 170 | line_err.append(_('Line %s: The UoM is mandatory for each line. ') % (line_num, )) | 165 | line_err += _('The UoM is mandatory for each line. ') |
93 | 171 | 166 | ||
94 | 172 | # Comment | 167 | # Comment |
95 | 173 | if cell[7].value: | 168 | if cell[7].value: |
96 | 174 | line.update({'comment': tools.ustr(cell[7].value)}) | 169 | line.update({'comment': tools.ustr(cell[7].value)}) |
97 | 175 | 170 | ||
99 | 176 | lines.append(line) | 171 | if line_err: |
100 | 172 | line_err = _('Line %s: ') % (line_num, ) + line_err | ||
101 | 173 | if line_warn: | ||
102 | 174 | line_warn = _('Line %s: ') % (line_num, ) + line_warn | ||
103 | 175 | lines.append([line, line_err, line_warn]) | ||
104 | 177 | 176 | ||
105 | 178 | wiz_state = 'done' | 177 | wiz_state = 'done' |
108 | 179 | if not line_err and not header_message: | 178 | imp_lines = 0 |
109 | 180 | for line in lines: | 179 | for line, line_err, line_warn in lines: |
110 | 180 | if not line_err and not header_message: | ||
111 | 181 | self.pool.get('stock.move').create(cr, uid, line, context=context) | 181 | self.pool.get('stock.move').create(cr, uid, line, context=context) |
115 | 182 | else: | 182 | imp_lines += 1 |
116 | 183 | if line_err: | 183 | elif line_err: |
117 | 184 | message = '%s:\n%s' % (_('Errors'), "\n".join(line_err)) | 184 | lines_err.append(line_err) |
118 | 185 | if line_warn: | ||
119 | 186 | lines_warn.append(line_warn) | ||
120 | 187 | if lines_err or header_message: | ||
121 | 188 | if lines_err: | ||
122 | 189 | message = '%s:\n%s' % (_('Errors'), "\n".join(lines_err)) | ||
123 | 185 | wiz_state = 'error' | 190 | wiz_state = 'error' |
124 | 186 | 191 | ||
125 | 187 | end_time = time.time() | 192 | end_time = time.time() |
126 | 188 | total_time = str(round(end_time - start_time)) + _(' second(s)') | 193 | total_time = str(round(end_time - start_time)) + _(' second(s)') |
127 | 189 | final_message = _(''' | 194 | final_message = _(''' |
128 | 190 | Importation completed in %s! | 195 | Importation completed in %s! |
130 | 191 | # of imported lines : %s lines | 196 | # of imported lines : %s on %s lines |
131 | 197 | # of ignored lines: %s | ||
132 | 192 | # of errors to correct: %s | 198 | # of errors to correct: %s |
133 | 193 | 199 | ||
134 | 194 | %s | 200 | %s |
138 | 195 | %s''') % (total_time, len(lines), len(line_err), header_message, message) | 201 | %s''') % (total_time, imp_lines, len(lines), len(lines) - imp_lines, len(lines_err), header_message, message) |
139 | 196 | if line_warn: | 202 | if lines_warn: |
140 | 197 | final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(line_warn)) | 203 | final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(lines_warn)) |
141 | 198 | 204 | ||
142 | 199 | self.write(cr, uid, wiz.id, {'state': wiz_state, 'message': final_message}, context=context) | 205 | self.write(cr, uid, wiz.id, {'state': wiz_state, 'message': final_message}, context=context) |
143 | 200 | 206 | ||
144 | 201 | 207 | ||
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 | 112587 | "Vous devez remplir \"Vers\" avec une zone Interne." | 112587 | "Vous devez remplir \"Vers\" avec une zone Interne." |
150 | 112588 | 112588 | ||
151 | 112589 | #. module: msf_doc_import | 112589 | #. module: msf_doc_import |
152 | 112590 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:125 | ||
153 | 112591 | #, python-format | ||
154 | 112592 | msgid "Line: %s: The Batch Number is mandatory for %s. " | ||
155 | 112593 | msgstr "Ligne %s: Le Numéro de Lot est obligatoire pour %s. " | ||
156 | 112594 | |||
157 | 112595 | #. module: msf_doc_import | ||
158 | 112596 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:128 | ||
159 | 112597 | #, python-format | ||
160 | 112598 | msgid "Line %s: The Expiry Date is mandatory for %s. " | ||
161 | 112599 | msgstr "Ligne %s: La Date d'Expiration est obligatoire pour %s. " | ||
162 | 112600 | |||
163 | 112601 | #. module: msf_doc_import | ||
164 | 112602 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:139 | ||
165 | 112603 | #, python-format | ||
166 | 112604 | msgid "No Batch Number was found with the name %s and the expiry date %s. " | ||
167 | 112605 | msgstr "Aucun Numéro de Lot a été trouvé avec le nom %s et la date d'expiration %s. " | ||
168 | 112606 | |||
169 | 112607 | #. module: msf_doc_import | ||
170 | 112608 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:151 | 112590 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:151 |
171 | 112609 | #, python-format | 112591 | #, python-format |
174 | 112610 | msgid "Line %s %s: The Expiry Date must be a date." | 112592 | msgid "%s: The Expiry Date must be a date." |
175 | 112611 | msgstr "Ligne %s %s: La Date d'Expiration doit être une date. " | 112593 | msgstr "%s: La Date d'Expiration doit être une date. " |
176 | 112612 | 112594 | ||
177 | 112613 | #. module: msf_doc_import | 112595 | #. module: msf_doc_import |
178 | 112614 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:154 | 112596 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:154 |
179 | @@ -112619,26 +112601,26 @@ | |||
180 | 112619 | #. module: msf_doc_import | 112601 | #. module: msf_doc_import |
181 | 112620 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:163 | 112602 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:163 |
182 | 112621 | #, python-format | 112603 | #, python-format |
185 | 112622 | msgid "Line %s: The Quantity must be a number. " | 112604 | msgid "The Quantity must be a number. " |
186 | 112623 | msgstr "Ligne %s: La Quantité doit être un nombre. " | 112605 | msgstr "La Quantité doit être un nombre. " |
187 | 112624 | 112606 | ||
188 | 112625 | #. module: msf_doc_import | 112607 | #. module: msf_doc_import |
189 | 112626 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:166 | 112608 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:166 |
190 | 112627 | #, python-format | 112609 | #, python-format |
193 | 112628 | msgid "Line %s: The Quantity is mandatory for each line. " | 112610 | msgid "The Quantity is mandatory for each line. " |
194 | 112629 | msgstr "Ligne %s: La Quantité est obligatoire pour chaque ligne. " | 112611 | msgstr "La Quantité est obligatoire pour chaque ligne. " |
195 | 112630 | 112612 | ||
196 | 112631 | #. module: msf_doc_import | 112613 | #. module: msf_doc_import |
197 | 112632 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:178 | 112614 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:178 |
198 | 112633 | #, python-format | 112615 | #, python-format |
201 | 112634 | 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. " | 112616 | 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 | 112635 | 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. " | 112617 | 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 | 112636 | 112618 | ||
204 | 112637 | #. module: msf_doc_import | 112619 | #. module: msf_doc_import |
205 | 112638 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:181 | 112620 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:181 |
206 | 112639 | #, python-format | 112621 | #, python-format |
209 | 112640 | msgid "Line %s: The UoM is mandatory for each line. " | 112622 | msgid "The UoM is mandatory for each line. " |
210 | 112641 | msgstr "Ligne %s: L'UdM est obligatoire pour chaque ligne. " | 112623 | msgstr "L'UdM est obligatoire pour chaque ligne. " |
211 | 112642 | 112624 | ||
212 | 112643 | #. module: msf_doc_import | 112625 | #. module: msf_doc_import |
213 | 112644 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:201 | 112626 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:201 |
214 | @@ -112653,14 +112635,16 @@ | |||
215 | 112653 | #, python-format | 112635 | #, python-format |
216 | 112654 | msgid " \n" | 112636 | msgid " \n" |
217 | 112655 | "Importation completed in %s!\n" | 112637 | "Importation completed in %s!\n" |
219 | 112656 | "# of imported lines : %s lines\n" | 112638 | "# of imported lines : %s on %s lines\n" |
220 | 112639 | "# of ignored lines: %s\n" | ||
221 | 112657 | "# of errors to correct: %s\n" | 112640 | "# of errors to correct: %s\n" |
222 | 112658 | "\n" | 112641 | "\n" |
223 | 112659 | "%s\n" | 112642 | "%s\n" |
224 | 112660 | "%s" | 112643 | "%s" |
225 | 112661 | msgstr " \n" | 112644 | msgstr " \n" |
226 | 112662 | "Import effectué en %s!\n" | 112645 | "Import effectué en %s!\n" |
228 | 112663 | "# de lignes importées : %s lignes\n" | 112646 | "# de lignes importées : %s sur %s lignes\n" |
229 | 112647 | "# de lignes ignorées: %s\n" | ||
230 | 112664 | "# d'erreurs à corriger: %s\n" | 112648 | "# d'erreurs à corriger: %s\n" |
231 | 112665 | "\n" | 112649 | "\n" |
232 | 112666 | "%s\n" | 112650 | "%s\n" |
233 | @@ -112717,14 +112701,14 @@ | |||
234 | 112717 | #. module: msf_doc_import | 112701 | #. module: msf_doc_import |
235 | 112718 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:141 | 112702 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:141 |
236 | 112719 | #, python-format | 112703 | #, python-format |
239 | 112720 | msgid "Line %s %s the Expiry Date %s is not correct." | 112704 | msgid "%s the Expiry Date %s is not correct." |
240 | 112721 | msgstr "Ligne %s %s la Date d'Expiration %s est incorrecte." | 112705 | msgstr "%s la Date d'Expiration %s est incorrecte." |
241 | 112722 | 112706 | ||
242 | 112723 | #. module: msf_doc_import | 112707 | #. module: msf_doc_import |
243 | 112724 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:136 | 112708 | #: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:136 |
244 | 112725 | #, python-format | 112709 | #, python-format |
247 | 112726 | msgid "Line %s %s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored" | 112710 | msgid "%s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored" |
248 | 112727 | msgstr "Ligne %s %s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré" | 112711 | msgstr "%s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré" |
249 | 112728 | 112712 | ||
250 | 112729 | #. modules: msf_order_date, purchase | 112713 | #. modules: msf_order_date, purchase |
251 | 112730 | #: code:addons/msf_order_date/order_dates.py:696 | 112714 | #: code:addons/msf_order_date/order_dates.py:696 |