Merge lp:~unifield-team/unifield-server/us-1168-int into lp:unifield-server
- us-1168-int
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4032 |
Proposed branch: | lp:~unifield-team/unifield-server/us-1168-int |
Merge into: | lp:unifield-server |
Diff against target: |
1439 lines (+575/-122) (has conflicts) 15 files modified
bin/addons/msf_doc_import/purchase_order.py (+26/-4) bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako (+5/-1) bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako (+14/-8) bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml (+2/-0) bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py (+68/-38) bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml (+2/-0) bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py (+143/-46) bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml (+3/-1) bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py (+3/-1) bin/addons/msf_profile/i18n/fr_MF.po (+171/-20) bin/addons/msf_supply_doc_export/msf_supply_doc_export.py (+34/-0) bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako (+3/-1) bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako (+1/-0) bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako (+80/-2) bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako (+20/-0) Text conflict in bin/addons/msf_profile/i18n/fr_MF.po |
To merge this branch: | bzr merge lp:~unifield-team/unifield-server/us-1168-int |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+303653@code.launchpad.net |
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/purchase_order.py' |
2 | --- bin/addons/msf_doc_import/purchase_order.py 2016-08-18 08:32:03 +0000 |
3 | +++ bin/addons/msf_doc_import/purchase_order.py 2016-10-28 14:28:19 +0000 |
4 | @@ -160,6 +160,7 @@ |
5 | for l in self.pool.get('purchase.order').browse(cr, uid, ids[0], context=context).order_line: |
6 | export_line_obj.create(cr, uid, {'po_line_id': l.id, |
7 | 'in_line_number': l.line_number, |
8 | + 'in_ext_ref': l.external_ref, |
9 | 'simu_id': export_id}, context=context) |
10 | |
11 | return {'type': 'ir.actions.act_window', |
12 | @@ -219,8 +220,10 @@ |
13 | if isinstance(ids, (int, long)): |
14 | ids = [ids] |
15 | |
16 | - datas = {} |
17 | - datas['ids'] = ids |
18 | + datas = { |
19 | + 'ids': ids, |
20 | + 'need_ad': context.get('need_ad', True), |
21 | + } |
22 | file_name = self.export_get_file_name(cr, uid, ids, prefix='POV', |
23 | context=context) |
24 | if file_name: |
25 | @@ -244,8 +247,10 @@ |
26 | if isinstance(ids, (int, long)): |
27 | ids = [ids] |
28 | |
29 | - datas = {} |
30 | - datas['ids'] = ids |
31 | + datas = { |
32 | + 'ids': ids, |
33 | + 'need_ad': context.get('need_ad', True), |
34 | + } |
35 | file_name = self.export_get_file_name(cr, uid, ids, prefix='POV', |
36 | context=context) |
37 | if file_name: |
38 | @@ -493,21 +498,38 @@ |
39 | |
40 | _columns = { |
41 | 'order_id': fields.many2one('purchase.order', string='Purchase Order', required=True), |
42 | + 'need_ad': fields.selection( |
43 | + selection=[ |
44 | + ('yes', 'Yes'), |
45 | + ('no', 'No'), |
46 | + ], |
47 | + string='Export AD', |
48 | + required=True, |
49 | + ), |
50 | 'file_type': fields.selection([('excel', 'Excel file'), |
51 | ('xml', 'XML file')], string='File type', required=True), |
52 | } |
53 | |
54 | + _defaults = { |
55 | + 'need_ad': 'yes', |
56 | + } |
57 | + |
58 | def export_file(self, cr, uid, ids, context=None): |
59 | ''' |
60 | Launch the good method to download the good file |
61 | ''' |
62 | order_obj = self.pool.get('purchase.order') |
63 | |
64 | + if context is None: |
65 | + context = {} |
66 | + |
67 | if isinstance(ids, (int, long)): |
68 | ids = [ids] |
69 | |
70 | wiz = self.browse(cr, uid, ids[0], context=context) |
71 | |
72 | + context['need_ad'] = wiz.need_ad == 'yes' |
73 | + |
74 | if wiz.file_type == 'xml': |
75 | return order_obj.export_xml_po_integration(cr, uid, wiz.order_id.id, context=context) |
76 | else: |
77 | |
78 | === modified file 'bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako' |
79 | --- bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako 2014-12-17 12:51:27 +0000 |
80 | +++ bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako 2016-10-28 14:28:19 +0000 |
81 | @@ -152,6 +152,7 @@ |
82 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Price Unit')}</Data></Cell> |
83 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Curr.')}</Data></Cell> |
84 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line')}</Data></Cell> |
85 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Ref')}</Data></Cell> |
86 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('CHG')}</Data></Cell> |
87 | <Cell ss:StyleID="header" ><Data ss:Type="String"></Data></Cell> |
88 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product')}</Data></Cell> |
89 | @@ -174,6 +175,7 @@ |
90 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.move_price_unit or 0.00)|x}</Data></Cell> |
91 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.move_currency_id.name or '')|x}</Data></Cell> |
92 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.line_number or '')|x}</Data></Cell> |
93 | + <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.external_ref or '')|x}</Data></Cell> |
94 | % if l.type_change == 'error': |
95 | <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell> |
96 | <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'integrity_status') or '')|x}</Data></Cell> |
97 | @@ -234,7 +236,9 @@ |
98 | <Row></Row> |
99 | |
100 | <Row> |
101 | - <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Information')}</Data></Cell> |
102 | + <Cell ss:StyleID="header" MergeAcross="3"><Data ss:Type="String">${_('Information')}</Data></Cell> |
103 | + </Row> |
104 | + <Row> |
105 | <Cell ss:StyleID="line" MergeAcross="3" ><Data ss:Type="String">${(o.message or '')|x}</Data></Cell> |
106 | </Row> |
107 | |
108 | |
109 | === modified file 'bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako' |
110 | --- bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako 2014-12-17 12:51:27 +0000 |
111 | +++ bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako 2016-10-28 14:28:19 +0000 |
112 | @@ -268,43 +268,49 @@ |
113 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.in_price or 0.00)|x}</Data></Cell> |
114 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.in_currency and obj_name_get('res.currency', l.in_currency.id) or '')|x}</Data></Cell> |
115 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.in_line_number)|x}</Data></Cell> |
116 | - <Cell ss:StyleID="line" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell> |
117 | - % if l.in_product_id != l.imp_product_id: |
118 | + % if l.type_change == 'del': |
119 | + <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell> |
120 | + % else: |
121 | + <Cell ss:StyleID="line" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell> |
122 | + % endif |
123 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_product_id != l.imp_product_id): |
124 | <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(l.imp_product_id and obj_name_get('product.product', l.imp_product_id.id) or '')|x}</Data></Cell> |
125 | % else: |
126 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.imp_product_id and obj_name_get('product.product', l.imp_product_id.id) or '')|x}</Data></Cell> |
127 | % endif |
128 | - % if l.in_qty != l.imp_qty: |
129 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_qty != l.imp_qty): |
130 | <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_qty or 0.00)|x}</Data></Cell> |
131 | % else: |
132 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_qty or 0.00)|x}</Data></Cell> |
133 | % endif |
134 | - % if l.in_price != l.imp_price: |
135 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_price != l.imp_price): |
136 | <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_price or 0.00)|x}</Data></Cell> |
137 | % else: |
138 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_price or 0.00)|x}</Data></Cell> |
139 | % endif |
140 | - % if l.imp_discrepancy != 0.00: |
141 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.imp_discrepancy != 0.00): |
142 | <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_discrepancy or 0.00)|x}</Data></Cell> |
143 | % else: |
144 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_discrepancy or 0.00)|x}</Data></Cell> |
145 | % endif |
146 | - % if l.in_currency != l.imp_currency: |
147 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_currency != l.imp_currency): |
148 | <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(l.imp_currency and obj_name_get('res.currency', l.imp_currency.id) or '')|x}</Data></Cell> |
149 | % else: |
150 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.imp_currency and obj_name_get('res.currency', l.imp_currency.id) or '')|x}</Data></Cell> |
151 | % endif |
152 | - % if l.in_drd != l.imp_drd and l.imp_drd not in ('False', False): |
153 | + % if not l.type_change == 'ignore' and (l.type_change == 'del' or (l.in_drd != l.imp_drd and l.imp_drd not in ('False', False))): |
154 | <Cell ss:StyleID="line_change_short_date" ><Data ss:Type="DateTime">${(l.imp_drd)|n}T00:00:00.000</Data></Cell> |
155 | % elif l.imp_drd not in ('False', False): |
156 | <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${(l.imp_drd)|n}T00:00:00.000</Data></Cell> |
157 | % else: |
158 | <Cell ss:StyleID="line" ></Cell> |
159 | % endif |
160 | - % if l.in_dcd != l.imp_dcd and l.imp_dcd not in ('False', False): |
161 | + % if not l.type_change == 'ignore' and ((l.type_change == 'del' or l.in_dcd != l.imp_dcd) and l.imp_dcd not in ('False', False)): |
162 | <Cell ss:StyleID="line_change_short_date" ><Data ss:Type="DateTime">${(l.imp_dcd)|n}T00:00:00.000</Data></Cell> |
163 | % elif l.imp_dcd not in ('False', False): |
164 | <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${(l.imp_dcd)|n}T00:00:00.000</Data></Cell> |
165 | + % elif l.type_change == 'del': |
166 | + <Cell ss:StyleID="line_change"></Cell> |
167 | % else: |
168 | <Cell ss:StyleID="line" ></Cell> |
169 | % endif |
170 | |
171 | === modified file 'bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml' |
172 | --- bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml 2016-05-26 08:58:45 +0000 |
173 | +++ bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml 2016-10-28 14:28:19 +0000 |
174 | @@ -139,6 +139,8 @@ |
175 | <form string="Export PO validated"> |
176 | <separator colspan="4" string="File format" /> |
177 | <field name="file_type" /> |
178 | + <newline /> |
179 | + <field name="need_ad" colspan="2" invisible="1" /> |
180 | <separator colspan="4" string="Actions" /> |
181 | <group colspan="4" col="4"> |
182 | <label> </label> |
183 | |
184 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py' |
185 | --- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-08-23 12:54:03 +0000 |
186 | +++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-10-28 14:28:19 +0000 |
187 | @@ -40,7 +40,7 @@ |
188 | # Server imports |
189 | # Addons imports |
190 | NB_OF_HEADER_LINES = 7 |
191 | -NB_LINES_COLUMNS = 12 |
192 | +NB_LINES_COLUMNS = 13 |
193 | |
194 | |
195 | PRODUCT_CODE_ID = {} |
196 | @@ -49,20 +49,22 @@ |
197 | PRODLOT_NAME_ID = {} |
198 | |
199 | SIMU_LINES = {} |
200 | +LN_BY_EXT_REF = {} |
201 | |
202 | |
203 | LINES_COLUMNS = [(0, _('Line number'), 'optionnal'), |
204 | - (1, _('Product Code'), 'mandatory'), |
205 | - (2, _('Product Description'), 'optionnal'), |
206 | - (3, _('Product Qty'), 'mandatory'), |
207 | - (4, _('Product UoM'), 'mandatory'), |
208 | - (5, _('Price Unit'), 'mandatory'), |
209 | - (6, _('Currency'), 'mandatory'), |
210 | - (7, _('Batch'), 'optionnal'), |
211 | - (8, _('Expiry Date'), 'optionnal'), |
212 | - (9, _('Packing List'), 'optionnal'), |
213 | - (10, _('ESC message 1'), 'optionnal'), |
214 | - (11, _('ESC message 2'), 'optionnal'), |
215 | + (1, _('External Ref.'), 'optionnal'), |
216 | + (2, _('Product Code'), 'mandatory'), |
217 | + (3, _('Product Description'), 'optionnal'), |
218 | + (4, _('Product Qty'), 'mandatory'), |
219 | + (5, _('Product UoM'), 'mandatory'), |
220 | + (6, _('Price Unit'), 'mandatory'), |
221 | + (7, _('Currency'), 'mandatory'), |
222 | + (8, _('Batch'), 'optionnal'), |
223 | + (9, _('Expiry Date'), 'optionnal'), |
224 | + (10, _('Packing List'), 'optionnal'), |
225 | + (11, _('ESC message 1'), 'optionnal'), |
226 | + (12, _('ESC message 2'), 'optionnal'), |
227 | ] |
228 | |
229 | HEADER_COLUMNS = [(1, _('Freight'), 'optionnal'), |
230 | @@ -326,7 +328,7 @@ |
231 | index = get_field_index(field, index) |
232 | else: |
233 | index += 1 |
234 | - values[index] = ['line_number', 'product_code', |
235 | + values[index] = ['line_number', 'external_ref', 'product_code', |
236 | 'product_name', 'product_qty', |
237 | 'uom_id', 'price_unit', 'currency_id', |
238 | 'prodlot_id', 'expiry_date', |
239 | @@ -390,6 +392,7 @@ |
240 | global CURRENCY_NAME_ID |
241 | global PRODLOT_NAME_ID |
242 | global SIMU_LINES |
243 | + global LN_BY_EXT_REF |
244 | |
245 | if context is None: |
246 | context = {} |
247 | @@ -419,6 +422,7 @@ |
248 | First of all, we build a cache for simulation screen lines |
249 | ''' |
250 | l_num = line.line_number |
251 | + l_ext_ref = line.external_ref |
252 | l_prod = line.move_product_id and line.move_product_id.id or False |
253 | l_uom = line.move_uom_id and line.move_uom_id.id or False |
254 | # By simulation screen |
255 | @@ -441,6 +445,11 @@ |
256 | SIMU_LINES[wiz.id][l_num][l_prod][l_uom].setdefault(line.move_product_qty, []) |
257 | SIMU_LINES[wiz.id][l_num][l_prod][l_uom][line.move_product_qty].append(line.id) |
258 | |
259 | + LN_BY_EXT_REF.setdefault(wiz.id, {}) |
260 | + if l_ext_ref and l_num: |
261 | + LN_BY_EXT_REF[wiz.id].setdefault(l_ext_ref, []) |
262 | + LN_BY_EXT_REF[wiz.id][l_ext_ref].append(l_num) |
263 | + |
264 | # Variables |
265 | lines_to_ignored = [] # Bad formatting lines |
266 | file_format_errors = [] |
267 | @@ -543,6 +552,9 @@ |
268 | # Check mandatory fields |
269 | not_ok = False |
270 | file_line_error = [] |
271 | + line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False |
272 | + ext_ref = values.get(x, [False, False])[1] |
273 | + ext_ref = ext_ref and str(ext_ref) or False |
274 | for manda_field in LINES_COLUMNS: |
275 | if manda_field[2] == 'mandatory' and not values.get(x, [])[manda_field[0]]: |
276 | not_ok = True |
277 | @@ -551,10 +563,16 @@ |
278 | values_line_errors.append(err) |
279 | file_line_error.append(err1) |
280 | |
281 | - if not values.get(x, [''])[0]: |
282 | - line_number = False |
283 | - else: |
284 | - line_number = int(values.get(x, [''])[0]) |
285 | + if line_number and ext_ref: |
286 | + if line_number not in LN_BY_EXT_REF[wiz.id].get(ext_ref, []): |
287 | + not_ok = True |
288 | + err1 = _('No line found for line number \'%s\' and ext. ref. \'%s\' - Line not imported') % (line_number, ext_ref) |
289 | + err = _('Line %s of the file: %s') % (x, err1) |
290 | + values_line_errors.append(err) |
291 | + file_line_error.append(err1) |
292 | + |
293 | + if not line_number and ext_ref: |
294 | + line_number = LN_BY_EXT_REF[wiz.id].get(ext_ref, [False])[0] |
295 | |
296 | if not_ok: |
297 | not_ok_file_lines[x] = ' - '.join(err for err in file_line_error) |
298 | @@ -566,47 +584,47 @@ |
299 | |
300 | vals = values.get(x, []) |
301 | # Product |
302 | - if vals[1]: |
303 | - product_id = PRODUCT_CODE_ID.get(vals[1], False) |
304 | - if not product_id and vals[1]: |
305 | - prod_ids = prod_obj.search(cr, uid, [('default_code', '=', vals[1])], context=context) |
306 | + if vals[2]: |
307 | + product_id = PRODUCT_CODE_ID.get(vals[2], False) |
308 | + if not product_id and vals[2]: |
309 | + prod_ids = prod_obj.search(cr, uid, [('default_code', '=', vals[2])], context=context) |
310 | if prod_ids: |
311 | product_id = prod_ids[0] |
312 | - PRODUCT_CODE_ID.setdefault(vals[1], product_id) |
313 | + PRODUCT_CODE_ID.setdefault(vals[2], product_id) |
314 | |
315 | # UoM |
316 | - if vals[4]: |
317 | - uom_id = UOM_NAME_ID.get(vals[4], False) |
318 | + if vals[5]: |
319 | + uom_id = UOM_NAME_ID.get(vals[5], False) |
320 | if not uom_id: |
321 | - uom_ids = uom_obj.search(cr, uid, [('name', '=', vals[4])], context=context) |
322 | + uom_ids = uom_obj.search(cr, uid, [('name', '=', vals[5])], context=context) |
323 | if uom_ids: |
324 | uom_id = uom_ids[0] |
325 | - UOM_NAME_ID.setdefault(vals[4], uom_id) |
326 | + UOM_NAME_ID.setdefault(vals[5], uom_id) |
327 | |
328 | # Qty |
329 | - if vals[3]: |
330 | - qty = float(vals[3]) |
331 | + if vals[4]: |
332 | + qty = float(vals[4]) |
333 | |
334 | # Batch and expiry date |
335 | # Put the batch + expiry date in a cache to create |
336 | # the batch that don't exist only during the import |
337 | # not at simulation time |
338 | - if vals[7] and vals[8]: |
339 | - exp_value = vals[8] |
340 | - if type(vals[8]) == type(DateTime.now()): |
341 | + if vals[8] and vals[9]: |
342 | + exp_value = vals[9] |
343 | + if type(vals[9]) == type(DateTime.now()): |
344 | exp_value = exp_value.strftime('%Y-%m-%d') |
345 | - elif vals[8] and isinstance(vals[8], str): |
346 | + elif vals[9] and isinstance(vals[9], str): |
347 | try: |
348 | - time.strptime(vals[8], '%Y-%m-%d') |
349 | - exp_value = vals[8] |
350 | + time.strptime(vals[9], '%Y-%m-%d') |
351 | + exp_value = vals[9] |
352 | except ValueError: |
353 | exp_value = False |
354 | |
355 | - if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[7])): |
356 | + if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[8])): |
357 | prodlot_cache.setdefault(product_id, {}) |
358 | - prodlot_cache[product_id].setdefault(str(vals[7]), exp_value) |
359 | + prodlot_cache[product_id].setdefault(str(vals[8]), exp_value) |
360 | |
361 | - file_lines[x] = (line_number, product_id, uom_id, qty) |
362 | + file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref) |
363 | |
364 | ''' |
365 | Get the best matching line: |
366 | @@ -956,6 +974,7 @@ |
367 | 'str_line_number': fields.function(_get_l_num, method=True, type='char', size=32, |
368 | string='Line', readonly=True, multi='line_num', |
369 | store={'wizard.import.in.line.simulation.screen': (lambda self, cr, uid, ids, c={}: ids, ['line_number'], 20)}), |
370 | + 'external_ref': fields.char(size=256, string='External Ref.', readonly=True), |
371 | 'type_change': fields.selection([('', ''), |
372 | ('split', 'Split'), |
373 | ('error', 'Error'), |
374 | @@ -978,6 +997,7 @@ |
375 | 'imp_batch_name': fields.char(size=128, string='Batch Number', readonly=True), |
376 | 'imp_exp_date': fields.date(string='Expiry date', readonly=True), |
377 | 'imp_packing_list': fields.char(size=256, string='Packing list', readonly=True), |
378 | + 'imp_external_ref': fields.char(size=256, string='External ref.', readonly=True), |
379 | 'message_esc1': fields.char(size=256, string='Message ESC 1', readonly=True), |
380 | 'message_esc2': fields.char(size=256, string='Message ESC 2', readonly=True), |
381 | # Computed fields |
382 | @@ -1060,9 +1080,16 @@ |
383 | errors = [] |
384 | warnings = [] |
385 | |
386 | + if len(values) == 13: |
387 | + ext_ref = values.pop(1) |
388 | + values.append(ext_ref) |
389 | + |
390 | for line in self.browse(cr, uid, ids, context=context): |
391 | write_vals = {} |
392 | |
393 | + if ext_ref: |
394 | + write_vals['imp_external_ref'] = ext_ref |
395 | + |
396 | # Product |
397 | prod_id = False |
398 | if (values[1] and values[1] == line.move_product_id.default_code): |
399 | @@ -1256,7 +1283,10 @@ |
400 | |
401 | if line.type_change == 'new': |
402 | write_vals['type_change'] = 'error' |
403 | - errors.append(_('Line does not correspond to original IN')) |
404 | + if write_vals.get('imp_external_ref'): |
405 | + errors.append(_('No original IN lines with external ref \'%s\' found.') % write_vals['imp_external_ref']) |
406 | + else: |
407 | + errors.append(_('Line does not correspond to original IN')) |
408 | |
409 | error_msg = line.error_msg or '' |
410 | for err in errors: |
411 | |
412 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml' |
413 | --- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml 2016-03-17 08:37:36 +0000 |
414 | +++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml 2016-10-28 14:28:19 +0000 |
415 | @@ -81,6 +81,7 @@ |
416 | <field name="move_price_unit" /> |
417 | <field name="move_currency_id" /> |
418 | <field name="str_line_number" /> |
419 | + <field name="external_ref" /> |
420 | <field name="error_msg" invisible="1" /> |
421 | <button name="get_error_msg" type="object" icon="gtk-dialog-warning" string="See error" attrs="{'invisible': [('error_msg', '=', False), ('integrity_status', 'in', ('empty', False, ''))]}" /> |
422 | <field name="type_change" /> |
423 | @@ -99,6 +100,7 @@ |
424 | <field name="kc_check" widget="null_boolean" /> |
425 | <field name="dg_check" widget="null_boolean" /> |
426 | <field name="np_check" widget="null_boolean" /> |
427 | + <field name="imp_external_ref" /> |
428 | <field name="imp_packing_list" /> |
429 | <field name="message_esc1" /> |
430 | <field name="message_esc2" /> |
431 | |
432 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py' |
433 | --- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-08-23 12:54:03 +0000 |
434 | +++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-10-28 14:28:19 +0000 |
435 | @@ -48,6 +48,8 @@ |
436 | CURRENCY_NAME_ID = {} |
437 | |
438 | SIMU_LINES = {} |
439 | +LN_BY_EXT_REF = {} |
440 | +EXT_REF_BY_LN = {} |
441 | |
442 | """ |
443 | UF-2538 optional 4nd tuple item: list of states for mandatory check |
444 | @@ -62,6 +64,7 @@ |
445 | (6, _('Price Unit'), 'mandatory'), |
446 | (7, _('Currency'), 'mandatory'), |
447 | (8, _('Origin'), 'optionnal'), |
448 | + (14, _('Comment'), 'optionnal'), |
449 | (10, _('Delivery Confirmed Date'), 'mandatory', ('!=', ['confirmed'])), |
450 | (16, _('Project Ref.'), 'optionnal'), |
451 | (17, _('Message ESC 1'), 'optionnal'), |
452 | @@ -159,6 +162,14 @@ |
453 | ('done', 'Done')], |
454 | string='State', |
455 | readonly=True), |
456 | + 'with_ad': fields.selection( |
457 | + selection=[ |
458 | + ('yes', 'Yes'), |
459 | + ('no', 'No'), |
460 | + ], |
461 | + string='File contains Analytic Distribution', |
462 | + required=True, |
463 | + ), |
464 | # File information |
465 | 'file_to_import': fields.binary(string='File to import'), |
466 | 'filename': fields.char(size=64, string='Filename'), |
467 | @@ -259,6 +270,7 @@ |
468 | |
469 | _defaults = { |
470 | 'state': 'draft', |
471 | + 'with_ad': lambda *a: 'yes', |
472 | } |
473 | |
474 | def write(self, cr, uid, ids, vals, context=None): |
475 | @@ -336,17 +348,23 @@ |
476 | if isinstance(ids, (int, long)): |
477 | ids = [ids] |
478 | |
479 | - for wiz in self.browse(cr, uid, ids, context=context): |
480 | - if wiz.filetype == 'excel': |
481 | - xml_file = base64.decodestring(wiz.file_to_import) |
482 | - excel_file = SpreadsheetXML(xmlstring=xml_file) |
483 | - if not excel_file.getWorksheets(): |
484 | - raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !')) |
485 | - else: |
486 | - xml_file = base64.decodestring(wiz.file_to_import) |
487 | - root = ET.fromstring(xml_file) |
488 | - if root.tag != 'data': |
489 | - raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !')) |
490 | + try: |
491 | + for wiz in self.browse(cr, uid, ids, context=context): |
492 | + if wiz.filetype == 'excel': |
493 | + xml_file = base64.decodestring(wiz.file_to_import) |
494 | + excel_file = SpreadsheetXML(xmlstring=xml_file) |
495 | + if not excel_file.getWorksheets(): |
496 | + raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !')) |
497 | + else: |
498 | + xml_file = base64.decodestring(wiz.file_to_import) |
499 | + root = ET.fromstring(xml_file) |
500 | + if root.tag != 'data': |
501 | + raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !')) |
502 | + except Exception as e: |
503 | + raise osv.except_osv( |
504 | + _('Error'), |
505 | + _('Error during file to import parsing :: Error: %s') % e, |
506 | + ) |
507 | |
508 | self.write(cr, uid, ids, {'state': 'simu_progress'}, context=context) |
509 | cr.commit() |
510 | @@ -372,6 +390,14 @@ |
511 | rec_lines = [] |
512 | rec = False |
513 | |
514 | + ad_field_names = [ |
515 | + 'analytic_distribution_id', |
516 | + 'ad_destination_name', |
517 | + 'ad_cost_center_name', |
518 | + 'ad_percentage', |
519 | + 'ad_subtotal', |
520 | + ] |
521 | + |
522 | index = 0 |
523 | for record in root: |
524 | if record.tag == 'record': |
525 | @@ -393,18 +419,19 @@ |
526 | return index |
527 | |
528 | for field in rec: |
529 | - if field.attrib['name'] != 'order_line': |
530 | + ad_field = field.attrib['name'] in ad_field_names |
531 | + if field.attrib['name'] != 'order_line' and not ad_field: |
532 | index = get_field_index(field, index) |
533 | - else: |
534 | + elif not ad_field: |
535 | index += 1 |
536 | values[index] = ['line_number', 'external_ref', |
537 | 'product_code', 'product_name', |
538 | 'product_qty', 'product_uom', |
539 | 'price_unit', 'currency_id', |
540 | - 'origin', 'date_planned', |
541 | + 'origin', 'comment', 'date_planned', |
542 | 'confirmed_delivery_date', |
543 | 'nomen_manda_0', 'nomen_manda_1', |
544 | - 'nomen_manda_2', 'comment', |
545 | + 'nomen_manda_2', |
546 | 'notes', 'project_ref', |
547 | 'message_esc1', 'message_esc2'] |
548 | for line in field: |
549 | @@ -414,6 +441,8 @@ |
550 | index += 1 |
551 | values[index] = [] |
552 | for fl in line: |
553 | + if fl.attrib['name'] in ad_field_names: |
554 | + continue |
555 | if not fl.getchildren(): |
556 | values[index].append(fl.text or '') |
557 | else: |
558 | @@ -469,6 +498,8 @@ |
559 | global UOM_NAME_ID |
560 | global CURRENCY_NAME_ID |
561 | global SIMU_LINES |
562 | + global LN_BY_EXT_REF |
563 | + global EXT_REF_BY_LN |
564 | |
565 | if context is None: |
566 | context = {} |
567 | @@ -484,6 +515,13 @@ |
568 | 'state': 'draft'}, context=context) |
569 | continue |
570 | |
571 | + nb_file_header_lines = NB_OF_HEADER_LINES |
572 | + nb_file_lines_columns = NB_LINES_COLUMNS |
573 | + first_line_index = nb_file_header_lines + 1 |
574 | + if wiz.with_ad == 'yes' and wiz.filetype != 'xml': |
575 | + nb_file_header_lines += 2 |
576 | + first_line_index += 2 |
577 | + |
578 | for line in wiz.simu_line_ids: |
579 | # Put data in cache |
580 | if line.in_product_id: |
581 | @@ -497,6 +535,7 @@ |
582 | First of all, we build a cache for simulation screen lines |
583 | ''' |
584 | l_num = line.in_line_number |
585 | + l_ext_ref = line.in_ext_ref |
586 | l_prod = line.in_product_id and line.in_product_id.id or False |
587 | l_uom = line.in_uom and line.in_uom.id or False |
588 | # By simulation screen |
589 | @@ -519,6 +558,14 @@ |
590 | SIMU_LINES[wiz.id][l_num][l_prod][l_uom].setdefault(line.in_qty, []) |
591 | SIMU_LINES[wiz.id][l_num][l_prod][l_uom][line.in_qty].append(line.id) |
592 | |
593 | + LN_BY_EXT_REF.setdefault(wiz.id, {}) |
594 | + EXT_REF_BY_LN.setdefault(wiz.id, {}) |
595 | + if line.in_ext_ref: |
596 | + LN_BY_EXT_REF[wiz.id].setdefault(str(line.in_ext_ref), []) |
597 | + EXT_REF_BY_LN[wiz.id].setdefault(l_num, []) |
598 | + LN_BY_EXT_REF[wiz.id][line.in_ext_ref].append(l_num) |
599 | + EXT_REF_BY_LN[wiz.id][l_num].append(str(line.in_ext_ref)) |
600 | + |
601 | # Variables |
602 | lines_to_ignored = [] # Bad formatting lines |
603 | file_format_errors = [] |
604 | @@ -541,28 +588,31 @@ |
605 | ''' |
606 | # Check number of columns on lines |
607 | |
608 | - for x in xrange(1, NB_OF_HEADER_LINES+1): |
609 | - if len(values.get(x, [])) != 2: |
610 | + for x in xrange(1, nb_file_header_lines+1): |
611 | + nb_to_check = 2 |
612 | + if x > NB_OF_HEADER_LINES and x <= nb_file_header_lines: |
613 | + continue |
614 | + if len(values.get(x, [])) != nb_to_check: |
615 | lines_to_ignored.append(x) |
616 | error_msg = _('Line %s of the imported file: The header \ |
617 | - information must be on two columns : Column A for name of the field and column\ |
618 | - B for value.') % x |
619 | +information must be on two columns : Column A for name of the field and column\ |
620 | + B for value.') % x |
621 | file_format_errors.append(error_msg) |
622 | |
623 | - if len(values.get(NB_OF_HEADER_LINES+1, [])) != NB_LINES_COLUMNS: |
624 | - error_msg = _('Line 20 of the Excel file: This line is \ |
625 | - mandatory and must have %s columns. The values on this line must be the name \ |
626 | - of the field for PO lines.') % NB_LINES_COLUMNS |
627 | + if len(values.get(first_line_index, [])) < nb_file_lines_columns: |
628 | + error_msg = _('Line %s of the Excel file: This line is \ |
629 | +mandatory and must have at least %s columns. The values on this line must be the name \ |
630 | +of the field for PO lines.') % (first_line_index, nb_file_lines_columns) |
631 | file_format_errors.append(error_msg) |
632 | |
633 | - for x in xrange(NB_OF_HEADER_LINES+2, len(values)+1): |
634 | - if len(values.get(x, [])) != NB_LINES_COLUMNS: |
635 | + for x in xrange(first_line_index, len(values)+1): |
636 | + if len(values.get(x, [])) < nb_file_lines_columns: |
637 | lines_to_ignored.append(x) |
638 | error_msg = _('Line %s of the imported file: The line \ |
639 | - information must be on %s columns. The line %s has %s columns') % (x, NB_LINES_COLUMNS, x, len(values.get(x, []))) |
640 | +information must be on at least %s columns. The line %s has %s columns') % (x, nb_file_lines_columns, x, len(values.get(x, []))) |
641 | file_format_errors.append(error_msg) |
642 | |
643 | - nb_file_lines = len(values) - NB_OF_HEADER_LINES - 1 |
644 | + nb_file_lines = len(values) - first_line_index |
645 | self.write(cr, uid, [wiz.id], {'nb_file_lines': nb_file_lines}, context=context) |
646 | |
647 | if len(file_format_errors): |
648 | @@ -709,7 +759,7 @@ |
649 | new_po_lines = [] |
650 | not_ok_file_lines = {} |
651 | # Loop on lines |
652 | - for x in xrange(NB_OF_HEADER_LINES+2, len(values)+1): |
653 | + for x in xrange(first_line_index+1, len(values)+1): |
654 | |
655 | # Check mandatory fields |
656 | not_ok = False |
657 | @@ -738,7 +788,7 @@ |
658 | file_line_error.append(err1) |
659 | |
660 | line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False |
661 | - ext_ref = values.get(x, ['', ''])[1] |
662 | + ext_ref = values.get(x, ['', ''])[1] and str(values.get(x, ['', ''])[1]) |
663 | |
664 | if not line_number and not ext_ref: |
665 | not_ok = True |
666 | @@ -747,6 +797,19 @@ |
667 | values_line_errors.append(err) |
668 | file_line_error.append(err1) |
669 | |
670 | + if line_number and ext_ref and (ext_ref not in LN_BY_EXT_REF[wiz.id].keys() or line_number not in LN_BY_EXT_REF[wiz.id][ext_ref]): |
671 | + not_ok = True |
672 | + err1 = _('The line cannot have both Line no. and Ext. Ref') |
673 | + err = _('Line %s of the file: %s') % (x, err1) |
674 | + values_line_errors.append(err) |
675 | + file_line_error.append(err1) |
676 | + |
677 | + if not line_number and ext_ref and ext_ref in LN_BY_EXT_REF[wiz.id].keys(): |
678 | + line_number = LN_BY_EXT_REF[wiz.id][ext_ref][0] |
679 | + |
680 | + if not ext_ref and line_number and line_number in EXT_REF_BY_LN[wiz.id].keys(): |
681 | + ext_ref = EXT_REF_BY_LN[wiz.id][line_number][0] |
682 | + |
683 | if not_ok: |
684 | not_ok_file_lines[x] = ' - '.join(err for err in file_line_error) |
685 | |
686 | @@ -779,7 +842,7 @@ |
687 | if vals[4]: |
688 | qty = float(vals[4]) |
689 | |
690 | - file_lines[x] = (line_number or ext_ref, product_id, uom_id, qty) |
691 | + file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref) |
692 | |
693 | ''' |
694 | Get the best matching line : |
695 | @@ -920,6 +983,7 @@ |
696 | vals = values.get(po_line, []) |
697 | new_wl_id = wl_obj.create(cr, uid, {'type_change': 'new', |
698 | 'in_line_number': values.get(po_line, [])[0] and int(values.get(po_line, [])[0]) or False, |
699 | + 'in_ext_ref': values.get(po_line, [])[1] or False, |
700 | 'simu_id': wiz.id}, context=context) |
701 | err_msg = wl_obj.import_line(cr, uid, new_wl_id, vals, context=context) |
702 | if po_line in not_ok_file_lines: |
703 | @@ -934,7 +998,8 @@ |
704 | |
705 | # Lines to delete |
706 | for po_line in SIMU_LINES[wiz.id]['line_ids']: |
707 | - wl_obj.write(cr, uid, po_line, {'type_change': 'del'}, context=context) |
708 | + if wl_obj.read(cr, uid, [po_line], ['type_change'], context=context)[0]['type_change'] != 'del': |
709 | + wl_obj.write(cr, uid, po_line, {'type_change': 'ignore'}, context=context) |
710 | |
711 | ''' |
712 | We generate the message which will be displayed on the simulation |
713 | @@ -1071,7 +1136,7 @@ |
714 | |
715 | class wizard_import_po_simulation_screen_line(osv.osv): |
716 | _name = 'wizard.import.po.simulation.screen.line' |
717 | - _order = 'is_new_line, in_line_number, in_product_id, id' |
718 | + _order = 'is_new_line, in_line_number, in_ext_ref, in_product_id, id' |
719 | _rec_name = 'in_line_number' |
720 | |
721 | def _get_line_info(self, cr, uid, ids, field_name, args, context=None): |
722 | @@ -1081,6 +1146,14 @@ |
723 | if isinstance(ids, (int, long)): |
724 | ids = [ids] |
725 | |
726 | + delete_line_ids = self.search(cr, uid, [ |
727 | + ('imp_comment', '=', '[DELETE]') |
728 | + ], context=context) |
729 | + delete_line_numbers = set() |
730 | + for x in self.read(cr, uid, delete_line_ids, ['in_line_number'], context=context): |
731 | + if x['in_line_number']: |
732 | + delete_line_numbers.add(x['in_line_number']) |
733 | + |
734 | res = {} |
735 | for line in self.browse(cr, uid, ids, context=context): |
736 | res[line.id] = {'in_product_id': False, |
737 | @@ -1092,6 +1165,7 @@ |
738 | 'in_dcd': False, |
739 | 'in_price': 0.00, |
740 | 'in_currency': False, |
741 | + 'in_ext_ref': False, |
742 | 'imp_discrepancy': 0.00, |
743 | 'change_ok': False} |
744 | |
745 | @@ -1106,7 +1180,8 @@ |
746 | res[line.id]['in_dcd'] = l.confirmed_delivery_date |
747 | res[line.id]['in_price'] = l.price_unit |
748 | res[line.id]['in_currency'] = l.currency_id and l.currency_id.id or False |
749 | - if line.type_change != 'del': |
750 | + res[line.id]['in_ext_ref'] = l.external_ref or False |
751 | + if line.type_change != '': |
752 | if line.imp_qty and line.imp_price: |
753 | disc = (line.imp_qty*line.imp_price)-(line.in_qty*line.in_price) |
754 | res[line.id]['imp_discrepancy'] = disc |
755 | @@ -1120,8 +1195,11 @@ |
756 | price_change = not(res[line.id]['in_price'] == line.imp_price) |
757 | drd_change = not(res[line.id]['in_drd'] == line.imp_drd) |
758 | dcd_change = not(res[line.id]['in_dcd'] == line.imp_dcd) |
759 | + to_delete = line.imp_comment == '[DELETE]' |
760 | + if to_delete: |
761 | + delete_line_numbers.add(line.in_line_number) |
762 | |
763 | - if line.simu_id.state != 'draft' and (prod_change or qty_change or price_change or drd_change or dcd_change): |
764 | + if line.simu_id.state != 'draft' and (prod_change or qty_change or price_change or drd_change or dcd_change or to_delete): |
765 | res[line.id]['change_ok'] = True |
766 | elif line.type_change == 'del': |
767 | res[line.id]['imp_discrepancy'] = -(line.in_qty*line.in_price) |
768 | @@ -1190,8 +1268,10 @@ |
769 | 'is_new_line': fields.function(_get_str_line_number, method=True, string='Is new line ?', |
770 | type='boolean', readonly=True, multi='new_line', |
771 | store={'wizard.import.po.simulation.screen.line': (lambda self, cr, uid, ids, c={}: ids, ['in_line_number'], 20),}), |
772 | + 'in_ext_ref': fields.char(size=256, string='External Ref.', readonly=True), |
773 | 'type_change': fields.selection([('', ''), ('error', 'Error'), ('new', 'New'), |
774 | - ('split', 'Split'), ('del', 'Del'),], |
775 | + ('split', 'Split'), ('del', 'Del'), |
776 | + ('ignore', 'Ignore')], |
777 | string='CHG', readonly=True), |
778 | 'imp_product_id': fields.many2one('product.product', string='Product', |
779 | readonly=True), |
780 | @@ -1206,6 +1286,7 @@ |
781 | 'imp_dcd': fields.date(string='Delivery Confirmed Date', readonly=True), |
782 | 'imp_esc1': fields.char(size=256, string='Message ESC1', readonly=True), |
783 | 'imp_esc2': fields.char(size=256, string='Message ESC2', readonly=True), |
784 | + 'imp_comment': fields.text(string='Comment', readonly=True), |
785 | 'imp_external_ref': fields.char(size=256, string='External Ref.', readonly=True), |
786 | 'imp_project_ref': fields.char(size=256, string='Project Ref.', readonly=True), |
787 | 'imp_origin': fields.char(size=256, string='Origin Ref.', readonly=True), |
788 | @@ -1246,20 +1327,35 @@ |
789 | for line in self.browse(cr, uid, ids, context=context): |
790 | write_vals = {} |
791 | |
792 | + # Comment |
793 | + write_vals['imp_comment'] = values[14] and values[14].strip() |
794 | + |
795 | # External Ref. |
796 | write_vals['imp_external_ref'] = values[1] |
797 | - if line.in_line_number and write_vals['imp_external_ref']: |
798 | - errors.append(_('The line cannot have both Line no. and Ext Ref.')) |
799 | - write_vals['in_line_number'] = False |
800 | - write_vals['imp_external_ref'] = False |
801 | - write_vals['type_change'] = 'error' |
802 | - elif line.in_line_number: |
803 | + pol_ids = None |
804 | + if line.in_line_number: |
805 | pol_ids = self.pool.get('purchase.order.line').search(cr, uid, [('order_id', '=', line.simu_id.order_id.id), ('line_number', '=', line.in_line_number)], context=context) |
806 | - if not pol_ids: |
807 | + if not pol_ids and not (write_vals['imp_comment'] and write_vals['imp_comment'] == '[DELETE]'): |
808 | errors.append(_('Line no is not consistent with validated PO.')) |
809 | write_vals['in_line_number'] = False |
810 | write_vals['type_change'] = 'error' |
811 | |
812 | + if (write_vals['imp_comment'] and write_vals['imp_comment'] == '[DELETE]'): |
813 | + if not pol_ids: |
814 | + write_vals['type_change'] = 'error' |
815 | + if line.in_line_number: |
816 | + errors.append(_('The import file is inconsistent. Line no. %s is not existing or was previously deleted') % line.in_line_number) |
817 | + else: |
818 | + errors.append(_('The import file is inconsistent. The matching line is not existing or was previously deleted')) |
819 | + else: |
820 | + write_vals['type_change'] = 'del' |
821 | + if line.in_line_number: |
822 | + to_delete = self.search(cr, uid, [ |
823 | + ('simu_id', '=', line.simu_id.id), |
824 | + ('in_line_number', '=', line.in_line_number), |
825 | + ], context=context) |
826 | + self.write(cr, uid, to_delete, {'type_change': 'del'}, context=context) |
827 | + |
828 | if not line.in_line_number and not write_vals.get('imp_external_ref'): |
829 | errors.append(_('The line should have a Line no. or an Ext Ref.')) |
830 | write_vals['in_line_number'] = False |
831 | @@ -1437,15 +1533,17 @@ |
832 | line_treated = 0.00 |
833 | percent_completed = 0.00 |
834 | for line in self.browse(cr, uid, ids, context=context): |
835 | + context['purchase_id'] = line.simu_id.order_id.id |
836 | line_treated += 1 |
837 | percent_completed = int(float(line_treated) / float(nb_lines) * 100) |
838 | - if line.po_line_id and line.type_change != 'del' and not line.change_ok and not line.imp_external_ref and not line.imp_project_ref and not line.imp_origin: |
839 | + if line.po_line_id and line.type_change != 'ignore' and not line.change_ok and not line.imp_external_ref and not line.imp_project_ref and not line.imp_origin: |
840 | continue |
841 | |
842 | - if line.type_change in ('del', 'error'): |
843 | + if line.type_change in ('ignore', 'error'): |
844 | # Don't do anything |
845 | - # i.e. Skype conversation with Raffaelle (08.01.2014) : deletes will need to be done manually after import |
846 | continue |
847 | + elif line.type_change == 'del' and line.po_line_id: |
848 | + line_obj.fake_unlink(cr, uid, [line.po_line_id.id], context=context) |
849 | elif line.type_change == 'split' and line.parent_line_id: |
850 | # Call the split line wizard |
851 | po_line_id = False |
852 | @@ -1524,7 +1622,6 @@ |
853 | 'product_uom': line.imp_uom.id, |
854 | 'price_unit': line.imp_price, |
855 | 'product_qty': line.imp_qty, |
856 | - 'line_number': line.in_line_number, |
857 | 'date_planned': line.imp_drd or line.simu_id.order_id.delivery_requested_date, |
858 | } |
859 | if line.imp_dcd: |
860 | |
861 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml' |
862 | --- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml 2014-10-13 11:03:40 +0000 |
863 | +++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml 2016-10-28 14:28:19 +0000 |
864 | @@ -20,6 +20,7 @@ |
865 | attrs="{'invisible': [('import_error_ok', '!=', False), ('state', '!=', 'done')]}" /> |
866 | <field name="error_filename" invisible="1" /> |
867 | <field name="import_error_ok" invisible="1" /> |
868 | + <field name="with_ad" attrs="{'readonly': [('state', '!=', 'draft')]}" invisible="1" /> |
869 | <field name="percent_completed" widget="progressbar" attrs="{'invisible': [('state', '=', 'draft')]}" /> |
870 | <field name="state" invisible="0" /> |
871 | </group> |
872 | @@ -83,7 +84,7 @@ |
873 | <page string="Details"> |
874 | <!-- LINES --> |
875 | <field name="simu_line_ids" nolabel="1" colspan="4"> |
876 | - <tree string="Lines" colors="grey: type_change == 'del'; red: type_change == 'error'; orange: change_ok==True and type_change not in ('del', 'error'); blue: type_change=='split'; green: type_change=='new'"> |
877 | + <tree string="Lines" colors="grey: type_change == 'del'; red: type_change == 'error'; orange: change_ok==True and type_change not in ('del', 'ignore', 'error'); blue: type_change=='split'; green: type_change=='new'"> |
878 | <field name="in_product_id" /> |
879 | <field name="in_nomen" /> |
880 | <field name="in_comment" /> |
881 | @@ -95,6 +96,7 @@ |
882 | <field name="in_currency" /> |
883 | <field name="in_line_number" invisible="1" /> |
884 | <field name="str_in_line_number" /> |
885 | + <field name="in_ext_ref" /> |
886 | <field name="type_change" /> |
887 | <field name="error_msg" invisible="1" /> |
888 | <button name="get_error_msg" type="object" icon="gtk-dialog-warning" string="See error" attrs="{'invisible': [('error_msg', '=', False)]}" /> |
889 | |
890 | === modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py' |
891 | --- bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2016-07-25 08:20:05 +0000 |
892 | +++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2016-10-28 14:28:19 +0000 |
893 | @@ -374,7 +374,9 @@ |
894 | 'move_uom_id': move.product_uom and move.product_uom.id or False, |
895 | 'move_price_unit': move.price_unit or move.product_id.standard_price, |
896 | 'move_currency_id': move.price_currency_id and move.price_currency_id.id or False, |
897 | - 'line_number': move.line_number, }, context=context) |
898 | + 'line_number': move.line_number, |
899 | + 'external_ref': move.purchase_line_id and move.purchase_line_id.external_ref or False, |
900 | + }, context=context) |
901 | |
902 | return {'type': 'ir.actions.act_window', |
903 | 'res_model': 'wizard.import.in.simulation.screen', |
904 | |
905 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' |
906 | --- bin/addons/msf_profile/i18n/fr_MF.po 2016-10-25 09:13:52 +0000 |
907 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2016-10-28 14:28:19 +0000 |
908 | @@ -18086,19 +18086,47 @@ |
909 | msgid "Available for incoming shipment ?" |
910 | msgstr "Disponible pour envoi entrant ?" |
911 | |
912 | -#. modules: purchase, account, reason_types_moves, stock_override, order_nomenclature, sale, product_asset, specific_rules, purchase_override, supplier_catalogue, base, product_list, tender_flow, msf_supply_doc_export, msf_doc_import, return_claim, analytic_distribution |
913 | +#. modules: tender_flow, product_asset, update_client, register_accounting, return_claim, msf_doc_import, supplier_catalogue, purchase_compare_rfq, product_list, analytic_distribution, reason_types_moves, stock_override, consumption_calculation, purchase_override, specific_rules, kit, base, msf_tools, purchase, account, msf_outgoing, order_nomenclature, msf_field_access_rights, sale, msf_button_access_rights, msf_supply_doc_export |
914 | #: field:account.move.line.reconcile.writeoff,comment:0 |
915 | #: field:account.commitment,notes:0 |
916 | +#: field:account.invoice.line,inactive_error:0 |
917 | #: field:res.groups,comment:0 |
918 | -#: code:addons/msf_doc_import/wizard/__init__.py:45 |
919 | -#: code:addons/msf_doc_import/wizard/__init__.py:50 |
920 | -#: code:addons/msf_doc_import/wizard/__init__.py:55 |
921 | -#: code:addons/msf_doc_import/wizard/wizard_import_po_line.py:183 |
922 | +#: field:real.average.consumption.line,remark:0 |
923 | +#: field:composition.item,inactive_error:0 |
924 | +#: report:kit.report:0 |
925 | +#: field:msf_button_access_rights.button_access_rule,comment:0 |
926 | +#: report:addons/msf_doc_import/report/po_simulation_screen_xls_report.mako:232 |
927 | +#: code:addons/msf_doc_import/wizard/__init__.py:41 |
928 | +#: code:addons/msf_doc_import/wizard/__init__.py:58 |
929 | +#: code:addons/msf_doc_import/wizard/__init__.py:83 |
930 | +#: code:addons/msf_doc_import/wizard/__init__.py:108 |
931 | +#: code:addons/msf_doc_import/wizard/__init__.py:119 |
932 | +#: code:addons/msf_doc_import/wizard/wizard_import_po_line.py:244 |
933 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:67 |
934 | +#: field:initial.stock.inventory.line,inactive_error:0 |
935 | +#: report:po.simulation.screen:0 |
936 | +#: field:purchase.line.import.xml.line,comment:0 |
937 | +#: field:purchase.order.line,inactive_error:0 |
938 | +#: field:sale.order.line,inactive_error:0 |
939 | +#: field:stock.inventory.line,inactive_error:0 |
940 | +#: field:wizard.import.po.simulation.screen.line,imp_comment:0 |
941 | +#: field:wizard.import.po.simulation.screen.line,in_comment:0 |
942 | +#: field:wizard.simu.import.po.line,initial_comment:0 |
943 | +#: field:msf_field_access_rights.field_access_rule,comment:0 |
944 | +#: report:invoice:0 |
945 | +#: field:memory.additionalitems,comment:0 |
946 | +#: report:packing.list:0 |
947 | +#: report:picking.ticket:0 |
948 | +#: field:shipment.additional.line.processor,comment:0 |
949 | +#: field:shipment.additionalitems,comment:0 |
950 | +#: field:stock.move.memory.shipment.additionalitems,comment:0 |
951 | #: report:addons/msf_supply_doc_export/report/product_list_xls.mako:52 |
952 | #: report:addons/msf_supply_doc_export/report/report_internal_request_xls.mako:64 |
953 | #: report:addons/msf_supply_doc_export/report/report_purchase_order_xls.mako:77 |
954 | #: report:addons/msf_supply_doc_export/report/report_request_for_quotation_xls.mako:76 |
955 | #: report:addons/msf_supply_doc_export/report/report_sale_order_xls.mako:77 |
956 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:227 |
957 | +#: field:automated.import.job,comment:0 |
958 | #: field:purchase.order.line,comment:0 |
959 | #: field:purchase.order.merged.line,comment:0 |
960 | #: field:sale.order.line,comment:0 |
961 | @@ -18110,24 +18138,31 @@ |
962 | #: field:old.product.list.line,comment:0 |
963 | #: field:product.list.line,comment:0 |
964 | #: field:purchase.order.line,name:0 |
965 | +#: code:addons/purchase_compare_rfq/wizard/compare_rfq.py:459 |
966 | #: report:msf.purchase.order:0 |
967 | #: report:msf.purchase.quotation:0 |
968 | #: report:purchase.order.merged:0 |
969 | #: field:purchase.order.merged.line,name:0 |
970 | #: field:stock.inventory.line,comment:0 |
971 | #: field:stock.move,comment:0 |
972 | +#: field:account.direct.invoice.wizard.line,inactive_error:0 |
973 | +#: field:wizard.account.invoice.line,inactive_error:0 |
974 | #: field:claim.event,description_claim_event:0 |
975 | +#: report:msf.freight_manifest:0 |
976 | #: report:msf.product_list:0 |
977 | #: report:msf.report_reception_in:0 |
978 | #: report:msf.sale.order:0 |
979 | #: field:sale.order.line,name:0 |
980 | #: field:initial.stock.inventory.line,comment:0 |
981 | #: field:report.stock.move,comment:0 |
982 | +#: report:addons/supplier_catalogue/report/report_supplier_catalogue_lines_xls.mako:77 |
983 | #: view:supplier.catalogue:0 |
984 | #: field:supplier.catalogue,comment:0 |
985 | #: field:supplier.catalogue.line,comment:0 |
986 | +#: report:addons/tender_flow/report/tender_rfq_comparison_xls.mako:552 |
987 | #: field:pricelist.partnerinfo,comment:0 |
988 | #: field:tender.line,comment:0 |
989 | +#: field:sync_client.version,comment:0 |
990 | #, python-format |
991 | msgid "Comment" |
992 | msgstr "Commentaire" |
993 | @@ -27825,17 +27860,28 @@ |
994 | msgid "Macau" |
995 | msgstr "Macau" |
996 | |
997 | -#. modules: purchase, account, sale, register_accounting, purchase_override, purchase_allocation_report |
998 | +#. modules: purchase, account, account_mcdb, procurement_request, purchase_override, sale, account_override, purchase_allocation_report, register_accounting, msf_supply_doc_export |
999 | #: field:account.invoice.line,price_subtotal:0 |
1000 | +#: report:addons/account_mcdb/report/report_account_analytic_line_free_xls.mako:98 |
1001 | +#: report:addons/account_mcdb/report/report_account_analytic_line_free_xls.mako:185 |
1002 | +#: report:addons/account_override/report/open_invoices_xls.mako:361 |
1003 | +#: report:allocation.invoices.report:0 |
1004 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:180 |
1005 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:185 |
1006 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:202 |
1007 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:237 |
1008 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:243 |
1009 | +#: report:procurement.request.report:0 |
1010 | #: field:purchase.order.line,price_subtotal:0 |
1011 | #: view:purchase.report:0 |
1012 | #: field:purchase.report,price_total:0 |
1013 | #: report:po.line.allocation.report:0 |
1014 | #: report:purchase.order.allocation.report:0 |
1015 | -#: report:sale.order.allocation.report:0 |
1016 | #: field:purchase.order.line.allocation.report,subtotal:0 |
1017 | #: field:purchase.order.merged.line,price_subtotal:0 |
1018 | +#: field:account.direct.invoice.wizard.line,price_subtotal:0 |
1019 | #: field:wizard.account.invoice.line,price_subtotal:0 |
1020 | +#: report:sale.order.allocation.report:0 |
1021 | #: field:sale.order.line,price_subtotal:0 |
1022 | msgid "Subtotal" |
1023 | msgstr "Sous-total" |
1024 | @@ -60076,32 +60122,43 @@ |
1025 | msgid "Error at import" |
1026 | msgstr "Error at import" |
1027 | |
1028 | -#. modules: msf_budget, purchase, tender_flow, account_mcdb, msf_homere_interface, account_hq_entries, analytic_distribution, msf_doc_import, financing_contract, purchase_allocation_report, register_accounting |
1029 | +#. modules: msf_budget, purchase, register_accounting, account_mcdb, msf_homere_interface, financing_contract, sale, account_hq_entries, account_override, purchase_allocation_report, tender_flow, msf_supply_doc_export, msf_doc_import, analytic_override, analytic_distribution |
1030 | #: field:hq.analytic.reallocation,cost_center_id:0 |
1031 | #: field:hq.entries,cost_center_id:0 |
1032 | +#: field:hq.entries.split.lines,cost_center_id:0 |
1033 | #: view:account.analytic.line:0 |
1034 | #: view:account.mcdb:0 |
1035 | -#: code:addons/account_mcdb/report/account_mcdb_export.py:167 |
1036 | +#: field:account.mcdb,analytic_account_cc_ids:0 |
1037 | +#: code:addons/account_mcdb/report/account_mcdb_export.py:189 |
1038 | #: report:addons/account_mcdb/report/report_account_analytic_line_xls.mako:66 |
1039 | +#: report:allocation.invoices.report:0 |
1040 | +#: view:account.analytic.line:0 |
1041 | +#: report:addons/analytic_distribution/report/report_account_analytic_chart_export.mako:131 |
1042 | +#: view:analytic.distribution.wizard:0 |
1043 | +#: field:analytic.distribution.wizard.fp.lines,cost_center_id:0 |
1044 | +#: view:analytic.distribution.wizard.lines:0 |
1045 | +#: field:int.commitment.realloc.wizard,cost_center_id:0 |
1046 | #: selection:account.analytic.account,category:0 |
1047 | -#: view:account.analytic.line:0 |
1048 | #: field:account.analytic.line,cost_center_id:0 |
1049 | -#: view:analytic.distribution.wizard:0 |
1050 | -#: field:analytic.distribution.wizard.fp.lines,cost_center_id:0 |
1051 | -#: view:analytic.distribution.wizard.lines:0 |
1052 | +#: report:addons/financing_contract/report/project_expenses_xls.mako:482 |
1053 | #: field:msf.budget,cost_center_id:0 |
1054 | +#: field:msf.doc.import.accounting.lines,cost_center_id:0 |
1055 | #: field:hr.analytic.reallocation,cost_center_id:0 |
1056 | #: field:hr.employee,cost_center_id:0 |
1057 | #: field:hr.payroll.msf,cost_center_id:0 |
1058 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:178 |
1059 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:183 |
1060 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:200 |
1061 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:235 |
1062 | +#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:241 |
1063 | +#: report:po.follow.up_rml:0 |
1064 | #: view:purchase.report:0 |
1065 | +#: report:po.line.allocation.report:0 |
1066 | +#: report:purchase.order.allocation.report:0 |
1067 | +#: view:account.direct.invoice.wizard.lines:0 |
1068 | +#: field:wizard.register.import.lines,cost_center_id:0 |
1069 | +#: report:sale.order.allocation.report:0 |
1070 | #: field:purchase.report,cost_center_id:0 |
1071 | -#: field:account.mcdb,analytic_account_cc_ids:0 |
1072 | -#: report:addons/financing_contract/report/project_expenses_xls.mako:461 |
1073 | -#: field:msf.doc.import.accounting.lines,cost_center_id:0 |
1074 | -#: report:po.line.allocation.report:0 |
1075 | -#: report:sale.order.allocation.report:0 |
1076 | -#: report:purchase.order.allocation.report:0 |
1077 | -#: field:wizard.register.import.lines,cost_center_id:0 |
1078 | #, python-format |
1079 | msgid "Cost Center" |
1080 | msgstr "Centre de Coût" |
1081 | @@ -70659,6 +70716,16 @@ |
1082 | msgid "Ordered qty" |
1083 | msgstr "Qté commandée" |
1084 | |
1085 | +#. module: sales_followup |
1086 | +#: field:sale.order.line.followup,qty_ordered:0 |
1087 | +msgid "Line number" |
1088 | +msgstr "N° de ligne" |
1089 | + |
1090 | +#. module: sales_followup |
1091 | +#: field:sale.order.line.followup,qty_ordered:0 |
1092 | +msgid "Ext. Ref" |
1093 | +msgstr "Ref. ext." |
1094 | + |
1095 | #. module: return_claim |
1096 | #: model:ir.module.module,shortdesc:return_claim.module_meta_information |
1097 | msgid "MSF Return-Claim" |
1098 | @@ -74408,6 +74475,7 @@ |
1099 | #, python-format |
1100 | msgid "The column '%s' is not present in the file." |
1101 | msgstr "La colonne '%s' n'est pas présente dans le fichier." |
1102 | +<<<<<<< TREE |
1103 | |
1104 | #. module: msf_doc_import |
1105 | #: code:addons/msf_doc_import/wizard/wizard_import_batch.py:166 |
1106 | @@ -74689,3 +74757,86 @@ |
1107 | msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')." |
1108 | msgstr "Vous ne pouvez pas exécuter de recherche sur cet objet sans utiliser au moins une recherche exacte (ajoutez le caractère = devant votre filtre)." |
1109 | |
1110 | +======= |
1111 | + |
1112 | +#. module: msf_doc_import |
1113 | +#: field:wizard.export.po.validated,need_ad:0 |
1114 | +msgid "Export AD" |
1115 | +msgstr "Exporter la Distribution Analytique" |
1116 | + |
1117 | +#. module: msf_doc_import |
1118 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:569 |
1119 | +#, python-format |
1120 | +msgid "No line found for line number '%s' and ext. ref. '%s' - Line not imported" |
1121 | +msgstr "Pas de ligne trouvée avec le numéro de ligne '%s' et la réf. externe '%s' - Ligne non importée" |
1122 | + |
1123 | +#. module: msf_doc_import |
1124 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:562 |
1125 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:570 |
1126 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:786 |
1127 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:796 |
1128 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:803 |
1129 | +#, python-format |
1130 | +msgid "Line %s of the file: %s" |
1131 | +msgstr "Ligne %s du fichier : %s" |
1132 | + |
1133 | +#. module: msf_doc_import |
1134 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:56 |
1135 | +#: field:wizard.import.in.line.simulation.screen,external_ref:0 |
1136 | +#: field:wizard.import.po.simulation.screen.line,imp_external_ref:0 |
1137 | +#: field:wizard.import.po.simulation.screen.line,in_ext_ref:0 |
1138 | +#, python-format |
1139 | +msgid "External Ref." |
1140 | +msgstr "Réf. Externe" |
1141 | + |
1142 | +#. module: msf_doc_import |
1143 | +#: field:wizard.import.in.line.simulation.screen,imp_external_ref:0 |
1144 | +msgid "External ref." |
1145 | +msgstr "Réf. Externe" |
1146 | + |
1147 | +#. module: msf_doc_import |
1148 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:1287 |
1149 | +#, python-format |
1150 | +msgid "No original IN lines with external ref '%s' found." |
1151 | +msgstr "Pas de ligne trouvée dans la réception originale avec la réf. externe '%s'." |
1152 | + |
1153 | +#. module: msf_doc_import |
1154 | +#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:1289 |
1155 | +#, python-format |
1156 | +msgid "Line does not correspond to original IN" |
1157 | +msgstr "La ligne ne correspond pas à la réception originale" |
1158 | + |
1159 | +#. module: msf_doc_import |
1160 | +#: field:wizard.import.po.simulation.screen,with_ad:0 |
1161 | +msgid "File contains Analytic Distribution" |
1162 | +msgstr "Le fichier contient une distribution analytique" |
1163 | + |
1164 | +#. module: msf_doc_import |
1165 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:366 |
1166 | +#, python-format |
1167 | +msgid "Error during file to import parsing :: Error: %s" |
1168 | +msgstr "Erreur durant le traitement du fichier importé :: Erreur : %s" |
1169 | + |
1170 | +#. module: msf_doc_import |
1171 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:597 |
1172 | +#, python-format |
1173 | +msgid "Line %s of the imported file: The header information must be on two columns : Column A for name of the field and column B for value." |
1174 | +msgstr "Ligne %s du fichier importé : les informations de l'en-tête doivent être sur deux colonnes : La colonne A pour le nom du champ et la colonne B pour sa valeur." |
1175 | + |
1176 | +#. module: msf_doc_import |
1177 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:1346 |
1178 | +#, python-format |
1179 | +msgid "The import file is inconsistent. Line no. %s is not existing or was previously deleted" |
1180 | +msgstr "Le fichier importé est incohérent. La ligne n° %s n'existe pas ou a été précédemment supprimée" |
1181 | + |
1182 | +#. module: msf_doc_import |
1183 | +#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:1348 |
1184 | +#, python-format |
1185 | +msgid "The import file is inconsistent. The matching line is not existing or was previously deleted" |
1186 | +msgstr "Le fichier importé est incohérent. La ligne correspondante n'existe pas ou a été précédemment supprimée" |
1187 | + |
1188 | +#. module: msf_supply_doc_export |
1189 | +#: report:addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako:102 |
1190 | +msgid "Ext. Reference" |
1191 | +msgstr "Réf. Externe" |
1192 | +>>>>>>> MERGE-SOURCE |
1193 | |
1194 | === modified file 'bin/addons/msf_supply_doc_export/msf_supply_doc_export.py' |
1195 | --- bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2016-03-15 06:38:29 +0000 |
1196 | +++ bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2016-10-28 14:28:19 +0000 |
1197 | @@ -123,6 +123,23 @@ |
1198 | class validated_purchase_order_report_xls(report_sxw.rml_parse): |
1199 | def __init__(self, cr, uid, name, context): |
1200 | super(validated_purchase_order_report_xls, self).__init__(cr, uid, name, context=context) |
1201 | + self.localcontext.update({ |
1202 | + 'time': time, |
1203 | + 'maxADLines': self.get_max_ad_lines, |
1204 | + }) |
1205 | + |
1206 | + def set_context(self, objects, data, ids, report_type = None): |
1207 | + super(validated_purchase_order_report_xls, self).set_context(objects, data, ids, report_type=report_type) |
1208 | + self.localcontext['need_ad'] = data.get('need_ad', True) |
1209 | + |
1210 | + def get_max_ad_lines(self, order): |
1211 | + max_ad_lines = 0 |
1212 | + for line in order.order_line: |
1213 | + if line.analytic_distribution_id: |
1214 | + if len(line.analytic_distribution_id.cost_center_lines) > max_ad_lines: |
1215 | + max_ad_lines = len(line.analytic_distribution_id.cost_center_lines) |
1216 | + |
1217 | + return max_ad_lines |
1218 | |
1219 | SpreadsheetReport('report.validated.purchase.order_xls', 'purchase.order', 'addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako', parser=validated_purchase_order_report_xls) |
1220 | |
1221 | @@ -130,6 +147,23 @@ |
1222 | class parser_validated_purchase_order_report_xml(report_sxw.rml_parse): |
1223 | def __init__(self, cr, uid, name, context): |
1224 | super(parser_validated_purchase_order_report_xml, self).__init__(cr, uid, name, context=context) |
1225 | + self.localcontext.update({ |
1226 | + 'time': time, |
1227 | + 'maxADLines': self.get_max_ad_lines, |
1228 | + }) |
1229 | + |
1230 | + def set_context(self, objects, data, ids, report_type = None): |
1231 | + super(parser_validated_purchase_order_report_xml, self).set_context(objects, data, ids, report_type=report_type) |
1232 | + self.localcontext['need_ad'] = data.get('need_ad', True) |
1233 | + |
1234 | + def get_max_ad_lines(self, order): |
1235 | + max_ad_lines = 0 |
1236 | + for line in order.order_line: |
1237 | + if line.analytic_distribution_id: |
1238 | + if len(line.analytic_distribution_id.cost_center_lines) > max_ad_lines: |
1239 | + max_ad_lines = len(line.analytic_distribution_id.cost_center_lines) |
1240 | + |
1241 | + return max_ad_lines |
1242 | |
1243 | class validated_purchase_order_report_xml(WebKitParser): |
1244 | def __init__(self, name, table, rml=False, parser=report_sxw.rml_parse, header='external', store=False): |
1245 | |
1246 | === modified file 'bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako' |
1247 | --- bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako 2015-01-28 14:08:10 +0000 |
1248 | +++ bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako 2016-10-28 14:28:19 +0000 |
1249 | @@ -98,7 +98,8 @@ |
1250 | </Row> |
1251 | |
1252 | <Row> |
1253 | - <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number*')}</Data></Cell> |
1254 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number')}</Data></Cell> |
1255 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Reference')}</Data></Cell> |
1256 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Code*')}</Data></Cell> |
1257 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Description')}</Data></Cell> |
1258 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Qty*')}</Data></Cell> |
1259 | @@ -114,6 +115,7 @@ |
1260 | % for line in o.move_lines: |
1261 | <Row> |
1262 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.line_number or '')|x}</Data></Cell> |
1263 | + <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.purchase_line_id and line.purchase_line_id.external_ref or '')|x}</Data></Cell> |
1264 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.product_id and line.product_id.default_code or '')|x}</Data></Cell> |
1265 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.product_id and line.product_id.name or '')|x}</Data></Cell> |
1266 | <Cell ss:StyleID="line" ><Data ss:Type="Number">${(line.product_qty or '')|x}</Data></Cell> |
1267 | |
1268 | === modified file 'bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako' |
1269 | --- bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako 2014-01-15 11:12:34 +0000 |
1270 | +++ bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako 2016-10-28 14:28:19 +0000 |
1271 | @@ -15,6 +15,7 @@ |
1272 | % for l in o.move_lines: |
1273 | <record> |
1274 | <field name="line_number">${l.line_number or ''}</field> |
1275 | + <field name="external_ref">${l.purchase_line_id and l.purchase_line_id.external_ref or ''}</field> |
1276 | <field name="product_id" key="default_code,name"> |
1277 | <field name="product_code">${l.product_id and l.product_id.default_code or ''}</field> |
1278 | <field name="product_name">${l.product_id and l.product_id.name or ''}</field> |
1279 | |
1280 | === modified file 'bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako' |
1281 | --- bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako 2014-01-10 10:50:00 +0000 |
1282 | +++ bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako 2016-10-28 14:28:19 +0000 |
1283 | @@ -32,6 +32,10 @@ |
1284 | </Borders> |
1285 | <Protection /> |
1286 | </Style> |
1287 | + <Style ss:ID="line_wb"> |
1288 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> |
1289 | + <Protection ss:Protected="0" /> |
1290 | + </Style> |
1291 | <Style ss:ID="line"> |
1292 | <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/> |
1293 | <Borders> |
1294 | @@ -57,7 +61,8 @@ |
1295 | ## ==================================== we loop over the purchase_order "objects" == purchase_order ==================================================== |
1296 | % for o in objects: |
1297 | <ss:Worksheet ss:Name="${"%s"%(o.name.split('/')[-1] or 'Sheet1')|x}" ss:Protected="1"> |
1298 | -## definition of the columns' size |
1299 | + ## definition of the columns' size |
1300 | +<% max_ad_lines = maxADLines(o) %> |
1301 | <% nb_of_columns = 17 %> |
1302 | <Table x:FullColumns="1" x:FullRows="1"> |
1303 | <Column ss:AutoFitWidth="1" ss:Width="120" /> |
1304 | @@ -165,7 +170,45 @@ |
1305 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Message ESC Header')}</Data></Cell> |
1306 | <Cell ss:StyleID="line" ><Data ss:Type="String">${o.message_esc or ''|x}</Data></Cell> |
1307 | </Row> |
1308 | - |
1309 | + |
1310 | + % if need_ad and o.analytic_distribution_id: |
1311 | + <Row> |
1312 | + <Cell ss:MergeDown="1" ss:StyleID="header" ><Data ss:Type="String">${_('Analytic Distribution')}</Data></Cell> |
1313 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell> |
1314 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell> |
1315 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell> |
1316 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell> |
1317 | + % for x in range(1, len(o.analytic_distribution_id.cost_center_lines)): |
1318 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell> |
1319 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell> |
1320 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell> |
1321 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell> |
1322 | + % endfor |
1323 | + </Row> |
1324 | + <Row> |
1325 | + % for i, ccl in enumerate(o.analytic_distribution_id.cost_center_lines): |
1326 | + <Cell ss:Index="${(i*4+2)|x}" ss:StyleID="line" ><Data ss:Type="String">${(ccl.destination_id.code or '')|x}</Data></Cell> |
1327 | + <Cell ss:Index="${(i*4+3)|x}" ss:StyleID="line" ><Data ss:Type="String">${(ccl.analytic_id.code or '')|x}</Data></Cell> |
1328 | + <Cell ss:Index="${(i*4+4)|x}" ss:StyleID="line" ><Data ss:Type="Number">${(ccl.percentage or 0.00)|x}</Data></Cell> |
1329 | + <Cell ss:Index="${(i*4+5)|x}" ss:StyleID="line" ><Data ss:Type="Number">${((ccl.percentage/100.00)*o.amount_total or 0.00)|x}</Data></Cell> |
1330 | + % endfor |
1331 | + </Row> |
1332 | + % else: |
1333 | + <Row> |
1334 | + <Cell ss:MergeDown="1" ss:StyleID="header" ><Data ss:Type="String">${_('Analytic Distribution')}</Data></Cell> |
1335 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell> |
1336 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell> |
1337 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell> |
1338 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell> |
1339 | + </Row> |
1340 | + <Row> |
1341 | + <Cell ss:Index="2" ss:StyleID="line" /> |
1342 | + <Cell ss:Index="3" ss:StyleID="line" /> |
1343 | + <Cell ss:Index="4" ss:StyleID="line" /> |
1344 | + <Cell ss:Index="5" ss:StyleID="line" /> |
1345 | + </Row> |
1346 | + % endif |
1347 | + |
1348 | <Row> |
1349 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number')}</Data></Cell> |
1350 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Ref.')}</Data></Cell> |
1351 | @@ -186,8 +229,22 @@ |
1352 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Project Ref')}</Data></Cell> |
1353 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('ESC Message 1')}</Data></Cell> |
1354 | <Cell ss:StyleID="header" ><Data ss:Type="String">${_('ESC Message 2')}</Data></Cell> |
1355 | + % if max_ad_lines: |
1356 | + % for x in range(1, max_ad_lines+1): |
1357 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell> |
1358 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell> |
1359 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell> |
1360 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell> |
1361 | + % endfor |
1362 | + % else: |
1363 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell> |
1364 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell> |
1365 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell> |
1366 | + <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell> |
1367 | + % endif |
1368 | </Row> |
1369 | % for line in o.order_line: |
1370 | + <% len_cc_lines = line.analytic_distribution_id and len(line.analytic_distribution_id.cost_center_lines) or 0 %> |
1371 | <Row> |
1372 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.line_number or '')|x}</Data></Cell> |
1373 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.external_ref or '')|x}</Data></Cell> |
1374 | @@ -222,6 +279,27 @@ |
1375 | <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.fnct_project_ref or '')|x}</Data></Cell> |
1376 | <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1377 | <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1378 | + % if need_ad: |
1379 | + % if line.analytic_distribution_id: |
1380 | + % for ccl in line.analytic_distribution_id.cost_center_lines: |
1381 | + <Cell ss:StyleID="line" ><Data ss:Type="String">${(ccl.destination_id.code or '')|x}</Data></Cell> |
1382 | + <Cell ss:StyleID="line" ><Data ss:Type="String">${(ccl.analytic_id.code or '')|x}</Data></Cell> |
1383 | + <Cell ss:StyleID="line" ><Data ss:Type="Number">${(ccl.percentage or 0.00)|x}</Data></Cell> |
1384 | + <Cell ss:StyleID="line" ><Data ss:Type="Number">${((ccl.percentage/100.00) * line.price_subtotal or 0.00)|x}</Data></Cell> |
1385 | + % endfor |
1386 | + % for x in range(0, max_ad_lines-len_cc_lines): |
1387 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1388 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1389 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1390 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1391 | + % endfor |
1392 | + % endif |
1393 | + % else: |
1394 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1395 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1396 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1397 | + <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell> |
1398 | + % endif |
1399 | </Row> |
1400 | % endfor |
1401 | </Table> |
1402 | |
1403 | === modified file 'bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako' |
1404 | --- bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako 2014-11-05 09:11:22 +0000 |
1405 | +++ bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako 2016-10-28 14:28:19 +0000 |
1406 | @@ -42,6 +42,16 @@ |
1407 | <field name="origin">${o.origin or ''|x}</field> |
1408 | <field name="project_ref">${o.fnct_project_ref or ''|x}</field> |
1409 | <field name="message_esc">${o.message_esc or ''|x}</field> |
1410 | + <field name="analytic_distribution_id"> |
1411 | + % if need_ad and o.analytic_distribution_id: |
1412 | + % for ccl in o.analytic_distribution_id.cost_center_lines: |
1413 | + <field name="ad_destination_name">${(ccl.destination_id.name or '')|x}</field> |
1414 | + <field name="ad_cost_center_name">${(ccl.analytic_id.name or '')|x}</field> |
1415 | + <field name="ad_percentage">${(ccl.percentage or 0.00)|x}</field> |
1416 | + <field name="ad_subtotal">${((ccl.percentage/100.00)*o.amount_total or 0.00)|x}</field> |
1417 | + % endfor |
1418 | + % endif |
1419 | + </field> |
1420 | <field name="order_line"> |
1421 | % for l in o.order_line: |
1422 | <record> |
1423 | @@ -84,6 +94,16 @@ |
1424 | <field name="project_ref">${l.fnct_project_ref or ''|x}</field> |
1425 | <field name="message_esc1"></field> |
1426 | <field name="message_esc2"></field> |
1427 | + <field name="analytic_distribution_id"> |
1428 | + % if need_ad and l.analytic_distribution_id: |
1429 | + % for ccl in l.analytic_distribution_id.cost_center_lines: |
1430 | + <field name="ad_destination_name">${(ccl.destination_id.name or '')|x}</field> |
1431 | + <field name="ad_cost_center_name">${(ccl.analytic_id.name or '')|x}</field> |
1432 | + <field name="ad_percentage">${(ccl.percentage or 0.00)|x}</field> |
1433 | + <field name="ad_subtotal">${((ccl.percentage/100.00)*l.price_subtotal or 0.00)|x}</field> |
1434 | + % endfor |
1435 | + % endif |
1436 | + </field> |
1437 | </record> |
1438 | % endfor |
1439 | </field> |