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
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py'
--- bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py 2021-08-09 10:20:01 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_return_from_unit_import.py 2021-10-05 14:45:55 +0000
@@ -92,8 +92,8 @@
92 header_message += _('\nYou must fill "To" with an Internal location.')92 header_message += _('\nYou must fill "To" with an Internal location.')
9393
94 lines = []94 lines = []
95 line_warn = []95 lines_err = []
96 line_err = []96 lines_warn = []
97 message = ''97 message = ''
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)
99 today = time.strftime(db_datetime_format)99 today = time.strftime(db_datetime_format)
@@ -103,15 +103,16 @@
103 if not cell[1].value: # Stop looking at lines if there is no product103 if not cell[1].value: # Stop looking at lines if there is no product
104 break104 break
105 line = def_line.copy()105 line = def_line.copy()
106 line_err = ''
107 line_warn = ''
106108
107 line_num = cell[0].row or ''109 line_num = cell[0].row or ''
108110
109 # Product Code and BN/ED111 # Product Code and BN/ED
110 prod = False
111 prod_name = cell[1].value112 prod_name = cell[1].value
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)
113 if not prod_ids:114 if not prod_ids:
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), ''])
115 continue116 continue
116117
117 ftf = ['name', 'list_price', 'uom_id', 'perishable', 'batch_management']118 ftf = ['name', 'list_price', 'uom_id', 'perishable', 'batch_management']
@@ -122,26 +123,20 @@
122 if prod.batch_management or prod.perishable:123 if prod.batch_management or prod.perishable:
123 bn_name = cell[5].value124 bn_name = cell[5].value
124 ed = cell[6].value125 ed = cell[6].value
125 if prod.batch_management and not bn_name:
126 line_err.append(_('Line: %s: The Batch Number is mandatory for %s. ') % (line_num, prod_name))
127 continue
128 if prod.perishable:126 if prod.perishable:
129 if not ed:127 if ed and (cell[6].data_type != 'd' or not cell[6].is_date):
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, )
131 continue129 ed = False
132 elif cell[6].data_type != 'd' or not cell[6].is_date:
133 line_err.append(_('Line %s %s: The Expiry Date must be a date.') % (line_num, prod_name))
134 continue
135 if not prod.batch_management and bn_name:130 if not prod.batch_management and bn_name:
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, )
137 bn_name = False132 bn_name = False
138 try:133 if ed:
139 ed = ed.strftime('%Y-%m-%d') # Fix format134 try:
140 except ValueError:135 ed = ed.strftime('%Y-%m-%d') # Fix format
141 line_err.append(_('Line %s %s the Expiry Date %s is not correct.') % (line_num, prod_name, ed))136 except ValueError:
142 continue137 line_warn += _('%s the Expiry Date %s is not correct.') % (prod_name, ed)
143138
144 if bn_name or ed:139 if (bn_name and ed) or ed:
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)
146 line.update({'prodlot_id': bn_id, 'expired_date': ed})141 line.update({'prodlot_id': bn_id, 'expired_date': ed})
147142
@@ -151,9 +146,9 @@
151 if cell[3].data_type == 'n':146 if cell[3].data_type == 'n':
152 line.update({'product_qty': qty})147 line.update({'product_qty': qty})
153 else:148 else:
154 line_err.append(_('Line %s: The Quantity must be a number. ') % (line_num, ))149 line_err += _('The Quantity must be a number. ')
155 else:150 else:
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. ')
157152
158 # UoM153 # UoM
159 uom_name = cell[4].value154 uom_name = cell[4].value
@@ -164,37 +159,48 @@
164 # Check the uom category consistency159 # Check the uom category consistency
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):
166 uom_id = prod.uom_id.id161 uom_id = prod.uom_id.id
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. ')
168 line.update({'product_uom': uom_id})163 line.update({'product_uom': uom_id})
169 else:164 else:
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. ')
171166
172 # Comment167 # Comment
173 if cell[7].value:168 if cell[7].value:
174 line.update({'comment': tools.ustr(cell[7].value)})169 line.update({'comment': tools.ustr(cell[7].value)})
175170
176 lines.append(line)171 if line_err:
172 line_err = _('Line %s: ') % (line_num, ) + line_err
173 if line_warn:
174 line_warn = _('Line %s: ') % (line_num, ) + line_warn
175 lines.append([line, line_err, line_warn])
177176
178 wiz_state = 'done'177 wiz_state = 'done'
179 if not line_err and not header_message:178 imp_lines = 0
180 for line in lines:179 for line, line_err, line_warn in lines:
180 if not line_err and not header_message:
181 self.pool.get('stock.move').create(cr, uid, line, context=context)181 self.pool.get('stock.move').create(cr, uid, line, context=context)
182 else:182 imp_lines += 1
183 if line_err:183 elif line_err:
184 message = '%s:\n%s' % (_('Errors'), "\n".join(line_err))184 lines_err.append(line_err)
185 if line_warn:
186 lines_warn.append(line_warn)
187 if lines_err or header_message:
188 if lines_err:
189 message = '%s:\n%s' % (_('Errors'), "\n".join(lines_err))
185 wiz_state = 'error'190 wiz_state = 'error'
186191
187 end_time = time.time()192 end_time = time.time()
188 total_time = str(round(end_time - start_time)) + _(' second(s)')193 total_time = str(round(end_time - start_time)) + _(' second(s)')
189 final_message = _(''' 194 final_message = _('''
190Importation completed in %s!195Importation completed in %s!
191# of imported lines : %s lines196# of imported lines : %s on %s lines
197# of ignored lines: %s
192# of errors to correct: %s198# of errors to correct: %s
193199
194%s200%s
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)
196 if line_warn:202 if lines_warn:
197 final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(line_warn))203 final_message += "\n%s:\n%s" % (_('Warning'), "\n".join(lines_warn))
198204
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)
200206
201207
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2021-08-25 14:50:30 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2021-10-05 14:45:55 +0000
@@ -112587,28 +112587,10 @@
112587"Vous devez remplir \"Vers\" avec une zone Interne."112587"Vous devez remplir \"Vers\" avec une zone Interne."
112588112588
112589#. module: msf_doc_import112589#. module: msf_doc_import
112590#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:125
112591#, python-format
112592msgid "Line: %s: The Batch Number is mandatory for %s. "
112593msgstr "Ligne %s: Le Numéro de Lot est obligatoire pour %s. "
112594
112595#. module: msf_doc_import
112596#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:128
112597#, python-format
112598msgid "Line %s: The Expiry Date is mandatory for %s. "
112599msgstr "Ligne %s: La Date d'Expiration est obligatoire pour %s. "
112600
112601#. module: msf_doc_import
112602#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:139
112603#, python-format
112604msgid "No Batch Number was found with the name %s and the expiry date %s. "
112605msgstr "Aucun Numéro de Lot a été trouvé avec le nom %s et la date d'expiration %s. "
112606
112607#. module: msf_doc_import
112608#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:151112590#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:151
112609#, python-format112591#, python-format
112610msgid "Line %s %s: The Expiry Date must be a date."112592msgid "%s: The Expiry Date must be a date."
112611msgstr "Ligne %s %s: La Date d'Expiration doit être une date. "112593msgstr "%s: La Date d'Expiration doit être une date. "
112612112594
112613#. module: msf_doc_import112595#. module: msf_doc_import
112614#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:154112596#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:154
@@ -112619,26 +112601,26 @@
112619#. module: msf_doc_import112601#. module: msf_doc_import
112620#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:163112602#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:163
112621#, python-format112603#, python-format
112622msgid "Line %s: The Quantity must be a number. "112604msgid "The Quantity must be a number. "
112623msgstr "Ligne %s: La Quantité doit être un nombre. "112605msgstr "La Quantité doit être un nombre. "
112624112606
112625#. module: msf_doc_import112607#. module: msf_doc_import
112626#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:166112608#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:166
112627#, python-format112609#, python-format
112628msgid "Line %s: The Quantity is mandatory for each line. "112610msgid "The Quantity is mandatory for each line. "
112629msgstr "Ligne %s: La Quantité est obligatoire pour chaque ligne. "112611msgstr "La Quantité est obligatoire pour chaque ligne. "
112630112612
112631#. module: msf_doc_import112613#. module: msf_doc_import
112632#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:178112614#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:178
112633#, python-format112615#, python-format
112634msgid "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. "112616msgid "The UoM imported was not in the same category than the UoM of the product. The UoM of the product was taken instead. "
112635msgstr "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. "112617msgstr "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. "
112636112618
112637#. module: msf_doc_import112619#. module: msf_doc_import
112638#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:181112620#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:181
112639#, python-format112621#, python-format
112640msgid "Line %s: The UoM is mandatory for each line. "112622msgid "The UoM is mandatory for each line. "
112641msgstr "Ligne %s: L'UdM est obligatoire pour chaque ligne. "112623msgstr "L'UdM est obligatoire pour chaque ligne. "
112642112624
112643#. module: msf_doc_import112625#. module: msf_doc_import
112644#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:201112626#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:201
@@ -112653,14 +112635,16 @@
112653#, python-format112635#, python-format
112654msgid " \n"112636msgid " \n"
112655"Importation completed in %s!\n"112637"Importation completed in %s!\n"
112656"# of imported lines : %s lines\n"112638"# of imported lines : %s on %s lines\n"
112639"# of ignored lines: %s\n"
112657"# of errors to correct: %s\n"112640"# of errors to correct: %s\n"
112658"\n"112641"\n"
112659"%s\n"112642"%s\n"
112660"%s"112643"%s"
112661msgstr " \n"112644msgstr " \n"
112662"Import effectué en %s!\n"112645"Import effectué en %s!\n"
112663"# de lignes importées : %s lignes\n"112646"# de lignes importées : %s sur %s lignes\n"
112647"# de lignes ignorées: %s\n"
112664"# d'erreurs à corriger: %s\n"112648"# d'erreurs à corriger: %s\n"
112665"\n"112649"\n"
112666"%s\n"112650"%s\n"
@@ -112717,14 +112701,14 @@
112717#. module: msf_doc_import112701#. module: msf_doc_import
112718#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:141112702#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:141
112719#, python-format112703#, python-format
112720msgid "Line %s %s the Expiry Date %s is not correct."112704msgid "%s the Expiry Date %s is not correct."
112721msgstr "Ligne %s %s la Date d'Expiration %s est incorrecte."112705msgstr "%s la Date d'Expiration %s est incorrecte."
112722112706
112723#. module: msf_doc_import112707#. module: msf_doc_import
112724#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:136112708#: code:addons/msf_doc_import/wizard/wizard_return_from_unit_import.py:136
112725#, python-format112709#, python-format
112726msgid "Line %s %s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored"112710msgid "%s: a batch number is defined on the imported file but the product doesn't require batch number - Batch ignored"
112727msgstr "Ligne %s %s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré"112711msgstr "%s: un NL est défini dans le fichier, mais le produit ne nécissite pas de lot - Lot ignoré"
112728112712
112729#. modules: msf_order_date, purchase112713#. modules: msf_order_date, purchase
112730#: code:addons/msf_order_date/order_dates.py:696112714#: code:addons/msf_order_date/order_dates.py:696

Subscribers

People subscribed via source and target branches