Merge lp:~dorian-kemps/unifield-server/US-6031 into lp:unifield-server
- US-6031
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 5465 |
Proposed branch: | lp:~dorian-kemps/unifield-server/US-6031 |
Merge into: | lp:unifield-server |
Diff against target: |
989 lines (+701/-4) (has conflicts) 11 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+114/-2) bin/addons/stock/__openerp__.py (+2/-0) bin/addons/stock/report/__init__.py (+1/-0) bin/addons/stock/report/products_situation_report_view.xml (+1/-1) bin/addons/stock/report/stock_delivery_report.py (+85/-0) bin/addons/stock/report/stock_delivery_report_view.xml (+18/-0) bin/addons/stock/report/stock_delivery_report_xls.mako (+281/-0) bin/addons/stock/report/stock_expired_damaged_report_view.xml (+1/-1) bin/addons/stock/wizard/__init__.py (+1/-0) bin/addons/stock/wizard/stock_delivery_wizard.py (+155/-0) bin/addons/stock/wizard/stock_delivery_wizard_view.xml (+42/-0) Text conflict in bin/addons/msf_profile/i18n/fr_MF.po |
To merge this branch: | bzr merge lp:~dorian-kemps/unifield-server/US-6031 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+370773@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_profile/i18n/fr_MF.po' |
2 | --- bin/addons/msf_profile/i18n/fr_MF.po 2019-08-08 14:10:40 +0000 |
3 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2019-08-09 14:01:53 +0000 |
4 | @@ -3676,6 +3676,7 @@ |
5 | #: report:addons/stock/report/stock_reception_report_xls.mako:204 |
6 | #: report:addons/stock/report/stock_reception_report_xls.mako:230 |
7 | #: field:stock.reception.wizard,order_category:0 |
8 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:213 |
9 | msgid "Order Category" |
10 | msgstr "Catégorie de Commande" |
11 | |
12 | @@ -4790,7 +4791,11 @@ |
13 | #: view:account.invoice:0 |
14 | #: field:internal.request.import.line,ir_line_id:0 |
15 | #: report:addons/stock/report/stock_reception_report_xls.mako:236 |
16 | +<<<<<<< TREE |
17 | #: code:addons/msf_supply_doc_export/msf_supply_doc_export.py:883 |
18 | +======= |
19 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:215 |
20 | +>>>>>>> MERGE-SOURCE |
21 | #, python-format |
22 | msgid "Line" |
23 | msgstr "Ligne" |
24 | @@ -16768,6 +16773,8 @@ |
25 | #: report:addons/stock/report/stock_reception_report_xls.mako:245 |
26 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:228 |
27 | #: field:stock.picking,destinations_list:0 |
28 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:198 |
29 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:224 |
30 | #, python-format |
31 | msgid "Destination Location" |
32 | msgstr "Zone Destination" |
33 | @@ -19612,7 +19619,13 @@ |
34 | #: view:stock.move:0 |
35 | #: view:manage.expired.stock:0 |
36 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:227 |
37 | +<<<<<<< TREE |
38 | #: field:change.dest.location,src_location_id:0 |
39 | +======= |
40 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:194 |
41 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:223 |
42 | +#: field:stock.delivery.wizard,location_id:0 |
43 | +>>>>>>> MERGE-SOURCE |
44 | #, python-format |
45 | msgid "Source Location" |
46 | msgstr "Zone Source" |
47 | @@ -26888,6 +26901,7 @@ |
48 | #: view:stock.reception.wizard:0 |
49 | #: view:products.situation.report:0 |
50 | #: view:supplier.performance.wizard:0 |
51 | +#: view:stock.delivery.wizard:0 |
52 | msgid "Excel report" |
53 | msgstr "Rapport Excel" |
54 | |
55 | @@ -27269,7 +27283,11 @@ |
56 | #: field:stock.reserved.products,product_qty:0 |
57 | #: report:addons/specific_rules/report/report_stock_inventory_xls.mako:228 |
58 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:221 |
59 | +<<<<<<< TREE |
60 | #: report:tracking.move.report:0 |
61 | +======= |
62 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:219 |
63 | +>>>>>>> MERGE-SOURCE |
64 | #, python-format |
65 | msgid "Qty" |
66 | msgstr "Qté" |
67 | @@ -31133,6 +31151,7 @@ |
68 | #: report:addons/msf_supply_doc_export/report/supplier_performance_report_xls.mako:187 |
69 | #: field:supplier.performance.wizard,report_date:0 |
70 | #: code:addons/stock_override/report/report_stock_move.py:738 |
71 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:156 |
72 | msgid "Generated on" |
73 | msgstr "Généré le" |
74 | |
75 | @@ -38534,6 +38553,33 @@ |
76 | msgid "Male" |
77 | msgstr "Masculin" |
78 | |
79 | +<<<<<<< TREE |
80 | +======= |
81 | +#. modules: stock, account, sale, finance, purchase_followup, msf_homere_interface, procurement_request, specific_rules, order_types, msf_supply_doc_export |
82 | +#: report:hr.payment.order.report:0 |
83 | +#: field:cash.request.expense,currency_id:0 |
84 | +#: view:cash.request.liquidity.bank:0 |
85 | +#: view:cash.request.liquidity.cash:0 |
86 | +#: view:cash.request.liquidity.cheque:0 |
87 | +#: field:cash.request.total.transfer.line,currency_id:0 |
88 | +#: field:cash.request.transfer.currency,currency_id:0 |
89 | +#: report:addons/purchase_followup/report/po_track_changes_report_xls.mako:242 |
90 | +#: report:addons/sale/report/sale_loan_stock_moves_report_xls.mako:174 |
91 | +#: field:physical.inventory.counting,currency_id:0 |
92 | +#: field:physical.inventory.discrepancy,currency_id:0 |
93 | +#: report:addons/procurement_request/report/internal_request_import_overview_export_xls.mako:219 |
94 | +#: field:internal.request.import,in_currency:0 |
95 | +#: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:201 |
96 | +#: report:addons/specific_rules/report/report_stock_inventory_xls.mako:204 |
97 | +#: report:addons/stock/report/stock_reception_report_xls.mako:243 |
98 | +#: report:addons/stock/report/stock_expired_damaged_report_xls.mako:225 |
99 | +#: report:order.type.donation.certificate:0 |
100 | +#: report:addons/msf_supply_doc_export/report/supplier_performance_report_xls.mako:238 |
101 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:221 |
102 | +msgid "Currency" |
103 | +msgstr "Devise" |
104 | + |
105 | +>>>>>>> MERGE-SOURCE |
106 | #. module: sale |
107 | #: code:addons/sale/sale_order.py:2979 |
108 | #: code:addons/sale/sale_order.py:2980 |
109 | @@ -40695,6 +40741,7 @@ |
110 | #: report:addons/specific_rules/report/report_stock_inventory_xls.mako:148 |
111 | #: report:addons/stock/report/products_situation_report_xls.mako:218 |
112 | #: code:addons/stock_override/report/report_stock_move.py:759 |
113 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:218 |
114 | #, python-format |
115 | msgid "UoM" |
116 | msgstr "UdM" |
117 | @@ -43788,6 +43835,7 @@ |
118 | #: field:tender.line,product_code:0 |
119 | #: report:addons/msf_supply_doc_export/report/supplier_performance_report_xls.mako:233 |
120 | #: code:addons/stock_override/report/report_stock_move.py:759 |
121 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:216 |
122 | #, python-format |
123 | msgid "Product Code" |
124 | msgstr "Code Produit" |
125 | @@ -48726,6 +48774,7 @@ |
126 | #: view:stock.reception.wizard:0 |
127 | #: view:stock.expired.damaged.report:0 |
128 | #: view:supplier.performance.wizard:0 |
129 | +#: view:stock.delivery.wizard:0 |
130 | msgid "Request parameters" |
131 | msgstr "Paramètres de la requête" |
132 | |
133 | @@ -49817,6 +49866,9 @@ |
134 | #: report:addons/stock/report/reserved_products_report_xls.mako:162 |
135 | #: report:addons/stock/report/stock_reception_report_xls.mako:200 |
136 | #: field:stock.reception.wizard,partner_id:0 |
137 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:186 |
138 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:211 |
139 | +#: field:stock.delivery.wizard,partner_id:0 |
140 | #, python-format |
141 | msgid "Partner" |
142 | msgstr "Partenaire" |
143 | @@ -55092,8 +55144,10 @@ |
144 | #. module: consumption_calculation, stock |
145 | #: field:product.history.consumption.month,date_from:0 |
146 | #: field:stock.reception.wizard,start_date:0 |
147 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:170 |
148 | +#: field:stock.delivery.wizard,start_date:0 |
149 | msgid "Date from" |
150 | -msgstr "Date à partir de" |
151 | +msgstr "Date du" |
152 | |
153 | #. module: register_accounting |
154 | #: code:addons/register_accounting/account_bank_statement.py:728 |
155 | @@ -61987,11 +62041,15 @@ |
156 | #: report:addons/stock/report/stock_reception_report_xls.mako:225 |
157 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:215 |
158 | #: report:addons/msf_supply_doc_export/report/report_pick_export_xls.mako:93 |
159 | +<<<<<<< TREE |
160 | #: code:addons/mission_stock/mission_stock.py:51 |
161 | #: code:addons/mission_stock/mission_stock.py:63 |
162 | #: code:addons/mission_stock/mission_stock.py:78 |
163 | #: code:addons/mission_stock/mission_stock.py:91 |
164 | #: code:addons/mission_stock/mission_stock.py:510 |
165 | +======= |
166 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:207 |
167 | +>>>>>>> MERGE-SOURCE |
168 | #, python-format |
169 | msgid "Reference" |
170 | msgstr "Référence" |
171 | @@ -62565,7 +62623,11 @@ |
172 | #: report:addons/stock/report/stock_reception_report_xls.mako:208 |
173 | #: report:addons/stock/report/stock_reception_report_xls.mako:229 |
174 | #: field:stock.reception.wizard,order_type:0 |
175 | +<<<<<<< TREE |
176 | #: code:addons/msf_supply_doc_export/msf_supply_doc_export.py:882 |
177 | +======= |
178 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:212 |
179 | +>>>>>>> MERGE-SOURCE |
180 | msgid "Order Type" |
181 | msgstr "Type de Commande" |
182 | |
183 | @@ -65209,8 +65271,10 @@ |
184 | #. module: consumption_calculation, stock |
185 | #: field:product.history.consumption.month,date_to:0 |
186 | #: field:stock.reception.wizard,end_date:0 |
187 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:178 |
188 | +#: field:stock.delivery.wizard,end_date:0 |
189 | msgid "Date to" |
190 | -msgstr "Date à" |
191 | +msgstr "Date au" |
192 | |
193 | #. module: sale |
194 | #: model:process.node,name:sale.process_node_saleprocurement0 |
195 | @@ -75464,7 +75528,11 @@ |
196 | #: field:internal.request.import,in_origin:0 |
197 | #: report:addons/procurement_request/report/internal_request_import_overview_export_xls.mako:205 |
198 | #: report:addons/stock/report/stock_reception_report_xls.mako:234 |
199 | +<<<<<<< TREE |
200 | #: report:tracking.move.report:0 |
201 | +======= |
202 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:210 |
203 | +>>>>>>> MERGE-SOURCE |
204 | #, python-format |
205 | msgid "Origin" |
206 | msgstr "Origine" |
207 | @@ -76313,6 +76381,7 @@ |
208 | #: report:addons/specific_rules/report/report_stock_inventory_xls.mako:147 |
209 | #: report:addons/msf_supply_doc_export/report/supplier_performance_report_xls.mako:234 |
210 | #: code:addons/stock_override/report/report_stock_move.py:759 |
211 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:217 |
212 | #, python-format |
213 | msgid "Product Description" |
214 | msgstr "Description Produit" |
215 | @@ -77098,6 +77167,7 @@ |
216 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:224 |
217 | #: code:addons/consumption_calculation/weekly_forecast_report.py:506 |
218 | #: report:order.type.donation.certificate:0 |
219 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:220 |
220 | #, python-format |
221 | msgid "Unit Price" |
222 | msgstr "Prix Unitaire" |
223 | @@ -81996,6 +82066,7 @@ |
224 | #: view:stock.expired.damaged.report:0 |
225 | #: report:addons/stock_override/report/report_stock_move_xls.mako:144 |
226 | #: code:addons/stock_override/report/report_stock_move.py:759 |
227 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:208 |
228 | msgid "Reason Type" |
229 | msgstr "Raison - Type" |
230 | |
231 | @@ -82035,6 +82106,7 @@ |
232 | #: field:report.stock.move,location_dest_id:0 |
233 | #: field:stock.picking,location_dest_id:0 |
234 | #: field:stock.reception.wizard,location_dest_id:0 |
235 | +#: field:stock.delivery.wizard,location_dest_id:0 |
236 | msgid "Dest. Location" |
237 | msgstr "Zone Dest." |
238 | |
239 | @@ -89965,6 +90037,7 @@ |
240 | #: field:stock.expired.damaged.report,company_id:0 |
241 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:166 |
242 | #: report:addons/msf_supply_doc_export/report/supplier_performance_report_xls.mako:183 |
243 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:152 |
244 | msgid "DB/Instance name" |
245 | msgstr "DB/Nom de l'Instance" |
246 | |
247 | @@ -93194,6 +93267,7 @@ |
248 | #: report:addons/stock/report/stock_expired_damaged_report_xls.mako:229 |
249 | #: field:internal.request.import,imp_creation_date:0 |
250 | #: report:addons/stock/report/products_situation_report_xls.mako:221 |
251 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:225 |
252 | msgid "Creation Date" |
253 | msgstr "Date de Création" |
254 | |
255 | @@ -102379,6 +102453,7 @@ |
256 | #. module: stock |
257 | #: report:addons/stock/report/reserved_products_report_xls.mako:139 |
258 | #: report:addons/stock/report/stock_reception_report_xls.mako:177 |
259 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:167 |
260 | msgid "FILTERS" |
261 | msgstr "FILTRES" |
262 | |
263 | @@ -104329,6 +104404,8 @@ |
264 | #: field:stock.expired.damaged.report,nomen_manda_0:0 |
265 | #: report:addons/stock/report/stock_reception_report_xls.mako:212 |
266 | #: field:stock.reception.wizard,nomen_manda_0:0 |
267 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:190 |
268 | +#: field:stock.delivery.wizard,nomen_manda_0:0 |
269 | msgid "Product Main Type" |
270 | msgstr "Type Principal du Produit" |
271 | |
272 | @@ -104356,6 +104433,7 @@ |
273 | |
274 | #. module: stock |
275 | #: report:addons/stock/report/stock_reception_report_xls.mako:231 |
276 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:214 |
277 | msgid "Order Priority" |
278 | msgstr "Priorité de la Commande" |
279 | |
280 | @@ -106875,6 +106953,7 @@ |
281 | #: field:stock.card.wizard.line,partner_or_loc:0 |
282 | msgid "Partner/Location" |
283 | msgstr "Partneraire/Zone" |
284 | +<<<<<<< TREE |
285 | |
286 | #. module: msf_printed_documents |
287 | #: code:addons/msf_printed_documents/report/report_product_labels.py:67 |
288 | @@ -107228,3 +107307,36 @@ |
289 | #: field:hr.employee.activation,active_status:0 |
290 | msgid "Set selected employees as active" |
291 | msgstr "Marquer les employés sélectionnés comme actifs" |
292 | +======= |
293 | + |
294 | +#. module: stock |
295 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:149 |
296 | +msgid "DELIVERIES REPORT" |
297 | +msgstr "RAPPORT DES LIVRAISONS" |
298 | + |
299 | +#. module: stock |
300 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:104 |
301 | +#: code:addons/stock/wizard/stock_delivery_wizard.py:139 |
302 | +#: model:ir.actions.act_window,name:stock.action_stock_delivery_wizard |
303 | +#: model:ir.actions.report.xml,name:stock.report_stock_delivery_report_xls |
304 | +#: model:ir.ui.menu,name:stock.menu_stock_delivery_wizard |
305 | +#: view:stock.delivery.wizard:0 |
306 | +#, python-format |
307 | +msgid "Deliveries Report" |
308 | +msgstr "Rapport des Livraisons" |
309 | + |
310 | +#. module: stock |
311 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:209 |
312 | +msgid "SHIP" |
313 | +msgstr "Expédition" |
314 | + |
315 | +#. module: stock |
316 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:222 |
317 | +msgid "Total Currency" |
318 | +msgstr "Total dans la Devise" |
319 | + |
320 | +#. module: stock |
321 | +#: report:addons/stock/report/stock_delivery_report_xls.mako:226 |
322 | +msgid "Shipped Date" |
323 | +msgstr "Date d'Expédition" |
324 | +>>>>>>> MERGE-SOURCE |
325 | |
326 | === modified file 'bin/addons/stock/__openerp__.py' |
327 | --- bin/addons/stock/__openerp__.py 2019-03-14 15:51:48 +0000 |
328 | +++ bin/addons/stock/__openerp__.py 2019-08-09 14:01:53 +0000 |
329 | @@ -86,6 +86,8 @@ |
330 | "report/stock_reception_report_view.xml", |
331 | "report/stock_expired_damaged_report_view.xml", |
332 | "report/products_situation_report_view.xml", |
333 | + "wizard/stock_delivery_wizard_view.xml", |
334 | + "report/stock_delivery_report_view.xml", |
335 | ], |
336 | 'installable': True, |
337 | 'active': False, |
338 | |
339 | === modified file 'bin/addons/stock/report/__init__.py' |
340 | --- bin/addons/stock/report/__init__.py 2019-03-14 15:51:48 +0000 |
341 | +++ bin/addons/stock/report/__init__.py 2019-08-09 14:01:53 +0000 |
342 | @@ -34,3 +34,4 @@ |
343 | import stock_reception_report |
344 | import stock_expired_damaged_report |
345 | import products_situation_report |
346 | +import stock_delivery_report |
347 | |
348 | === modified file 'bin/addons/stock/report/products_situation_report_view.xml' |
349 | --- bin/addons/stock/report/products_situation_report_view.xml 2019-05-10 15:21:38 +0000 |
350 | +++ bin/addons/stock/report/products_situation_report_view.xml 2019-08-09 14:01:53 +0000 |
351 | @@ -54,7 +54,7 @@ |
352 | id="menu_products_situation_report" |
353 | action="action_products_situation_report" |
354 | parent="stock.next_id_61" |
355 | - sequence="11" |
356 | + sequence="12" |
357 | /> |
358 | |
359 | <report |
360 | |
361 | === added file 'bin/addons/stock/report/stock_delivery_report.py' |
362 | --- bin/addons/stock/report/stock_delivery_report.py 1970-01-01 00:00:00 +0000 |
363 | +++ bin/addons/stock/report/stock_delivery_report.py 2019-08-09 14:01:53 +0000 |
364 | @@ -0,0 +1,85 @@ |
365 | +# -*- coding: utf-8 -*- |
366 | + |
367 | +from report import report_sxw |
368 | +from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport |
369 | + |
370 | + |
371 | +class stock_delivery_report(report_sxw.rml_parse): |
372 | + def __init__(self, cr, uid, name, context): |
373 | + super(stock_delivery_report, self).__init__(cr, uid, name, context=context) |
374 | + self.localcontext.update({ |
375 | + 'parseDateXls': self._parse_date_xls, |
376 | + 'getMoves': self.get_moves, |
377 | + }) |
378 | + |
379 | + self._order_iterator = 0 |
380 | + self._nb_orders = 0 |
381 | + if context.get('background_id'): |
382 | + self.back_browse = self.pool.get('memory.background.report').browse(self.cr, self.uid, context['background_id']) |
383 | + else: |
384 | + self.back_browse = None |
385 | + |
386 | + def _parse_date_xls(self, dt_str, is_datetime=True): |
387 | + if not dt_str or dt_str == 'False': |
388 | + return '' |
389 | + if is_datetime: |
390 | + dt_str = dt_str[0:10] if len(dt_str) >= 10 else '' |
391 | + if dt_str: |
392 | + dt_str += 'T00:00:00.000' |
393 | + return dt_str |
394 | + |
395 | + def get_moves(self, moves_ids): |
396 | + move_obj = self.pool.get('stock.move') |
397 | + res = [] |
398 | + |
399 | + self._nb_orders = len(moves_ids) |
400 | + |
401 | + for move in move_obj.browse(self.cr, self.uid, moves_ids, context=self.localcontext): |
402 | + pick = move.picking_id |
403 | + ppl = pick.subtype == 'packing' and pick.previous_step_id or False |
404 | + ship = pick.shipment_id |
405 | + fo = pick.sale_id or False |
406 | + prod = move.product_id |
407 | + price = prod and prod.standard_price |
408 | + currency = prod and prod.currency_id or False |
409 | + curr_price = self.pool.get('res.currency').compute(self.cr, self.uid, move.price_currency_id.id, currency |
410 | + and currency.id or False, price, context=self.localcontext) |
411 | + res.append({ |
412 | + 'ref': ppl and ppl.name or pick.name, |
413 | + 'reason_type': ppl and ppl.reason_type_id.complete_name or pick.reason_type_id |
414 | + and pick.reason_type_id.complete_name or '', |
415 | + 'ship': ship and ship.name or '', |
416 | + 'origin': pick.origin or '', |
417 | + 'partner': pick.partner_id and pick.partner_id.name or '', |
418 | + 'fo': fo, |
419 | + 'header': ppl or pick, |
420 | + 'line_num': move.line_number, |
421 | + 'prod_code': prod and prod.default_code or '', |
422 | + 'prod_desc': prod and prod.name or '', |
423 | + 'prod_uom': move.product_uom and move.product_uom.name or '', |
424 | + 'qty': move.product_qty, |
425 | + 'price': price, |
426 | + 'currency': currency and currency.name or '', |
427 | + 'total_currency': price and curr_price * move.product_qty, |
428 | + 'location': ppl and move.backmove_id and move.backmove_id.location_id |
429 | + and move.backmove_id.location_id.name or move.location_id.name or '', |
430 | + 'destination': ppl and pick.partner_id.name or fo and not fo.procurement_request and fo.partner_id.name |
431 | + or move.location_dest_id.name or '', |
432 | + 'create_date': pick.date, |
433 | + 'shipped_date': ppl and ship and ship.shipment_expected_date or pick.date_done, |
434 | + }) |
435 | + |
436 | + self._order_iterator += 1 |
437 | + if self.back_browse: |
438 | + percent = float(self._order_iterator) / float(self._nb_orders) |
439 | + self.pool.get('memory.background.report').update_percent(self.cr, self.uid, [self.back_browse.id], percent) |
440 | + |
441 | + return res |
442 | + |
443 | + |
444 | +SpreadsheetReport( |
445 | + 'report.stock.delivery.report_xls', |
446 | + 'stock.delivery.wizard', |
447 | + 'stock/report/stock_delivery_report_xls.mako', |
448 | + parser=stock_delivery_report |
449 | +) |
450 | |
451 | === added file 'bin/addons/stock/report/stock_delivery_report_view.xml' |
452 | --- bin/addons/stock/report/stock_delivery_report_view.xml 1970-01-01 00:00:00 +0000 |
453 | +++ bin/addons/stock/report/stock_delivery_report_view.xml 2019-08-09 14:01:53 +0000 |
454 | @@ -0,0 +1,18 @@ |
455 | +<?xml version="1.0" encoding="utf-8" ?> |
456 | +<openerp> |
457 | + <data> |
458 | + |
459 | + <report |
460 | + id="report_stock_delivery_report_xls" |
461 | + name="stock.delivery.report_xls" |
462 | + model="stock.delivery.wizard" |
463 | + string="Deliveries Report" |
464 | + file="stock/report/stock_delivery_report_xls.mako" |
465 | + report_type="webkit" |
466 | + header="False" |
467 | + auto="False" |
468 | + menu="False" |
469 | + /> |
470 | + |
471 | + </data> |
472 | +</openerp> |
473 | |
474 | === added file 'bin/addons/stock/report/stock_delivery_report_xls.mako' |
475 | --- bin/addons/stock/report/stock_delivery_report_xls.mako 1970-01-01 00:00:00 +0000 |
476 | +++ bin/addons/stock/report/stock_delivery_report_xls.mako 2019-08-09 14:01:53 +0000 |
477 | @@ -0,0 +1,281 @@ |
478 | +<?xml version="1.0"?> |
479 | +<?mso-application progid="Excel.Sheet"?> |
480 | +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
481 | + xmlns:o="urn:schemas-microsoft-com:office:office" |
482 | + xmlns:x="urn:schemas-microsoft-com:office:excel" |
483 | + xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
484 | + xmlns:html="http://www.w3.org/TR/REC-html40"> |
485 | + <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> |
486 | + <Author>Unifield</Author> |
487 | + <LastAuthor>MSFUser</LastAuthor> |
488 | + <Created>2014-04-16T22:36:07Z</Created> |
489 | + <Company>Medecins Sans Frontieres</Company> |
490 | + <Version>11.9999</Version> |
491 | + </DocumentProperties> |
492 | + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> |
493 | + <WindowHeight>11640</WindowHeight> |
494 | + <WindowWidth>15480</WindowWidth> |
495 | + <WindowTopX>120</WindowTopX> |
496 | + <WindowTopY>75</WindowTopY> |
497 | + <ProtectStructure>False</ProtectStructure> |
498 | + <ProtectWindows>False</ProtectWindows> |
499 | + </ExcelWorkbook> |
500 | + <Styles> |
501 | + <Style ss:ID="ssCell"> |
502 | + <Alignment ss:Vertical="Top" ss:WrapText="1"/> |
503 | + <Font ss:Bold="1" /> |
504 | + </Style> |
505 | + |
506 | + <!-- File header --> |
507 | + <Style ss:ID="big_header"> |
508 | + <Font ss:Size="13" ss:Bold="1" /> |
509 | + </Style> |
510 | + <Style ss:ID="file_header"> |
511 | + <Font ss:Size="13" ss:Bold="1" /> |
512 | + <Interior ss:Color="#F79646" ss:Pattern="Solid"/> |
513 | + </Style> |
514 | + |
515 | + <!-- Line header --> |
516 | + <Style ss:ID="line_header"> |
517 | + <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1" /> |
518 | + <Borders> |
519 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
520 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
521 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
522 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
523 | + </Borders> |
524 | + <Interior ss:Color="#F79646" ss:Pattern="Solid"/> |
525 | + </Style> |
526 | + <Style ss:ID="line_header_center"> |
527 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" /> |
528 | + <Borders> |
529 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
530 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
531 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
532 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
533 | + </Borders> |
534 | + <Interior ss:Color="#F79646" ss:Pattern="Solid"/> |
535 | + </Style> |
536 | + |
537 | + <!-- Lines --> |
538 | + <Style ss:ID="line"> |
539 | + <Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:WrapText="1" /> |
540 | + <Borders> |
541 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
542 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
543 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
544 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
545 | + </Borders> |
546 | + <NumberFormat ss:Format="#,##0.00"/> |
547 | + </Style> |
548 | + <Style ss:ID="line_center"> |
549 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" /> |
550 | + <Borders> |
551 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
552 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
553 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
554 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
555 | + </Borders> |
556 | + <NumberFormat ss:Format="#0"/> |
557 | + </Style> |
558 | + <Style ss:ID="line_center_nb"> |
559 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" /> |
560 | + <Borders> |
561 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
562 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
563 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
564 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
565 | + </Borders> |
566 | + <NumberFormat ss:Format="#,##0.00"/> |
567 | + </Style> |
568 | + <Style ss:ID="short_date"> |
569 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" /> |
570 | + <Borders> |
571 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
572 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
573 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
574 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
575 | + </Borders> |
576 | + <NumberFormat ss:Format="Short Date" /> |
577 | + </Style> |
578 | + <Style ss:ID="general_date"> |
579 | + <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" /> |
580 | + <Borders> |
581 | + <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> |
582 | + <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> |
583 | + <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/> |
584 | + <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/> |
585 | + </Borders> |
586 | + <NumberFormat ss:Format="General Date" /> |
587 | + </Style> |
588 | + </Styles> |
589 | + |
590 | +% for r in objects: |
591 | +<ss:Worksheet ss:Name="${_('Deliveries Report')|x}"> |
592 | + <Table x:FullColumns="1" x:FullRows="1"> |
593 | + ## Reference |
594 | + <Column ss:AutoFitWidth="1" ss:Width="100.0" /> |
595 | + ## Reason Type |
596 | + <Column ss:AutoFitWidth="1" ss:Width="115.0" /> |
597 | + ## SHIP |
598 | + <Column ss:AutoFitWidth="1" ss:Width="80.0" /> |
599 | + ## Origin |
600 | + <Column ss:AutoFitWidth="1" ss:Width="140.0" /> |
601 | + ## Partner |
602 | + <Column ss:AutoFitWidth="1" ss:Width="110.0" /> |
603 | + ## Order Type |
604 | + <Column ss:AutoFitWidth="1" ss:Width="60.0" /> |
605 | + ## Order Category |
606 | + <Column ss:AutoFitWidth="1" ss:Width="60.0" /> |
607 | + ## Order Priority |
608 | + <Column ss:AutoFitWidth="1" ss:Width="60.0" /> |
609 | + ## Line |
610 | + <Column ss:AutoFitWidth="1" ss:Width="30.0" /> |
611 | + ## Product Code |
612 | + <Column ss:AutoFitWidth="1" ss:Width="90.0" /> |
613 | + ## Product Description |
614 | + <Column ss:AutoFitWidth="1" ss:Width="240.0" /> |
615 | + ## UoM |
616 | + <Column ss:AutoFitWidth="1" ss:Width="40.0" /> |
617 | + ## Qty |
618 | + <Column ss:AutoFitWidth="1" ss:Width="70.0" /> |
619 | + ## Unit Price |
620 | + <Column ss:AutoFitWidth="1" ss:Width="60.0" /> |
621 | + ## Currency |
622 | + <Column ss:AutoFitWidth="1" ss:Width="45.0" /> |
623 | + ## Total Currency |
624 | + <Column ss:AutoFitWidth="1" ss:Width="70.0" /> |
625 | + ## Source Location |
626 | + <Column ss:AutoFitWidth="1" ss:Width="90.0" /> |
627 | + ## Destination Location |
628 | + <Column ss:AutoFitWidth="1" ss:Width="90.0" /> |
629 | + ## Creation Date |
630 | + <Column ss:AutoFitWidth="1" ss:Width="120.0" /> |
631 | + ## Shipped Date |
632 | + <Column ss:AutoFitWidth="1" ss:Width="110.0" /> |
633 | + |
634 | + ## WORKSHEET HEADER |
635 | + <Row> |
636 | + <Cell ss:StyleID="file_header" ss:MergeAcross="1"><Data ss:Type="String">${_('DELIVERIES REPORT')|x}</Data></Cell> |
637 | + </Row> |
638 | + <Row> |
639 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('DB/Instance name')|x}</Data></Cell> |
640 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${r.company_id and r.company_id.name or ''|x}</Data></Cell> |
641 | + </Row> |
642 | + <Row> |
643 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Generated on')|x}</Data></Cell> |
644 | + % if isDateTime(r.report_date): |
645 | + <Cell ss:StyleID="short_date"><Data ss:Type="DateTime">${parseDateXls(r.report_date)|n}</Data></Cell> |
646 | + % else: |
647 | + <Cell ss:StyleID="line_center"><Data ss:Type="String"></Data></Cell> |
648 | + % endif |
649 | + </Row> |
650 | + |
651 | + <Row></Row> |
652 | + |
653 | + <Row> |
654 | + <Cell ss:StyleID="big_header" ss:MergeAcross="1"><Data ss:Type="String">${_('FILTERS')|x}</Data></Cell> |
655 | + </Row> |
656 | + <Row> |
657 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Date from')|x}</Data></Cell> |
658 | + % if r.start_date and isDate(r.start_date): |
659 | + <Cell ss:StyleID="short_date"><Data ss:Type="DateTime">${parseDateXls(r.start_date)|n}</Data></Cell> |
660 | + % else: |
661 | + <Cell ss:StyleID="line_center"><Data ss:Type="String"></Data></Cell> |
662 | + % endif |
663 | + </Row> |
664 | + <Row> |
665 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Date to')|x}</Data></Cell> |
666 | + % if r.end_date and isDate(r.end_date): |
667 | + <Cell ss:StyleID="short_date"><Data ss:Type="DateTime">${parseDateXls(r.end_date)|n}</Data></Cell> |
668 | + % else: |
669 | + <Cell ss:StyleID="line_center"><Data ss:Type="String"></Data></Cell> |
670 | + % endif |
671 | + </Row> |
672 | + <Row> |
673 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Partner')|x}</Data></Cell> |
674 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${r.partner_id and r.partner_id.name or ''|x}</Data></Cell> |
675 | + </Row> |
676 | + <Row> |
677 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Product Main Type')|x}</Data></Cell> |
678 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${r.nomen_manda_0 and r.nomen_manda_0.name or ''|x}</Data></Cell> |
679 | + </Row> |
680 | + <Row> |
681 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Source Location')|x}</Data></Cell> |
682 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${r.location_id and r.location_id.name or ''|x}</Data></Cell> |
683 | + </Row> |
684 | + <Row> |
685 | + <Cell ss:StyleID="line"><Data ss:Type="String">${_('Destination Location')|x}</Data></Cell> |
686 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${r.location_dest_id and r.location_dest_id.name or ''|x}</Data></Cell> |
687 | + </Row> |
688 | + |
689 | + <Row></Row> |
690 | + |
691 | + ## DATA HEADERS |
692 | + <% |
693 | + headers_list = [ |
694 | + _('Reference'), |
695 | + _('Reason Type'), |
696 | + _('SHIP'), |
697 | + _('Origin'), |
698 | + _('Partner'), |
699 | + _('Order Type'), |
700 | + _('Order Category'), |
701 | + _('Order Priority'), |
702 | + _('Line'), |
703 | + _('Product Code'), |
704 | + _('Product Description'), |
705 | + _('UoM'), |
706 | + _('Qty'), |
707 | + _('Unit Price'), |
708 | + _('Currency'), |
709 | + _('Total Currency'), |
710 | + _('Source Location'), |
711 | + _('Destination Location'), |
712 | + _('Creation Date'), |
713 | + _('Shipped Date'), |
714 | + ] |
715 | + %> |
716 | + <Row> |
717 | + % for h in headers_list: |
718 | + <Cell ss:StyleID="line_header_center"><Data ss:Type="String">${h|x}</Data></Cell> |
719 | + % endfor |
720 | + </Row> |
721 | + |
722 | + % for move in sorted(getMoves(r.moves_ids), key=lambda x: (x['shipped_date'], x['ref'], x['line_num'], x['prod_code'])): |
723 | + <Row ss:Height="12.0"> |
724 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['ref']|x}</Data></Cell> |
725 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['reason_type']|x}</Data></Cell> |
726 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['ship']|x}</Data></Cell> |
727 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['origin']|x}</Data></Cell> |
728 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['partner']|x}</Data></Cell> |
729 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['fo'] and getSel(move['fo'], 'order_type') or ''|x}</Data></Cell> |
730 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['header'] and getSel(move['header'], 'order_category') or ''|x}</Data></Cell> |
731 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['fo'] and getSel(move['fo'], 'priority') or ''|x}</Data></Cell> |
732 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['line_num']|x}</Data></Cell> |
733 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['prod_code']|x}</Data></Cell> |
734 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['prod_desc']|x}</Data></Cell> |
735 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['prod_uom']|x}</Data></Cell> |
736 | + <Cell ss:StyleID="line_center"><Data ss:Type="Number">${move['qty']|x}</Data></Cell> |
737 | + <Cell ss:StyleID="line_center_nb"><Data ss:Type="Number">${move['price']|x}</Data></Cell> |
738 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['currency']|x}</Data></Cell> |
739 | + <Cell ss:StyleID="line_center_nb"><Data ss:Type="Number">${move['total_currency']|x}</Data></Cell> |
740 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['location']|x}</Data></Cell> |
741 | + <Cell ss:StyleID="line_center"><Data ss:Type="String">${move['destination']|x}</Data></Cell> |
742 | + % if move['create_date'] and isDateTime(move['create_date']): |
743 | + <Cell ss:StyleID="general_date"><Data ss:Type="DateTime">${move['create_date'][:10]|n}T${move['create_date'][-8:]|n}.000</Data></Cell> |
744 | + % else: |
745 | + <Cell ss:StyleID="line_center"><Data ss:Type="String"></Data></Cell> |
746 | + % endif |
747 | + % if move['shipped_date'] and isDateTime(move['shipped_date']): |
748 | + <Cell ss:StyleID="general_date"><Data ss:Type="DateTime">${move['shipped_date'][:10]|n}T${move['shipped_date'][-8:]|n}.000</Data></Cell> |
749 | + % else: |
750 | + <Cell ss:StyleID="line_center"><Data ss:Type="String"></Data></Cell> |
751 | + % endif |
752 | + </Row> |
753 | + % endfor |
754 | + |
755 | + </Table> |
756 | +</ss:Worksheet> |
757 | +% endfor |
758 | +</Workbook> |
759 | |
760 | === modified file 'bin/addons/stock/report/stock_expired_damaged_report_view.xml' |
761 | --- bin/addons/stock/report/stock_expired_damaged_report_view.xml 2019-01-18 14:58:31 +0000 |
762 | +++ bin/addons/stock/report/stock_expired_damaged_report_view.xml 2019-08-09 14:01:53 +0000 |
763 | @@ -117,7 +117,7 @@ |
764 | id="menu_stock_expired_damaged_report" |
765 | action="action_stock_expired_damaged_report" |
766 | parent="stock.next_id_61" |
767 | - sequence="10" |
768 | + sequence="11" |
769 | /> |
770 | |
771 | <report |
772 | |
773 | === modified file 'bin/addons/stock/wizard/__init__.py' |
774 | --- bin/addons/stock/wizard/__init__.py 2019-02-11 09:51:38 +0000 |
775 | +++ bin/addons/stock/wizard/__init__.py 2019-08-09 14:01:53 +0000 |
776 | @@ -40,5 +40,6 @@ |
777 | import manage_expired_stock |
778 | import reserved_products_wizard |
779 | import stock_reception_wizard |
780 | +import stock_delivery_wizard |
781 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
782 | |
783 | |
784 | === added file 'bin/addons/stock/wizard/stock_delivery_wizard.py' |
785 | --- bin/addons/stock/wizard/stock_delivery_wizard.py 1970-01-01 00:00:00 +0000 |
786 | +++ bin/addons/stock/wizard/stock_delivery_wizard.py 2019-08-09 14:01:53 +0000 |
787 | @@ -0,0 +1,155 @@ |
788 | +# -*- coding: utf-8 -*- |
789 | +############################################################################## |
790 | +# |
791 | +# OpenERP, Open Source Management Solution |
792 | +# Copyright (C) 2011 TeMPO Consulting, MSF |
793 | +# |
794 | +# This program is free software: you can redistribute it and/or modify |
795 | +# it under the terms of the GNU Affero General Public License as |
796 | +# published by the Free Software Foundation, either version 3 of the |
797 | +# License, or (at your option) any later version. |
798 | +# |
799 | +# This program is distributed in the hope that it will be useful, |
800 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
801 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
802 | +# GNU Affero General Public License for more details. |
803 | +# |
804 | +# You should have received a copy of the GNU Affero General Public License |
805 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
806 | +# |
807 | +############################################################################## |
808 | + |
809 | +from osv import osv |
810 | +from osv import fields |
811 | +from tools.translate import _ |
812 | +from order_types import ORDER_CATEGORY |
813 | + |
814 | +import time |
815 | + |
816 | + |
817 | +class stock_delivery_wizard(osv.osv_memory): |
818 | + _name = 'stock.delivery.wizard' |
819 | + _rec_name = 'report_date' |
820 | + |
821 | + _columns = { |
822 | + 'report_date': fields.datetime(string='Date of the demand', readonly=True), |
823 | + 'company_id': fields.many2one('res.company', string='Company', readonly=True), |
824 | + 'moves_ids': fields.text(string='Moves', readonly=True), |
825 | + 'start_date': fields.date(string='Date from'), |
826 | + 'end_date': fields.date(string='Date to'), |
827 | + 'partner_id': fields.many2one('res.partner', string='Partner'), |
828 | + 'nomen_manda_0': fields.many2one('product.nomenclature', 'Product Main Type'), |
829 | + 'location_id': fields.many2one('stock.location', 'Source Location', select=True), |
830 | + 'location_dest_id': fields.many2one('stock.location', 'Dest. Location', select=True), |
831 | + } |
832 | + |
833 | + _defaults = { |
834 | + 'report_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), |
835 | + 'company_id': lambda self, cr, uid, ids, c={}: self.pool.get('res.users').browse(cr, uid, uid).company_id.id, |
836 | + } |
837 | + |
838 | + def get_values(self, cr, uid, ids, context=None): |
839 | + ''' |
840 | + Retrieve the data according to values in wizard |
841 | + ''' |
842 | + move_obj = self.pool.get('stock.move') |
843 | + ir_data = self.pool.get('ir.model.data') |
844 | + |
845 | + dispatch_location = ir_data.get_object_reference(cr, uid, 'msf_outgoing', 'stock_location_dispatch')[1] |
846 | + |
847 | + if context is None: |
848 | + context = {} |
849 | + |
850 | + if isinstance(ids, (int, long)): |
851 | + ids = [ids] |
852 | + |
853 | + for wizard in self.browse(cr, uid, ids, context=context): |
854 | + move_domain = [('picking_id.type', '=', 'out'), ('product_qty', '!=', 0), '|'] |
855 | + out_domain = [ |
856 | + '&', '&', |
857 | + ('state', '=', 'done'), |
858 | + ('picking_id.subtype', '=', 'standard'), |
859 | + ('picking_id.state', 'in', ['done', 'delivered']) |
860 | + ] |
861 | + ppl_domain = [ |
862 | + '&', '&', '&', '&', |
863 | + ('location_dest_id', '!=', dispatch_location), |
864 | + ('picking_id.previous_step_id.state', '=', 'done'), |
865 | + ('picking_id.subtype', '=', 'packing'), |
866 | + ('picking_id.shipment_id', '!=', 'f'), |
867 | + '|', '&', ('picking_id.shipment_id.parent_id', '=', None), ('picking_id.shipment_id.state', '=', 'draft'), |
868 | + '&', ('picking_id.shipment_id.parent_id', '!=', 'f'), ('picking_id.shipment_id.state', '!=', 'draft'), |
869 | + ] |
870 | + |
871 | + if wizard.start_date: |
872 | + out_domain.insert(0, '&') |
873 | + out_domain.append(('picking_id.date_done', '>=', wizard.start_date)) |
874 | + ppl_domain.insert(0, '&') |
875 | + ppl_domain.append(('picking_id.shipment_id.shipment_expected_date', '>=', wizard.start_date)) |
876 | + |
877 | + if wizard.end_date: |
878 | + out_domain.insert(0, '&') |
879 | + out_domain.append(('picking_id.date_done', '<=', wizard.end_date)) |
880 | + ppl_domain.insert(0, '&') |
881 | + ppl_domain.append(('picking_id.shipment_id.shipment_expected_date', '<=', wizard.end_date)) |
882 | + |
883 | + if wizard.location_id: |
884 | + out_domain.insert(0, '&') |
885 | + out_domain.append(('location_id', '=', wizard.location_id.id)) |
886 | + ppl_domain.insert(0, '&') |
887 | + ppl_domain.append(('backmove_id.location_id', '=', wizard.location_id.id)) |
888 | + |
889 | + move_domain.extend(out_domain) |
890 | + move_domain.extend(ppl_domain) |
891 | + |
892 | + if wizard.partner_id: |
893 | + move_domain.append(('picking_id.partner_id', '=', wizard.partner_id.id)) |
894 | + |
895 | + if wizard.nomen_manda_0: |
896 | + move_domain.append(('product_id.nomen_manda_0', '=', wizard.nomen_manda_0.id)) |
897 | + |
898 | + if wizard.location_dest_id: |
899 | + move_domain.append(('location_dest_id', '=', wizard.location_dest_id.id)) |
900 | + |
901 | + move_ids = move_obj.search(cr, uid, move_domain, order='picking_id, line_number', context=context) |
902 | + |
903 | + if not move_ids: |
904 | + raise osv.except_osv( |
905 | + _('Error'), |
906 | + _('No data found with these parameters'), |
907 | + ) |
908 | + |
909 | + self.write(cr, uid, [wizard.id], {'moves_ids': move_ids}, context=context) |
910 | + |
911 | + return True |
912 | + |
913 | + def print_excel(self, cr, uid, ids, context=None): |
914 | + ''' |
915 | + Retrieve the data according to values in wizard |
916 | + and print the report in Excel format. |
917 | + ''' |
918 | + if context is None: |
919 | + context = {} |
920 | + |
921 | + if isinstance(ids, (int, long)): |
922 | + ids = [ids] |
923 | + |
924 | + self.get_values(cr, uid, ids, context=context) |
925 | + |
926 | + background_id = self.pool.get('memory.background.report').create(cr, uid, { |
927 | + 'file_name': _('Deliveries Report'), |
928 | + 'report_name': 'stock.delivery.report_xls', |
929 | + }, context=context) |
930 | + context['background_id'] = background_id |
931 | + context['background_time'] = 3 |
932 | + |
933 | + data = {'ids': ids, 'context': context} |
934 | + return { |
935 | + 'type': 'ir.actions.report.xml', |
936 | + 'report_name': 'stock.delivery.report_xls', |
937 | + 'datas': data, |
938 | + 'context': context, |
939 | + } |
940 | + |
941 | + |
942 | +stock_delivery_wizard() |
943 | |
944 | === added file 'bin/addons/stock/wizard/stock_delivery_wizard_view.xml' |
945 | --- bin/addons/stock/wizard/stock_delivery_wizard_view.xml 1970-01-01 00:00:00 +0000 |
946 | +++ bin/addons/stock/wizard/stock_delivery_wizard_view.xml 2019-08-09 14:01:53 +0000 |
947 | @@ -0,0 +1,42 @@ |
948 | +<?xml version="1.0" encoding="utf-8"?> |
949 | +<openerp> |
950 | + |
951 | + <data> |
952 | + |
953 | + <record id="stock_delivery_wizard_form_view" model="ir.ui.view"> |
954 | + <field name="name">stock.delivery.wizard.form.view</field> |
955 | + <field name="model">stock.delivery.wizard</field> |
956 | + <field name="type">form</field> |
957 | + <field name="arch" type="xml"> |
958 | + <form string="Deliveries Report"> |
959 | + <separator colspan="4" string="Request parameters" /> |
960 | + <field name="start_date" /> |
961 | + <field name="end_date" /> |
962 | + <field name="partner_id" /> |
963 | + <field name="nomen_manda_0" domain="[('level', '=', '0'), ('type', '=', 'mandatory')]" widget="selection" /> |
964 | + <field name="location_id" domain="[('usage', '=', 'internal')]" /> |
965 | + <field name="location_dest_id" domain="[('usage', '!=', 'view')]"/> |
966 | + <separator colspan="4" string="Actions" /> |
967 | + <button name="print_excel" string="Excel report" icon="gtk-print" type="object" colspan="4" /> |
968 | + </form> |
969 | + </field> |
970 | + </record> |
971 | + |
972 | + <record id="action_stock_delivery_wizard" model="ir.actions.act_window"> |
973 | + <field name="name">Deliveries Report</field> |
974 | + <field name="res_model">stock.delivery.wizard</field> |
975 | + <field name="view_type">form</field> |
976 | + <field name="view_mode">form</field> |
977 | + <field name="target">new</field> |
978 | + </record> |
979 | + |
980 | + <menuitem |
981 | + id="menu_stock_delivery_wizard" |
982 | + action="action_stock_delivery_wizard" |
983 | + parent="stock.next_id_61" |
984 | + sequence="10" |
985 | + /> |
986 | + |
987 | + </data> |
988 | + |
989 | +</openerp> |