Merge lp:~mallorymarcot/unifield-server/us-3106 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5162
Proposed branch: lp:~mallorymarcot/unifield-server/us-3106
Merge into: lp:unifield-server
Diff against target: 647 lines (+269/-117)
5 files modified
bin/addons/msf_supply_doc_export/msf_supply_doc_export.py (+181/-24)
bin/addons/msf_supply_doc_export/report/report_po_follow_up_xls.mako (+77/-86)
bin/addons/msf_supply_doc_export/wizard/po_follow_up.py (+4/-4)
bin/addons/purchase/purchase_order_line.py (+4/-0)
bin/addons/purchase/purchase_workflow.py (+3/-3)
To merge this branch: bzr merge lp:~mallorymarcot/unifield-server/us-3106
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+358541@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jftempo (jfb-tempo-consulting) wrote :

Please see my comment.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_supply_doc_export/msf_supply_doc_export.py'
2--- bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2018-11-05 13:26:55 +0000
3+++ bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2018-11-09 16:23:13 +0000
4@@ -28,6 +28,7 @@
5 from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport
6 from tools.translate import _
7 from purchase import PURCHASE_ORDER_STATE_SELECTION
8+from datetime import datetime
9
10 import pooler
11 import time
12@@ -507,6 +508,16 @@
13 report_line['qty_backordered'] = ''
14 report_line['unit_price'] = ''
15 report_line['in_unit_price'] = ''
16+ report_line['delivery_requested_date'] = ''
17+ report_line['customer'] = ''
18+ report_line['customer_ref'] = ''
19+ report_line['source_doc'] = ''
20+ report_line['supplier'] = ''
21+ report_line['supplier_ref'] = ''
22+ report_line['order_type'] = ''
23+ report_line['currency'] = ''
24+ report_line['total_currency'] = ''
25+ report_line['total_func_currency'] = ''
26 report_line['destination'] = analytic_line.get('destination')
27 report_line['cost_centre'] = analytic_line.get('cost_center')
28 res.append(report_line)
29@@ -519,6 +530,86 @@
30
31 raise StopIteration
32
33+ def getLineStyle(self, line):
34+ return 'lgrey' if line.get('raw_state', '') in ['cancel', 'cancel_r'] else 'line'
35+
36+ def get_total_currency(self, in_unit_price, qty_received):
37+ if not in_unit_price or not qty_received:
38+ return '0.00'
39+ try:
40+ in_unit_price = float(in_unit_price)
41+ qty_received = float(qty_received)
42+ except:
43+ return '0.00'
44+ return in_unit_price * qty_received
45+
46+ def get_exchange_rate(self, pol_id):
47+ pol = self.pool.get('purchase.order.line').browse(self.cr, self.uid, pol_id)
48+ context = {}
49+ exchange_rate = 0.0
50+ if pol.closed_date:
51+ context.update({'date': pol.closed_date})
52+ elif pol.confirmation_date:
53+ context.update({'date': pol.confirmation_date})
54+ elif pol.validation_date:
55+ context.update({'date': pol.validation_date})
56+ elif pol.create_date: # could be null, because not mandatory in DB
57+ context.update({'date': pol.create_date})
58+ else:
59+ context.update({'date': datetime.now().strftime('%Y-%m-%d')})
60+
61+ currency_from = pol.order_id.pricelist_id.currency_id
62+ currency_to = self.pool.get('res.users').browse(self.cr, self.uid, self.uid, context=context).company_id.currency_id
63+ exchange_rate = self.pool.get('res.currency')._get_conversion_rate(self.cr, self.uid, currency_from, currency_to, context=context)
64+
65+ return exchange_rate
66+
67+ def get_total_func_currency(self, pol_id, in_unit_price, qty_received):
68+ ex_rate = self.get_exchange_rate(pol_id)
69+ total_currency = self.get_total_currency(in_unit_price, qty_received)
70+ total_currency = float(total_currency)
71+
72+ return total_currency * ex_rate
73+
74+ def get_qty_backordered(self, pol_id, qty_ordered, qty_received, first_line):
75+ pol = self.pool.get('purchase.order.line').browse(self.cr, self.uid, pol_id)
76+ if pol.state.startswith('cancel'):
77+ return '0.00'
78+ if not qty_ordered:
79+ return '0.00'
80+ try:
81+ qty_ordered = float(qty_ordered)
82+ qty_received = float(qty_received)
83+ except:
84+ return '0.00'
85+
86+ # Line partially received:
87+ in_move_done = self.pool.get('stock.move').search(self.cr, self.uid, [
88+ ('type', '=', 'in'),
89+ ('purchase_line_id', '=', pol.id),
90+ ('state', '=', 'done'),
91+ ])
92+ if first_line and in_move_done:
93+ total_done = 0.0
94+ for move in self.pool.get('stock.move').browse(self.cr, self.uid, in_move_done, fields_to_fetch=['product_qty','product_uom']):
95+ if pol.product_uom.id != move.product_uom.id:
96+ total_done += self.pool.get('product.uom')._compute_qty(self.cr, self.uid, move.product_uom.id, move.product_qty, pol.product_uom.id)
97+ else:
98+ total_done += move.product_qty
99+ return qty_ordered - total_done
100+
101+ return qty_ordered - qty_received
102+
103+
104+ def format_date(self, date):
105+ if not date:
106+ return ''
107+ time_tuple = time.strptime(date, '%Y-%m-%d')
108+ new_date = time.strftime('%d.%m.%Y', time_tuple)
109+
110+ return new_date
111+
112+
113 def getPOLines(self, po_id):
114 ''' developer note: would be a lot easier to write this as a single sql and then use on-break '''
115 po_obj = self.pool.get('purchase.order')
116@@ -549,8 +640,9 @@
117 if not same_product_same_uom:
118 report_line = {
119 'order_ref': order.name or '',
120- 'order_created': order.date_order or '',
121- 'order_confirmed_date': line.confirmed_delivery_date or order.delivery_confirmed_date or '',
122+ 'order_created': self.format_date(order.date_order),
123+ 'order_confirmed_date': self.format_date(line.confirmed_delivery_date),
124+ 'delivery_requested_date': self.format_date(line.date_planned),
125 'raw_state': line.state,
126 'line_status': get_sel(self.cr, self.uid, 'purchase.order.line', 'state', line.state, {}) or '',
127 'state': line.state_to_display or '',
128@@ -562,7 +654,7 @@
129 'uom': line.product_uom.name or '',
130 'qty_received': '0.00',
131 'in': '',
132- 'qty_backordered': '',
133+ 'qty_backordered': self.get_qty_backordered(line.id, line.product_qty, 0.0, first_line),
134 'destination': analytic_lines[0].get('destination'),
135 'cost_centre': analytic_lines[0].get('cost_center'),
136 'unit_price': line.price_unit or '',
137@@ -570,7 +662,13 @@
138 'customer': line.linked_sol_id and line.linked_sol_id.order_id.partner_id.name or '',
139 'customer_ref': line.linked_sol_id and line.linked_sol_id.order_id.client_order_ref and '.' in line.linked_sol_id.order_id.client_order_ref and line.linked_sol_id.order_id.client_order_ref.split('.')[1] or '',
140 'source_doc': line.origin or '',
141+ 'supplier': line.order_id.partner_id.name or '',
142 'supplier_ref': line.order_id.partner_ref and '.' in line.order_id.partner_ref and line.order_id.partner_ref.split('.')[1] or '',
143+ # new
144+ 'order_type': get_sel(self.cr, self.uid, 'purchase.order', 'order_type', line.order_id.order_type, {}) or '',
145+ 'currency': line.order_id.pricelist_id.currency_id.name or '',
146+ 'total_currency': '',
147+ 'total_func_currency': '',
148 }
149 report_lines.append(report_line)
150 report_lines.extend(self.printAnalyticLines(analytic_lines))
151@@ -579,20 +677,21 @@
152 for spsul in sorted(same_product_same_uom, key=lambda spsu: spsu.get('backorder_id'), reverse=True):
153 report_line = {
154 'order_ref': order.name or '',
155- 'order_created': order.date_order or '',
156- 'order_confirmed_date': line.confirmed_delivery_date or order.delivery_confirmed_date or '',
157+ 'order_created': self.format_date(order.date_order),
158+ 'order_confirmed_date': self.format_date(line.confirmed_delivery_date or order.delivery_confirmed_date),
159+ 'delivery_requested_date': self.format_date(line.date_planned),
160 'raw_state': line.state,
161 'order_status': self._get_states().get(order.state, ''),
162 'line_status': first_line and get_sel(self.cr, self.uid, 'purchase.order.line', 'state', line.state, {}) or '',
163 'state': line.state_to_display or '',
164- 'item': first_line and line.line_number or '',
165- 'code': first_line and line.product_id.default_code or '',
166- 'description': first_line and line.product_id.name or '',
167+ 'item': line.line_number or '',
168+ 'code': line.product_id.default_code or '',
169+ 'description': line.product_id.name or '',
170 'qty_ordered': first_line and line.product_qty or '',
171 'uom': line.product_uom.name or '',
172 'qty_received': spsul.get('state') == 'done' and spsul.get('product_qty', '') or '0.00',
173 'in': spsul.get('name', '') or '',
174- 'qty_backordered': '',
175+ 'qty_backordered': self.get_qty_backordered(line.id, first_line and line.product_qty or 0.0, spsul.get('state') == 'done' and spsul.get('product_qty', 0.0) or 0.0, first_line),
176 'destination': analytic_lines[0].get('destination'),
177 'cost_centre': analytic_lines[0].get('cost_center'),
178 'unit_price': line.price_unit or '',
179@@ -600,13 +699,23 @@
180 'customer': line.linked_sol_id and line.linked_sol_id.order_id.partner_id.name or '',
181 'customer_ref': line.linked_sol_id and line.linked_sol_id.order_id.client_order_ref and '.' in line.linked_sol_id.order_id.client_order_ref and line.linked_sol_id.order_id.client_order_ref.split('.')[1] or '',
182 'source_doc': line.origin or '',
183+ 'supplier': line.order_id.partner_id.name or '',
184 'supplier_ref': line.order_id.partner_ref and '.' in line.order_id.partner_ref and line.order_id.partner_ref.split('.')[1] or '',
185+ # new
186+ 'order_type': get_sel(self.cr, self.uid, 'purchase.order', 'order_type', line.order_id.order_type, {}) or '',
187+ 'currency': line.order_id.pricelist_id.currency_id.name or '',
188+ 'total_currency': self.get_total_currency(spsul.get('price_unit'), spsul.get('state') == 'done' and spsul.get('product_qty', '') or 0.0),
189+ 'total_func_currency': self.get_total_func_currency(
190+ line.id,
191+ spsul.get('price_unit', 0.0),
192+ spsul.get('state') == 'done' and spsul.get('product_qty', 0.0) or 0.0
193+ ),
194 }
195
196 report_lines.append(report_line)
197
198- if spsul.get('backorder_id') and spsul.get('state') != 'done':
199- report_line['qty_backordered'] = spsul.get('product_qty', '')
200+ # if spsul.get('backorder_id') and spsul.get('state') != 'done':
201+ # report_line['qty_backordered'] = spsul.get('product_qty', '')
202
203 if first_line:
204 report_lines.extend(self.printAnalyticLines(analytic_lines))
205@@ -615,20 +724,21 @@
206 for spl in sorted(same_product, key=lambda spsu: spsu.get('backorder_id'), reverse=True):
207 report_line = {
208 'order_ref': order.name or '',
209- 'order_created': order.date_order or '',
210- 'order_confirmed_date': line.confirmed_delivery_date or order.delivery_confirmed_date or '',
211+ 'order_created': self.format_date(order.date_order),
212+ 'order_confirmed_date': self.format_date(line.confirmed_delivery_date or order.delivery_confirmed_date),
213+ 'delivery_requested_date': self.format_date(line.date_planned),
214 'raw_state': line.state,
215 'order_status': self._get_states().get(order.state, ''),
216 'line_status': first_line and get_sel(self.cr, self.uid, 'purchase.order.line', 'state', line.state, {}) or '',
217 'state': line.state_to_display or '',
218- 'item': first_line and line.line_number or '',
219- 'code': first_line and line.product_id.default_code or '',
220- 'description': first_line and line.product_id.name or '',
221+ 'item': line.line_number or '',
222+ 'code': line.product_id.default_code or '',
223+ 'description': line.product_id.name or '',
224 'qty_ordered': first_line and line.product_qty or '',
225 'uom': uom_obj.read(self.cr, self.uid, spl.get('product_uom'), ['name'])['name'],
226 'qty_received': spl.get('state') == 'done' and spl.get('product_qty', '') or '0.00',
227 'in': spl.get('name', '') or '',
228- 'qty_backordered': '',
229+ 'qty_backordered': self.get_qty_backordered(line.id, first_line and line.product_qty or 0.0, spl.get('state') == 'done' and spl.get('product_qty', 0.0) or 0.0, first_line),
230 'destination': analytic_lines[0].get('destination'),
231 'cost_centre': analytic_lines[0].get('cost_center'),
232 'unit_price': line.price_unit or '',
233@@ -636,12 +746,22 @@
234 'customer': line.linked_sol_id and line.linked_sol_id.order_id.partner_id.name or '',
235 'customer_ref': line.linked_sol_id and line.linked_sol_id.order_id.client_order_ref and '.' in line.linked_sol_id.order_id.client_order_ref and line.linked_sol_id.order_id.client_order_ref.split('.')[1] or '',
236 'source_doc': line.origin or '',
237+ 'supplier': line.order_id.partner_id.name or '',
238 'supplier_ref': line.order_id.partner_ref and '.' in line.order_id.partner_ref and line.order_id.partner_ref.split('.')[1] or '',
239+ # new
240+ 'order_type': get_sel(self.cr, self.uid, 'purchase.order', 'order_type', line.order_id.order_type, {}) or '',
241+ 'currency': line.order_id.pricelist_id.currency_id.name or '',
242+ 'total_currency': self.get_total_currency(spl.get('price_unit'), spl.get('state') == 'done' and spl.get('product_qty', 0.0) or 0.0),
243+ 'total_func_currency': self.get_total_func_currency(
244+ line.id,
245+ spl.get('price_unit', 0.0),
246+ spl.get('state') == 'done' and spl.get('product_qty', 0.0) or 0.0
247+ ),
248 }
249 report_lines.append(report_line)
250
251- if spl.get('backorder_id') and spl.get('state') != 'done':
252- report_line['qty_backordered'] = spl.get('product_qty', '')
253+ # if spl.get('backorder_id') and spl.get('state') != 'done':
254+ # report_line['qty_backordered'] = spl.get('product_qty', '')
255
256 if first_line:
257 report_lines.extend(self.printAnalyticLines(analytic_lines))
258@@ -651,8 +771,9 @@
259 prod_brw = prod_obj.browse(self.cr, self.uid, ol.get('product_id'))
260 report_line = {
261 'order_ref': order.name or '',
262- 'order_created': order.date_order or '',
263- 'order_confirmed_date': line.confirmed_delivery_date or order.delivery_confirmed_date or '',
264+ 'order_created': self.format_date(order.date_order),
265+ 'order_confirmed_date': self.format_date(line.confirmed_delivery_date or order.delivery_confirmed_date),
266+ 'delivery_requested_date': self.format_date(line.date_planned),
267 'raw_state': line.state,
268 'order_status': self._get_states().get(order.state, ''),
269 'line_status': get_sel(self.cr, self.uid, 'purchase.order.line', 'state', line.state, {}) or '',
270@@ -664,7 +785,7 @@
271 'uom': uom_obj.read(self.cr, self.uid, ol.get('product_uom'), ['name'])['name'],
272 'qty_received': ol.get('state') == 'done' and ol.get('product_qty', '') or '0.00',
273 'in': ol.get('name', '') or '',
274- 'qty_backordered': '',
275+ 'qty_backordered': self.get_qty_backordered(line.id, first_line and line.product_qty or 0.0, ol.get('state') == 'done' and ol.get('product_qty', 0.0) or 0.0, first_line),
276 'destination': analytic_lines[0].get('destination'),
277 'cost_centre': analytic_lines[0].get('cost_center'),
278 'unit_price': line.price_unit or '',
279@@ -672,7 +793,17 @@
280 'customer': line.linked_sol_id and line.linked_sol_id.order_id.partner_id.name or '',
281 'customer_ref': line.linked_sol_id and line.linked_sol_id.order_id.client_order_ref and '.' in line.linked_sol_id.order_id.client_order_ref and line.linked_sol_id.order_id.client_order_ref.split('.')[1] or '',
282 'source_doc': line.origin or '',
283+ 'supplier': line.order_id.partner_id.name or '',
284 'supplier_ref': line.order_id.partner_ref and '.' in line.order_id.partner_ref and line.order_id.partner_ref.split('.')[1] or '',
285+ # new
286+ 'order_type': get_sel(self.cr, self.uid, 'purchase.order', 'order_type', line.order_id.order_type, {}) or '',
287+ 'currency': line.order_id.pricelist_id.currency_id.name or '',
288+ 'total_currency': self.get_total_currency(ol.get('price_unit'), ol.get('state') == 'done' and ol.get('product_qty', 0.0) or 0.0),
289+ 'total_func_currency': self.get_total_func_currency(
290+ line.id,
291+ ol.get('price_unit', 0.0),
292+ ol.get('state') == 'done' and ol.get('product_qty', 0.0) or 0.0
293+ ),
294 }
295 report_lines.append(report_line)
296
297@@ -722,8 +853,33 @@
298 return self.datas.get('report_header')[1]
299
300 def getPOLineHeaders(self):
301- return ['Order Ref', 'Item', 'Code', 'Description', 'Qty ordered', 'UoM', 'Qty received', 'IN', 'Qty backorder', 'Unit Price', 'IN unit price', 'Created', 'Confirmed Delivery', 'Doc. Status', 'Line Status', 'Destination', 'Cost Center', 'Customer', 'Customer Reference', 'Source Document', 'Supplier Reference']
302-
303+ return [
304+ 'Order Reference',
305+ 'Supplier',
306+ 'Order Type',
307+ 'Line',
308+ 'Product Code',
309+ 'Product Description',
310+ 'Qty ordered',
311+ 'UoM',
312+ 'Qty received',
313+ 'IN Reference',
314+ 'Qty backorder',
315+ 'PO Unit Price (Currency)',
316+ 'IN unit price (Currency)',
317+ 'Currency',
318+ 'Total value received (Currency)',
319+ 'Total value received (Functional Currency)',
320+ 'Created',
321+ 'Delivery Requested Date',
322+ 'Delivery Confirmed Date',
323+ 'PO Line Status',
324+ 'PO Document Status',
325+ 'Customer',
326+ 'Customer Reference',
327+ 'Source Document',
328+ 'Supplier Reference',
329+ ]
330
331
332 class parser_po_follow_up_xls(po_follow_up_mixin, report_sxw.rml_parse):
333@@ -740,6 +896,7 @@
334 'getPOLines': self.getPOLines,
335 'getPOLineHeaders': self.getPOLineHeaders,
336 'getRunParms': self.getRunParms,
337+ 'getLineStyle': self.getLineStyle,
338 })
339
340
341
342=== modified file 'bin/addons/msf_supply_doc_export/report/report_po_follow_up_xls.mako'
343--- bin/addons/msf_supply_doc_export/report/report_po_follow_up_xls.mako 2018-09-10 09:54:05 +0000
344+++ bin/addons/msf_supply_doc_export/report/report_po_follow_up_xls.mako 2018-11-09 16:23:13 +0000
345@@ -23,8 +23,8 @@
346 <Styles>
347 <Style ss:ID="mainheader">
348 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="0"/>
349- <Font ss:FontName="Calibri" x:Family="Swiss" ss:Color="#000000"/>
350- <Interior ss:Color="#E6E6E6" ss:Pattern="Solid"/>
351+ <Font ss:FontName="Calibri" x:Family="Swiss" ss:Color="#000000" ss:Bold="1"/>
352+ <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/>
353 <Borders>
354 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
355 <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
356@@ -46,7 +46,7 @@
357
358 <Style ss:ID="header">
359 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
360- <Interior ss:Color="#d3d3d3" ss:Pattern="Solid"/>
361+ <Interior ss:Color="#ffcc99" ss:Pattern="Solid"/>
362 <Borders>
363 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
364 <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
365@@ -65,7 +65,7 @@
366 </Borders>
367 </Style>
368
369- <Style ss:ID="line_grey">
370+ <Style ss:ID="lgrey">
371 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
372 <Borders>
373 <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
374@@ -90,60 +90,72 @@
375
376 <ss:Worksheet ss:Name="PO Follow Up">
377 ## definition of the columns' size
378-<% nb_of_columns = 12 %>
379+<% nb_of_columns = 21 %>
380 <Table x:FullColumns="1" x:FullRows="1">
381- # Order name
382+ # Order ref
383+ <Column ss:AutoFitWidth="1" ss:Width="150" />
384+ # Supplier
385+ <Column ss:AutoFitWidth="1" ss:Width="150" />
386+ # Order Type
387 <Column ss:AutoFitWidth="1" ss:Width="65" />
388- # Item
389+ # Line
390 <Column ss:AutoFitWidth="1" ss:Width="40" />
391- # Code
392- <Column ss:AutoFitWidth="1" ss:Width="81" />
393- # Description
394- <Column ss:AutoFitWidth="1" ss:Width="161" />
395+ # Product Code
396+ <Column ss:AutoFitWidth="1" ss:Width="100" />
397+ # Product Description
398+ <Column ss:AutoFitWidth="1" ss:Width="200" />
399 # Qty ordered
400 <Column ss:AutoFitWidth="1" ss:Width="57" />
401 # UoM
402- <Column ss:AutoFitWidth="1" ss:Width="65" />
403+ <Column ss:AutoFitWidth="1" ss:Width="40" />
404 # Qty received
405- <Column ss:AutoFitWidth="1" ss:Width="80" />
406+ <Column ss:AutoFitWidth="1" ss:Width="65" />
407 # IN
408 <Column ss:AutoFitWidth="1" ss:Width="60" />
409 # Qty backorder
410 <Column ss:AutoFitWidth="1" ss:Width="58" />
411 # Unit Price
412- <Column ss:AutoFitWidth="1" ss:Width="95" />
413+ <Column ss:AutoFitWidth="1" ss:Width="65" />
414 # IN Unit Price
415+ <Column ss:AutoFitWidth="1" ss:Width="65" />
416+ # Currency
417+ <Column ss:AutoFitWidth="1" ss:Width="65" />
418+ # Total Currency
419+ <Column ss:AutoFitWidth="1" ss:Width="95" />
420+ # Total Functional Currency
421 <Column ss:AutoFitWidth="1" ss:Width="95" />
422 # Created (order)
423- <Columns ss:AutoFitWidth="1" ss:Width="95" />
424- # Delivery Confirmed (order)
425- <Columns ss:AutoFitWidth="1" ss:Width="95" />
426+ <Column ss:AutoFitWidth="1" ss:Width="80" />
427+ # Delivery Requested Date
428+ <Column ss:AutoFitWidth="1" ss:Width="80" />
429+ # Delivery Confirmed Date
430+ <Column ss:AutoFitWidth="1" ss:Width="80" />
431+ # Status (line)
432+ <Column ss:AutoFitWidth="1" ss:Width="80" />
433 # Status (order)
434- <Columns ss:AutoFitWidth="1" ss:Width="95" />
435- # Status (line)
436- <Columns ss:AutoFitWidth="1" ss:Width="95" />
437- # Destination
438- <Column ss:AutoFitWidth="1" ss:Width="95" />
439- # Cost Center
440- <Column ss:AutoFitWidth="1" ss:Width="95" />
441+ <Column ss:AutoFitWidth="1" ss:Width="80" />
442 # Customer
443- <Columns ss:AutoFitWidth="1" ss:Width="120" />
444+ <Column ss:AutoFitWidth="1" ss:Width="120" />
445 # Customer ref
446- <Columns ss:AutoFitWidth="1" ss:Width="160" />
447+ <Column ss:AutoFitWidth="1" ss:Width="150" />
448 # Source document
449- <Columns ss:AutoFitWidth="1" ss:Width="160" />
450+ <Column ss:AutoFitWidth="1" ss:Width="150" />
451 # Supplier ref
452- <Columns ss:AutoFitWidth="1" ss:Width="160" />
453-
454+ <Column ss:AutoFitWidth="1" ss:Width="150" />
455 <Row>
456- <Cell ss:MergeAcross="11" ss:StyleID="mainheader"><Data ss:Type="String">${getRunParms()['title'] or '' |x}</Data></Cell>
457-</Row>
458-<Row ss:AutoFitHeight="1">
459- <Cell ss:MergeAcross="2" ss:StyleID="mainheader"><Data ss:Type="String">Report run date: ${getRunParms()['run_date'] or '' |x}</Data></Cell>
460- <Cell ss:MergeAcross="1" ss:StyleID="mainheader"><Data ss:Type="String">PO date from: ${getRunParms()['date_from'] or ''|x}</Data></Cell>
461- <Cell ss:MergeAcross="1" ss:StyleID="mainheader"><Data ss:Type="String">PO date to: ${getRunParms()['date_thru'] or '' |x}</Data></Cell>
462- <Cell ss:MergeAcross="1" ss:StyleID="mainheader"><Data ss:Type="String">Supplier: ${getRunParms()['supplier'] or '' |x}</Data></Cell>
463- <Cell ss:MergeAcross="2" ss:StyleID="mainheader"><Data ss:Type="String">PO State: ${getRunParms()['state'] or '' | x}</Data></Cell>
464+ <Cell ss:MergeAcross="2" ss:StyleID="mainheader"><Data ss:Type="String">${getRunParms()['title'] or '' |x}</Data></Cell>
465+</Row>
466+<Row ss:AutoFitHeight="1">
467+ <Cell ss:MergeAcross="1" ss:StyleID="poheader"><Data ss:Type="String">Report run date</Data></Cell>
468+ <Cell ss:StyleID="line"><Data ss:Type="String">${getRunParms()['run_date'] or '' |x}</Data></Cell>
469+</Row>
470+<Row ss:AutoFitHeight="1">
471+ <Cell ss:MergeAcross="1" ss:StyleID="poheader"><Data ss:Type="String">PO date from</Data></Cell>
472+ <Cell ss:StyleID="line"><Data ss:Type="String">${getRunParms()['date_from'] or ''|x}</Data></Cell>
473+</Row>
474+<Row ss:AutoFitHeight="1">
475+ <Cell ss:MergeAcross="1" ss:StyleID="poheader"><Data ss:Type="String">PO date to</Data></Cell>
476+ <Cell ss:StyleID="line"><Data ss:Type="String">${getRunParms()['date_thru'] or '' |x}</Data></Cell>
477 </Row>
478
479 <Row ss:AutoFitHeight="1" >
480@@ -153,57 +165,36 @@
481 </Row>
482
483 % for o in objects:
484-
485- % for line in getPOLines(o.id):
486+ % for line in getPOLines(o.id):
487 <Row ss:AutoFitHeight="1">
488- % if line['raw_state'] in ['cancel', 'cancel_r']:
489- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['order_ref'])|x}</Data></Cell>
490- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['item'])|x}</Data></Cell>
491- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['code'])|x}</Data></Cell>
492- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['description'])|x}</Data></Cell>
493- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['qty_ordered'])|x}</Data></Cell>
494- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['uom'])|x}</Data></Cell>
495- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['qty_received'])|x}</Data></Cell>
496- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['in'])|x}</Data></Cell>
497- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['qty_backordered'])|x}</Data></Cell>
498- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['unit_price'])|x}</Data></Cell>
499- <Cell ss:StyleID="line_grey"><Data ss:Type="Number">${(line['in_unit_price'])|x}</Data></Cell>
500- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['order_created'])|x}</Data></Cell>
501- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['order_confirmed_date'])|x}</Data></Cell>
502- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['order_status'])|x}</Data></Cell>
503- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['state'])|x}</Data></Cell>
504- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['destination'])|x}</Data></Cell>
505- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['cost_centre'])|x}</Data></Cell>
506- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['customer'])|x}</Data></Cell>
507- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['customer_ref'])|x}</Data></Cell>
508- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['source_doc'])|x}</Data></Cell>
509- <Cell ss:StyleID="line_grey"><Data ss:Type="String">${(line['supplier_ref'])|x}</Data></Cell>
510- % else:
511- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['order_ref'])|x}</Data></Cell>
512- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['item'])|x}</Data></Cell>
513- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['code'])|x}</Data></Cell>
514- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['description'])|x}</Data></Cell>
515- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['qty_ordered'])|x}</Data></Cell>
516- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['uom'])|x}</Data></Cell>
517- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['qty_received'])|x}</Data></Cell>
518- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['in'])|x}</Data></Cell>
519- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['qty_backordered'])|x}</Data></Cell>
520- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['unit_price'])|x}</Data></Cell>
521- <Cell ss:StyleID="line"><Data ss:Type="Number">${(line['in_unit_price'])|x}</Data></Cell>
522- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['order_created'])|x}</Data></Cell>
523- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['order_confirmed_date'])|x}</Data></Cell>
524- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['order_status'])|x}</Data></Cell>
525- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['state'])|x}</Data></Cell>
526- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['destination'])|x}</Data></Cell>
527- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['cost_centre'])|x}</Data></Cell>
528- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['customer'])|x}</Data></Cell>
529- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['customer_ref'])|x}</Data></Cell>
530- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['source_doc'])|x}</Data></Cell>
531- <Cell ss:StyleID="line"><Data ss:Type="String">${(line['supplier_ref'])|x}</Data></Cell>
532- %endif
533+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['order_ref'])|x}</Data></Cell>
534+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['supplier'])|x}</Data></Cell>
535+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['order_type'])|x}</Data></Cell>
536+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['item'])|x}</Data></Cell>
537+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['code'])|x}</Data></Cell>
538+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['description'])|x}</Data></Cell>
539+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['qty_ordered'])|x}</Data></Cell>
540+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['uom'])|x}</Data></Cell>
541+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['qty_received'])|x}</Data></Cell>
542+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['in'])|x}</Data></Cell>
543+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['qty_backordered'])|x}</Data></Cell>
544+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['unit_price'])|x}</Data></Cell>
545+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['in_unit_price'])|x}</Data></Cell>
546+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['currency'])|x}</Data></Cell>
547+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['total_currency'])|x}</Data></Cell>
548+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="Number">${(line['total_func_currency'])|x}</Data></Cell>
549+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['order_created'])|x}</Data></Cell>
550+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['delivery_requested_date'])|x}</Data></Cell>
551+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['order_confirmed_date'])|x}</Data></Cell>
552+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['state'])|x}</Data></Cell>
553+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['order_status'])|x}</Data></Cell>
554+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['customer'])|x}</Data></Cell>
555+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['customer_ref'])|x}</Data></Cell>
556+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['source_doc'])|x}</Data></Cell>
557+ <Cell ss:StyleID="${getLineStyle(line)|x}"><Data ss:Type="String">${(line['supplier_ref'])|x}</Data></Cell>
558 </Row>
559- % endfor
560- % endfor
561+ % endfor
562+% endfor
563
564 </Table>
565 <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
566
567=== modified file 'bin/addons/msf_supply_doc_export/wizard/po_follow_up.py'
568--- bin/addons/msf_supply_doc_export/wizard/po_follow_up.py 2018-04-13 13:28:59 +0000
569+++ bin/addons/msf_supply_doc_export/wizard/po_follow_up.py 2018-11-09 16:23:13 +0000
570@@ -56,7 +56,7 @@
571 states[state_val] = state_string
572 report_parms = {
573 'title': 'PO Follow Up per Supplier',
574- 'run_date': time.strftime("%d/%m/%Y"),
575+ 'run_date': time.strftime("%d.%m.%Y"),
576 'date_from': '',
577 'date_thru': '',
578 'state': '',
579@@ -76,12 +76,12 @@
580 if wiz.po_date_from:
581 domain.append(('date_order', '>=', wiz.po_date_from))
582 tmp = datetime.strptime(wiz.po_date_from, "%Y-%m-%d")
583- report_parms['date_from'] = tmp.strftime("%d/%m/%Y")
584+ report_parms['date_from'] = tmp.strftime("%d.%m.%Y")
585
586 if wiz.po_date_thru:
587 domain.append(('date_order', '<=', wiz.po_date_thru))
588 tmp = datetime.strptime(wiz.po_date_thru, "%Y-%m-%d")
589- report_parms['date_thru'] = tmp.strftime("%d/%m/%Y")
590+ report_parms['date_thru'] = tmp.strftime("%d.%m.%Y")
591
592 # Supplier
593 if wiz.partner_id:
594@@ -106,7 +106,7 @@
595 report_header_line2 = ''
596 if wiz.partner_id:
597 report_header_line2 += wiz.partner_id.name
598- report_header_line2 += ' Report run date: ' + time.strftime("%d/%m/%Y") # TODO to be removed
599+ report_header_line2 += ' Report run date: ' + time.strftime("%d.%m.%Y") # TODO to be removed
600 if wiz.po_date_from:
601 report_header_line2 += wiz.po_date_from
602 # UF-2496: Minor fix to append the "date from" correctly into header
603
604=== modified file 'bin/addons/purchase/purchase_order_line.py'
605--- bin/addons/purchase/purchase_order_line.py 2018-09-17 16:16:37 +0000
606+++ bin/addons/purchase/purchase_order_line.py 2018-11-09 16:23:13 +0000
607@@ -543,6 +543,10 @@
608 'cold_chain': fields.function(_get_product_info, type='char', string='Cold Chain', multi='product_info', method=True),
609 'controlled_substance': fields.function(_get_product_info, type='char', string='Controlled Substance', multi='product_info', method=True),
610 'justification_code_id': fields.function(_get_product_info, type='char', string='Justification Code', multi='product_info', method=True),
611+ 'create_date': fields.date('Creation date', readonly=True),
612+ 'validation_date': fields.date('Validation Date', readonly=True),
613+ 'confirmation_date': fields.date('Confirmation Date', readonly=True),
614+ 'closed_date': fields.date('Closed Date', readonly=True),
615 }
616
617
618
619=== modified file 'bin/addons/purchase/purchase_workflow.py'
620--- bin/addons/purchase/purchase_workflow.py 2018-10-28 09:48:14 +0000
621+++ bin/addons/purchase/purchase_workflow.py 2018-11-09 16:23:13 +0000
622@@ -607,7 +607,7 @@
623 self.write(cr, uid, pol.id, line_update, context=context)
624
625
626- self.write(cr, uid, ids, {'state': 'validated'}, context=context)
627+ self.write(cr, uid, ids, {'state': 'validated', 'validation_date': datetime.now().strftime('%Y-%m-%d')}, context=context)
628
629 return True
630
631@@ -748,7 +748,7 @@
632 if pol.linked_sol_id:
633 wf_service.trg_validate(uid, 'sale.order.line', pol.linked_sol_id.id, 'confirmed', cr)
634
635- self.write(cr, uid, [pol.id], {'state': 'confirmed'}, context=context)
636+ self.write(cr, uid, [pol.id], {'state': 'confirmed', 'confirmation_date': datetime.now().strftime('%Y-%m-%d')}, context=context)
637
638 if pol.order_id.order_type == 'direct':
639 wf_service.trg_validate(uid, 'purchase.order.line', pol.id, 'done', cr)
640@@ -787,7 +787,7 @@
641 if internal_ir or dpo or ir_non_stockable:
642 wf_service.trg_validate(uid, 'sale.order.line', pol.linked_sol_id.id, 'done', cr)
643
644- self.write(cr, uid, ids, {'state': 'done'}, context=context)
645+ self.write(cr, uid, ids, {'state': 'done', 'closed_date': datetime.now().strftime('%Y-%m-%d')}, context=context)
646
647 return True
648

Subscribers

People subscribed via source and target branches