Merge lp:~unifield-team/unifield-wm/sp-181 into lp:unifield-wm

Proposed by Quentin THEURET @Amaris
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/sp-181
Merge into: lp:unifield-wm
Diff against target: 955 lines (+357/-51)
14 files modified
delivery_mechanism/wizard/enter_reason.py (+8/-0)
msf_field_access_rights/osv_override.py (+14/-0)
msf_outgoing/msf_outgoing.py (+3/-1)
procurement_report/wizard/schedulers_all.py (+5/-0)
procurement_request/procurement_request.py (+3/-0)
purchase_override/purchase.py (+50/-6)
purchase_override/wizard/order_change_currency.py (+11/-0)
purchase_override/wizard/split_order_line.py (+7/-0)
sale_override/sale.py (+55/-5)
sale_override/wizard/order_change_currency.py (+89/-35)
sale_override/wizard/split_order_line.py (+9/-0)
sourcing/sale_order_line.py (+3/-0)
stock_override/stock.py (+18/-0)
tender_flow/tender_flow.py (+82/-4)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/sp-181
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+249209@code.launchpad.net
To post a comment you must log in.
lp:~unifield-team/unifield-wm/sp-181 updated
2393. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages on internal request validation and cancelation

2394. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages at Picking cancelation (IN/INT/OUT/PICK)

2395. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages when the split FOs are sourced and when a new FO is created to re-source a canceled one

2396. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages when cancel a PO line (attached or not to a FO/IR line)

2397. By Quentin THEURET @Amaris

SP-181 [IMP] Add information on INFOLOG of FO/IR validation

2398. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message at PO cancelation

2399. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG Message when all lines of a FO/IR have been sourced

2400. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when split a FO/IR line

2401. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when the currency is changed in the FO

2402. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages when a Picking Ticket / Delivery Order / Internal move is created from FO/IR

2403. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG when remove an Internal request line

2404. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message at Incoming shipment creation from PO

2405. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message at PO line deletion

2406. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when split qty of a purchase order line

2407. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when change the currency on a PO/RfQ

2408. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages when RfQ is sent or updated

2409. By Quentin THEURET @Amaris

SP-181 [IMP]

* Add INFOLOG when tender generates RfQ
* Add INFOLOG when tender is canceled
* Add INFOLOG when tender line is canceled
* Add INFOLOG when IN is canceled or canceled and resourced

2410. By Quentin THEURET @Amaris

Merge latest trunk

2411. By Quentin THEURET @Amaris

SP-181 [IMP] Add log message when line 'from stock' are sourced

2412. By Quentin THEURET @Amaris

SP-181 [IMP] Add infolog messages for tender/Rfq

Unmerged revisions

2412. By Quentin THEURET @Amaris

SP-181 [IMP] Add infolog messages for tender/Rfq

2411. By Quentin THEURET @Amaris

SP-181 [IMP] Add log message when line 'from stock' are sourced

2410. By Quentin THEURET @Amaris

Merge latest trunk

2409. By Quentin THEURET @Amaris

SP-181 [IMP]

* Add INFOLOG when tender generates RfQ
* Add INFOLOG when tender is canceled
* Add INFOLOG when tender line is canceled
* Add INFOLOG when IN is canceled or canceled and resourced

2408. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG messages when RfQ is sent or updated

2407. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when change the currency on a PO/RfQ

2406. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message when split qty of a purchase order line

2405. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message at PO line deletion

2404. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG message at Incoming shipment creation from PO

2403. By Quentin THEURET @Amaris

SP-181 [IMP] Add INFOLOG when remove an Internal request line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'delivery_mechanism/wizard/enter_reason.py'
2--- delivery_mechanism/wizard/enter_reason.py 2015-03-26 15:26:24 +0000
3+++ delivery_mechanism/wizard/enter_reason.py 2015-10-05 09:54:58 +0000
4@@ -61,6 +61,7 @@
5 change_reason = data['change_reason']
6 values = {'change_reason': change_reason}
7 # update the object
8+ messages = []
9 for obj in picking_obj.browse(cr, uid, picking_ids, context=context):
10 # purchase order line to re-source
11 pol_ids = []
12@@ -75,12 +76,14 @@
13 pol_qty[move.purchase_line_id.id] += move.product_qty
14
15 # if full cancel (no resource), we updated corresponding out and correct po state
16+ rsrc = ''
17 picking_obj.cancel_and_update_out(cr, uid, [obj.id], context=context)
18 if cancel_type != 'update_out':
19 context['pol_qty'] = pol_qty
20 context['from_in_cancel'] = True
21 pol_obj.write(cr, uid, pol_ids, {'has_to_be_resourced': True}, context=context)
22 pol_obj.cancel_sol(cr, uid, pol_ids, context=context)
23+ rsrc = _(' Needs sourced by this IN has been resourced.')
24
25 # cancel the IN
26 wf_service.trg_validate(uid, 'stock.picking', obj.id, 'button_cancel', cr)
27@@ -90,6 +93,11 @@
28 wf_service.trg_validate(uid, 'purchase.order', obj.purchase_id.id, 'picking_ok', cr)
29 purchase_obj.log(cr, uid, obj.purchase_id.id, _('The Purchase Order %s is %s%% received')%(obj.purchase_id.name, round(obj.purchase_id.shipped_rate,2)))
30
31+ messages.append(_('The IN \'%s\' has been canceled. %s') % (obj.name, rsrc))
32+
33+ for msg in messages:
34+ picking_obj.infolog(cr, uid, msg)
35+
36 return {'type': 'ir.actions.act_window_close'}
37
38 enter_reason()
39
40=== modified file 'msf_field_access_rights/osv_override.py'
41--- msf_field_access_rights/osv_override.py 2015-03-18 09:35:02 +0000
42+++ msf_field_access_rights/osv_override.py 2015-10-05 09:54:58 +0000
43@@ -142,6 +142,20 @@
44 orm.orm.create = create
45
46
47+def infolog(self, cr, uid, message):
48+ import netsvc
49+ logger = netsvc.Logger()
50+ user = self.pool.get('res.users').read(cr, uid, uid, ['name'])['name']
51+ logger.notifyChannel(
52+ 'INFOLOG: Model: %s :: User: %s :: ' % (self._name, user),
53+ netsvc.LOG_INFO,
54+ message,
55+ )
56+
57+orm.orm.infolog = infolog
58+orm.orm_template.infolog = infolog
59+
60+
61 def _values_equate(field_type, current_value, new_value):
62 """
63 discern if two values differ or not, for each file type that is different in the database read() value and the web write vals data value (boring)
64
65=== modified file 'msf_outgoing/msf_outgoing.py'
66--- msf_outgoing/msf_outgoing.py 2015-09-02 07:41:48 +0000
67+++ msf_outgoing/msf_outgoing.py 2015-10-05 09:54:58 +0000
68@@ -628,7 +628,9 @@
69 picking_obj.force_assign(cr, uid, [new_packing_id])
70
71 # Log creation message
72- self.log(cr, uid, shipment.id, _('The new Shipment %s has been created.') % (shipment_name,))
73+ message = _('The new Shipment %s has been created.') % (shipment.name,)
74+ self.log(cr, uid, shipment.id, message)
75+ self.infolog(cr, uid, message)
76 # The shipment is automatically shipped, no more pack states in between.
77 self.ship(cr, uid, [shipment_id], context=context)
78
79
80=== modified file 'procurement_report/wizard/schedulers_all.py'
81--- procurement_report/wizard/schedulers_all.py 2015-07-08 08:22:04 +0000
82+++ procurement_report/wizard/schedulers_all.py 2015-10-05 09:54:58 +0000
83@@ -22,6 +22,8 @@
84 import threading
85
86 from osv import osv
87+from tools.translate import _
88+
89
90 class procurement_purchase_compute_all(osv.osv_memory):
91 _name = 'procurement.purchase.compute.all'
92@@ -60,6 +62,9 @@
93
94 threaded_calculation = threading.Thread(target=self._procure_calculation_all_purchase, args=(cr, uid, ids, context))
95 threaded_calculation.start()
96+ self.infolog(cr, uid, _(
97+ 'The \'Auto POs creation\' scheduler has been launched.',
98+ ))
99 return {'type': 'ir.actions.act_window_close'}
100
101 procurement_purchase_compute_all()
102
103=== modified file 'procurement_request/procurement_request.py'
104--- procurement_request/procurement_request.py 2015-05-26 14:25:23 +0000
105+++ procurement_request/procurement_request.py 2015-10-05 09:54:58 +0000
106@@ -441,6 +441,7 @@
107 for line in req.order_line:
108 if line.id not in line_ids:
109 line_ids.append(line.id)
110+ self.infolog(cr, uid, _('The Internal Request \'%s\' has been canceled (state: %s).') % (req.name, req.state))
111
112 self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
113 self.pool.get('sale.order.line').write(cr, uid, line_ids, {'state': 'cancel'}, context=context)
114@@ -473,6 +474,7 @@
115 raise osv.except_osv(_('Error'), _('A line must a have a quantity larger than 0.00'))
116 if nb_lines:
117 raise osv.except_osv(_('Error'), _('Please check the lines : you cannot have "To Be confirmed" for Nomenclature Level". You have %s lines to correct !') % nb_lines)
118+ self.infolog(cr, uid, _('The Internal Request \'%s\' has been validated.') % req.name)
119 self.write(cr, uid, ids, {'state': 'validated'}, context=context)
120
121 return True
122@@ -505,6 +507,7 @@
123 proc_view = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'procurement_request', 'procurement_request_form_view')
124 context.update({'view_id': proc_view and proc_view[1] or False})
125 self.log(cr, uid, request.id, message, context=context)
126+ self.infolog(cr, uid, message)
127
128 self.action_ship_create(cr, uid, ids, context=context)
129
130
131=== modified file 'purchase_override/purchase.py'
132--- purchase_override/purchase.py 2015-08-07 03:28:33 +0000
133+++ purchase_override/purchase.py 2015-10-05 09:54:58 +0000
134@@ -140,6 +140,10 @@
135 data = self.read(cr, uid, new_po_id, ['name'], context=context)
136 # log message describing the previous action
137 self.log(cr, uid, new_po_id, _('The Purchase Order %s has been generated from Request for Quotation.')%data['name'])
138+ self.infolog(cr, uid, _('The Purchase Order \'%s\' has been generated from Request for Quotation \'%s\'.') % (
139+ data['name'],
140+ self.read(cr, uid, ids[0], ['name'])['name']
141+ ))
142 # close the current po
143 wf_service = netsvc.LocalService("workflow")
144 wf_service.trg_validate(uid, 'purchase.order', ids[0], 'rfq_done', cr)
145@@ -504,6 +508,9 @@
146
147 wf_service.trg_validate(uid, 'purchase.order', po.id, 'purchase_cancel', cr)
148
149+ po_type = po.rfq_ok and 'RfQ' or 'PO'
150+ self.infolog(cr, uid, _('The %s \'%s\' has been canceled') % (po_type, po.name))
151+
152 # Ask user to choose what must be done on the FO/IR
153 if so_to_cancel_ids:
154 context.update({
155@@ -1075,6 +1082,7 @@
156
157 todo = []
158
159+ messages = []
160 for po in self.browse(cr, uid, ids, context=context):
161 line_error = []
162 if po.order_type == 'regular':
163@@ -1105,6 +1113,7 @@
164
165 message = _("Purchase order '%s' is validated.") % (po.name,)
166 self.log(cr, uid, po.id, message)
167+ messages.append(message)
168 # hook for corresponding Fo update
169 self._hook_confirm_order_update_corresponding_so(cr, uid, ids, context=context, po=po)
170
171@@ -1116,6 +1125,9 @@
172
173 self.check_analytic_distribution(cr, uid, ids, context=context)
174
175+ for msg in messages:
176+ self.infolog(cr, uid, msg)
177+
178 return True
179
180 def common_code_from_wkf_approve_order(self, cr, uid, ids, context=None):
181@@ -1220,6 +1232,11 @@
182 'name': '[%s] %s' % (l.product_id.default_code, l.product_id.name)}
183
184 new_line_id = sol_obj.create(cr, uid, vals, context=context)
185+ model = 'FO'
186+ if l.link_so_id.procurement_request:
187+ model = 'IR'
188+ message = _('A new line has been created on %s \'%s\' from the PO \'%s\'.') % (model, l.link_so_id.name, order.name)
189+ self.infolog(cr, uid, message)
190
191 # Put the sale_id in the procurement order
192 if l.procurement_id:
193@@ -1308,8 +1325,12 @@
194 if exp_sol.po_id and exp_sol.po_id.id not in all_po_ids:
195 all_po_ids.append(exp_sol.po_id.id)
196 list_po_name = ', '.join([linked_po.name for linked_po in self.browse(cr, uid, all_po_ids, context) if linked_po.id != ids[0]])
197- self.log(cr, uid, ids[0], _("The order %s is in confirmed (waiting) state and will be confirmed once the related orders [%s] would have been confirmed"
198- ) % (self.read(cr, uid, ids, ['name'])[0]['name'], list_po_name))
199+ message = _("""The order %s is in confirmed (waiting) state and will be confirmed once the related orders [%s] would have been confirmed""") % (
200+ self.read(cr, uid, ids, ['name'])[0]['name'],
201+ list_po_name,
202+ )
203+ self.log(cr, uid, ids[0], message)
204+ self.infolog(cr, uid, message)
205 # sale order lines with modified state
206 if sol_ids:
207 sol_obj.write(cr, uid, sol_ids, {'state': 'confirmed'}, context=context)
208@@ -1806,6 +1827,8 @@
209
210 # @@@override@purchase.purchase.order.wkf_approve_order
211 self.write(cr, uid, ids, {'state': 'approved', 'date_approve': strftime('%Y-%m-%d')})
212+ for order in self.browse(cr, uid, ids, context=context):
213+ self.infolog(cr, uid, _('The PO \'%s\' has been confirmed.') % order.name)
214 return True
215
216 def need_counterpart(self, cr, uid, ids, context=None):
217@@ -1977,6 +2000,8 @@
218 picking_values.update({'reason_type_id': reason_type_id})
219
220 picking_id = self.pool.get('stock.picking').create(cr, uid, picking_values, context=context)
221+ from tools.translate import _
222+ msg = _('The IN \'%s\' has been generated from the confirmation of the PO \'%s\'.') % (pick_name, order.name)
223 todo_moves = []
224 for order_line in order.order_line:
225 # Reload the data of the line because if the line comes from an ISR and it's a duplicate line,
226@@ -2034,6 +2059,9 @@
227 if self._hook_action_picking_create_modify_out_source_loc_check(cr, uid, ids, context=context, order_line=order_line, move_id=move):
228 moves_to_update.append(order_line.move_dest_id.id)
229 todo_moves.append(move)
230+
231+ self.infolog(cr, uid, msg)
232+
233 # compute function fields
234 if todo_moves:
235 compute_store = self.pool.get('stock.move')._store_get_values(cr, uid, todo_moves, None, context)
236@@ -2048,6 +2076,7 @@
237 move_obj.force_assign(cr, uid, todo_moves)
238 wf_service = netsvc.LocalService("workflow")
239 wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
240+
241 return picking_id
242 # @@@end
243
244@@ -3110,6 +3139,7 @@
245 proc_ids = []
246 purchase_ids = []
247 line_to_cancel = []
248+ messages = []
249
250 for line in self.browse(cr, uid, ids, context=context):
251 # Set the procurement orders to delete
252@@ -3122,7 +3152,10 @@
253 if not self.pool.get('sale.order.line.cancel').search(cr, uid, [
254 ('sync_order_line_db_id', '=', line.sync_order_line_db_id),
255 ], context=context):
256+ messages.append(_('Line #%s of the PO %s has been canceled. The corresponding IR/FO line has been updated/canceled') % (line.line_number, line.order_id.name))
257 so_to_cancel = self.cancel_sol(cr, uid, [line.id], context=context)
258+ else:
259+ messages.append(_('Line #%s of the PO %s has been canceled.') % (line.line_numbre, line.order_id.name))
260
261 # we want to skip resequencing because unlink is performed on merged purchase order lines
262 tmp_Resequencing = context.get('skipResequencing', False)
263@@ -3143,6 +3176,9 @@
264 self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
265 self.unlink(cr, uid, line_to_cancel, context=context)
266
267+ for msg in messages:
268+ self.infolog(cr, uid, msg)
269+
270 return so_to_cancel
271
272 def unlink(self, cr, uid, ids, context=None):
273@@ -3159,14 +3195,19 @@
274 ids = [ids]
275
276 order_ids = []
277- for line in self.read(cr, uid, ids, ['id', 'order_id'], context=context):
278+ messages = []
279+ for line in self.browse(cr, uid, ids, context=context):
280 # we want to skip resequencing because unlink is performed on merged purchase order lines
281 tmp_skip_resourcing = context.get('skipResourcing', False)
282 context['skipResourcing'] = True
283- self._update_merged_line(cr, uid, line['id'], False, context=context)
284+ self._update_merged_line(cr, uid, line.id, False, context=context)
285 context['skipResourcing'] = tmp_skip_resourcing
286- if line['order_id'][0] not in order_ids:
287- order_ids.append(line['order_id'][0])
288+ if line.order_id.id not in order_ids:
289+ order_ids.append(line.order_id.id)
290+
291+ if not line.order_id.rfq_ok:
292+ messages.append(_('The line #%s of the PO \'%s\' has been deleted.') % (line.line_number, line.order_id.name))
293+
294
295 if context.get('from_del_wizard'):
296 return self.ask_unlink(cr, uid, ids, context=context)
297@@ -3175,6 +3216,9 @@
298
299 po_obj.wkf_confirm_trigger(cr, uid, order_ids, context=context)
300
301+ for msg in messages:
302+ self.infolog(cr, uid, msg)
303+
304 return res
305
306 def _get_fake_state(self, cr, uid, ids, field_name, args, context=None):
307
308=== modified file 'purchase_override/wizard/order_change_currency.py'
309--- purchase_override/wizard/order_change_currency.py 2012-12-03 10:20:08 +0000
310+++ purchase_override/wizard/order_change_currency.py 2015-10-05 09:54:58 +0000
311@@ -79,6 +79,7 @@
312 line_obj = self.pool.get('purchase.order.line')
313 order_obj = self.pool.get('purchase.order')
314
315+ messages = []
316 for wiz in self.browse(cr, uid, ids, context=context):
317 for line in wiz.order_id.order_line:
318 new_price = currency_obj.compute(cr, uid, wiz.old_pricelist_id.currency_id.id, wiz.new_pricelist_id.currency_id.id, line.price_unit, round=False, context=context)
319@@ -94,6 +95,16 @@
320 order_data.update({'transport_currency_id': cur_id})
321
322 order_obj.write(cr, uid, wiz.order_id.id, order_data)
323+ o_type = wiz.order_id.rfq_ok and 'RfQ' or 'PO'
324+ messages.append(_('The currency of the %s \'%s\' has been changed (from %s to %s).') % (
325+ o_type,
326+ wiz.order_id.name,
327+ wiz.old_pricelist_id.currency_id.name,
328+ wiz.new_pricelist_id.currency_id.name,
329+ ))
330+
331+ for msg in messages:
332+ self.infolog(cr, uid, msg)
333
334 return {'type': 'ir.actions.act_window_close'}
335
336
337=== modified file 'purchase_override/wizard/split_order_line.py'
338--- purchase_override/wizard/split_order_line.py 2015-07-22 13:02:02 +0000
339+++ purchase_override/wizard/split_order_line.py 2015-10-05 09:54:58 +0000
340@@ -250,6 +250,13 @@
341 if context.get('from_simu_screen'):
342 return new_line_ids[0]
343
344+ self.infolog(cr, uid, _('The line #%s of the PO \'%s\' has been split (old qty: %s - new qty: %s).') % (
345+ split.purchase_line_id.line_number,
346+ split.purchase_line_id.order_id.name,
347+ split.original_qty,
348+ split.original_qty - split.new_line_qty,
349+ ))
350+
351 if context.get('from_simu_screen'):
352 return False
353
354
355=== modified file 'sale_override/sale.py'
356--- sale_override/sale.py 2015-08-07 03:28:33 +0000
357+++ sale_override/sale.py 2015-10-05 09:54:58 +0000
358@@ -370,6 +370,11 @@
359
360 context.update({'no_check_line': True})
361 self.write(cr, uid, ids, {'delivery_confirmed_date': time.strftime('%Y-%m-%d')}, context=context)
362+
363+
364+ for order in self.browse(cr, uid, ids, context=context):
365+ self.infolog(cr, uid, _('Cancelation of the field order %s (state: %s)') % (order.name, order.state))
366+
367 return super(sale_order, self).action_cancel(cr, uid, ids, context=context)
368
369 #@@@override sale.sale_order._invoiced
370@@ -936,10 +941,14 @@
371
372 # Display validation message to the user
373 for order in order_brw_list:
374+ nb_lines = len(order.order_line)
375 if not order.procurement_request:
376- self.log(cr, uid, order.id, 'The Field order \'%s\' has been validated.' % order.name, context=context)
377+ message = _('The Field order \'%s\' has been validated (nb lines: %s).') % (order.name, nb_lines)
378 else:
379- self.log(cr, uid, order.id, 'The Internal Request \'%s\' has been validated.' % order.name, context=context)
380+ message = _('The Internal Request \'%s\' has been validated (nb lines: %s).') % (order.name, nb_lines)
381+
382+ self.log(cr, uid, order.id, message, context=context)
383+ self.infolog(cr, uid, message)
384
385 return True
386
387@@ -1023,6 +1032,7 @@
388 'split_type_sale_order': fo_type,
389 'ready_to_ship_date': line.order_id.ready_to_ship_date,
390 'original_so_id_sale_order': so.id}, context=dict(context, keepDateAndDistrib=True, keepClientOrder=True))
391+ self.infolog(cr, uid, _('The \'%s\' split \'%s\' has been created.') % (selec_name, fo_name))
392 # log the action of split
393 self.log(cr, uid, split_id, _('The %s split %s has been created.') % (selec_name, fo_name))
394 split_fo_dic[fo_type] = split_id
395@@ -1126,6 +1136,8 @@
396 sol_obj.write(cr, uid, sol_ids, {'state': 'done'}, context=context)
397 self.write(cr, uid, ids, {'state': 'done',
398 'active': False}, context=context)
399+ for order in self.browse(cr, uid, ids, context=context):
400+ self.infolog(cr, uid, _('The Field order \'%s\' has been splitted') % order.name)
401 return True
402
403 def get_po_ids_from_so_ids(self, cr, uid, ids, context=None):
404@@ -1580,6 +1592,16 @@
405 if not picking_id:
406 picking_data = self._get_picking_data(cr, uid, order)
407 picking_id = picking_obj.create(cr, uid, picking_data, context=context)
408+ order_type = order.procurement_request and 'IR' or 'FO'
409+ pick_type = 'Picking Ticket'
410+ if picking_data.get('type') == 'internal':
411+ pick_type = 'Internal move'
412+ elif picking_data.get('subtype') == 'standard':
413+ pick_type = 'Outgoing delivery'
414+ msg = _('The %s \'%s\' has been generated from %s \'%s\'') % (
415+ pick_type, picking_data.get('name'), order_type, order.name
416+ )
417+ self.infolog(cr, uid, msg)
418
419 # Get move data and create the move
420 move_data = self._get_move_data(cr, uid, order, line, picking_id, context=context)
421@@ -1587,6 +1609,12 @@
422 # defer overall_qty computation at the end of this method
423 context['bypass_store_function'] = [('stock.picking', ['overall_qty'])]
424 move_id = self.pool.get('stock.move').create(cr, uid, move_data, context=context)
425+ if line.type == 'make_to_stock':
426+ pick_name = self.pool.get('stock.move').read(cr, uid, move_id, ['picking_id'], context=context)['picking_id'][1]
427+ msg = _('The line #%s of %s has been sourced \'from stock\' with the %s') % (
428+ line.line_number, line.order_id.name, pick_name,
429+ )
430+ self.infolog(cr, uid, msg)
431 move_ids.append(move_id)
432 context['bypass_store_function'] = False
433
434@@ -2050,6 +2078,7 @@
435 # display message for sourced
436 if display_log:
437 self.log(cr, uid, order.id, _('The split \'%s\' is sourced.') % (order.name))
438+ self.infolog(cr, uid, _('The split \'%s\' is sourced.') % order.name)
439
440 prog_id = self.update_sourcing_progress(cr, uid, order, prog_id, {
441 'line_completed': _('In Progress (%s/%s)') % (line_done, line_total),
442@@ -2269,9 +2298,13 @@
443 '''
444 sale_ids = []
445 res = False
446- for line in self.read(cr, uid, ids, ['order_id'], context=context):
447- if line['order_id'][0] not in sale_ids:
448- sale_ids.append(line['order_id'][0])
449+ for line in self.browse(cr, uid, ids, context=context):
450+ self.infolog(cr, uid, _('Line #%s of the order %s removed.') % (
451+ line.line_number,
452+ line.order_id.name,
453+ ))
454+ if line.order_id.id not in sale_ids:
455+ sale_ids.append(line.order_id.id)
456
457 self.unlink(cr, uid, ids, context=context)
458
459@@ -2281,6 +2314,23 @@
460
461 return res
462
463+ def unlink(self, cr, uid, ids, context=None):
464+ messages = []
465+ for line in self.browse(cr, uid, ids, context=context):
466+ if line.order_id and line.order_id.procurement_request:
467+ messages.append(
468+ _('The line #%s of IR \'%s\' has been removed') % (
469+ line.line_number, line.order_id.name
470+ )
471+ )
472+
473+ res = super(sale_order_line, self).unlink(cr, uid, ids, context=context)
474+
475+ for msg in messages:
476+ self.infolog(cr, uid, msg)
477+
478+ return res
479+
480 def _check_restriction_line(self, cr, uid, ids, context=None):
481 '''
482 Check if there is restriction on lines
483
484=== modified file 'sale_override/wizard/order_change_currency.py'
485--- sale_override/wizard/order_change_currency.py 2012-12-03 10:20:08 +0000
486+++ sale_override/wizard/order_change_currency.py 2015-10-05 09:54:58 +0000
487@@ -2,7 +2,7 @@
488 ##############################################################################
489 #
490 # OpenERP, Open Source Management Solution
491-# Copyright (C) 2011 TeMPO Consulting, MSF
492+# Copyright (C) 2011 TeMPO Consulting, MSF
493 #
494 # This program is free software: you can redistribute it and/or modify
495 # it under the terms of the GNU Affero General Public License as
496@@ -26,70 +26,124 @@
497
498 class sale_order_change_currency(osv.osv_memory):
499 _name = 'sale.order.change.currency'
500-
501+
502 _columns = {
503- 'order_id': fields.many2one('sale.order', string='Order', required=True),
504- 'partner_id': fields.many2one('res.partner', string='Partner', required=True),
505- 'partner_type': fields.selection(string='Partner Type', selection=PARTNER_TYPE),
506- 'old_pricelist_id': fields.many2one('product.pricelist', string='Old currency', required=True, readonly=True),
507- 'new_pricelist_id': fields.many2one('product.pricelist', string='New currency', required=True),
508- 'currency_rate': fields.float(digits=(16,6), string='Currency rate', readonly=True),
509+ 'order_id': fields.many2one(
510+ 'sale.order',
511+ string='Order',
512+ required=True,
513+ ),
514+ 'partner_id': fields.many2one(
515+ 'res.partner',
516+ string='Partner',
517+ required=True,
518+ ),
519+ 'partner_type': fields.selection(
520+ string='Partner Type',
521+ selection=PARTNER_TYPE,
522+ ),
523+ 'old_pricelist_id': fields.many2one(
524+ 'product.pricelist',
525+ string='Old currency',
526+ required=True,
527+ readonly=True,
528+ ),
529+ 'new_pricelist_id': fields.many2one(
530+ 'product.pricelist',
531+ string='New currency',
532+ required=True,
533+ ),
534+ 'currency_rate': fields.float(
535+ digits=(16, 6),
536+ string='Currency rate',
537+ readonly=True,
538+ ),
539 }
540-
541- def compute_pricelist_rate(self, cr, uid, from_pricelist, to_pricelist, context=None):
542+
543+ def compute_pricelist_rate(self, cr, uid,
544+ from_pricelist,
545+ to_pricelist, context=None):
546 '''
547 Compute the currency rate between two products pricelists
548 '''
549 if not from_pricelist and not to_pricelist:
550- raise osv.except_osv(_('Error'), _('Please give two pricelists'))
551-
552+ raise osv.except_osv(
553+ _('Error'),
554+ _('Please give two pricelists')
555+ )
556+
557 pricelist_obj = self.pool.get('product.pricelist')
558- from_currency = pricelist_obj.browse(cr, uid, from_pricelist).currency_id.id
559- to_currency = pricelist_obj.browse(cr, uid, to_pricelist).currency_id.id
560-
561- rate = self.pool.get('res.currency').compute(cr, uid, from_currency, to_currency, 1.00)
562-
563+ cur_obj = self.pool.get('res.currency')
564+
565+ from_currency = pricelist_obj.browse(
566+ cr, uid, from_pricelist).currency_id.id
567+ to_currency = pricelist_obj.browse(
568+ cr, uid, to_pricelist).currency_id.id
569+
570+ rate = cur_obj.compute(cr, uid, from_currency, to_currency, 1.00)
571+
572 return rate
573-
574- def currency_change(self, cr, uid, ids, old_pricelist_id, new_pricelist_id):
575+
576+ def currency_change(self, cr, uid, ids,
577+ old_pricelist_id,
578+ new_pricelist_id):
579 '''
580 Compute the rate between the two currencies
581 '''
582 res = {'currency_rate': 0.00}
583 if old_pricelist_id and new_pricelist_id:
584- rate = self.compute_pricelist_rate(cr, uid, old_pricelist_id, new_pricelist_id)
585+ rate = self.compute_pricelist_rate(
586+ cr, uid, old_pricelist_id, new_pricelist_id)
587 res = {'currency_rate': rate}
588-
589+
590 return {'value': res}
591-
592+
593 def apply_to_lines(self, cr, uid, ids, context=None):
594 '''
595 Apply the conversion on lines
596 '''
597 if not context:
598 context = {}
599-
600+
601 if isinstance(ids, (int, long)):
602 ids = [ids]
603-
604+
605 c = context.copy()
606 c.update({'update_merge': True})
607-
608+
609 currency_obj = self.pool.get('res.currency')
610 line_obj = self.pool.get('sale.order.line')
611 order_obj = self.pool.get('sale.order')
612-
613- for wiz in self.browse(cr, uid, ids, context=context):
614+
615+ for wiz in self.browse(cr, uid, ids, context=context):
616 for line in wiz.order_id.order_line:
617- new_price = currency_obj.compute(cr, uid, wiz.old_pricelist_id.currency_id.id, wiz.new_pricelist_id.currency_id.id, line.price_unit, round=False, context=context)
618- line_obj.write(cr, uid, line.id, {'price_unit': new_price}, context=c)
619-
620- order_data = {'pricelist_id': wiz.new_pricelist_id.id,}
621-
622- order_obj.write(cr, uid, wiz.order_id.id, order_data, context=context)
623-
624+ new_price = currency_obj.compute(
625+ cr,
626+ uid,
627+ wiz.old_pricelist_id.currency_id.id,
628+ wiz.new_pricelist_id.currency_id.id,
629+ line.price_unit,
630+ round=False,
631+ context=context
632+ )
633+ line_obj.write(cr, uid, line.id, {
634+ 'price_unit': new_price,
635+ }, context=c)
636+
637+ order_obj.write(cr, uid, wiz.order_id.id, {
638+ 'pricelist_id': wiz.new_pricelist_id.id,
639+ }, context=context)
640+
641+ msg = _('The currency of the FO \'%s\' has been changed. '\
642+ '(old currency: %s - new currency: %s)') % (
643+ wiz.order_id.name,
644+ wiz.old_pricelist_id.currency_id.name,
645+ wiz.new_pricelist_id.currency_id.name,
646+ )
647+ self.infolog(cr, uid, msg)
648+
649 return {'type': 'ir.actions.act_window_close'}
650-
651+
652 sale_order_change_currency()
653
654 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
655
656=== modified file 'sale_override/wizard/split_order_line.py'
657--- sale_override/wizard/split_order_line.py 2014-01-09 16:02:36 +0000
658+++ sale_override/wizard/split_order_line.py 2015-10-05 09:54:58 +0000
659@@ -76,6 +76,15 @@
660 # Create the new line
661 new_line_id = line_obj.copy(cr, uid, split.sale_line_id.id, so_copy_data, context=context)
662
663+ order_type = split.sale_line_id.order_id.procurement_request and 'IR' or 'FO'
664+ self.infolog(cr, uid, _('The line #%s of the %s \'%s\' has been split (old qty: %s - new qty: %s)') % (
665+ split.sale_line_id.line_number,
666+ order_type,
667+ split.sale_line_id.order_id.name,
668+ split.original_qty,
669+ split.original_qty - split.new_line_qty,
670+ ))
671+
672 return {'type': 'ir.actions.act_window_close'}
673
674 def line_qty_change(self, cr, uid, ids, original_qty, new_line_qty, context=None):
675
676=== modified file 'sourcing/sale_order_line.py'
677--- sourcing/sale_order_line.py 2015-07-24 12:22:31 +0000
678+++ sourcing/sale_order_line.py 2015-10-05 09:54:58 +0000
679@@ -1179,9 +1179,12 @@
680
681 for order_id in order_ids:
682 try:
683+ order_name = self.pool.get('sale.order').read(cr, uid, order_id, ['name'])['name']
684 if state_to_use == 'confirmed':
685+ self.infolog(cr, uid, _('All lines of the IR \'%s\' have been sourced.') % order_name)
686 wf_service.trg_validate(uid, 'sale.order', order_id, 'procurement_confirm', cr)
687 else:
688+ self.infolog(cr, uid, _('All lines of the FO \'%s\' have been sourced.') % order_name)
689 wf_service.trg_validate(uid, 'sale.order', order_id, 'order_confirm', cr)
690 self.pool.get('sale.order').write(cr, uid, [order_id],
691 {'sourcing_trace_ok': False,
692
693=== modified file 'stock_override/stock.py'
694--- stock_override/stock.py 2015-09-24 07:27:06 +0000
695+++ stock_override/stock.py 2015-10-05 09:54:58 +0000
696@@ -581,14 +581,20 @@
697
698 @check_cp_rw
699 def force_assign(self, cr, uid, ids, context=None):
700+ for pick in self.read(cr, uid, ids, ['name'], context=context):
701+ self.infolog(cr, uid, _('Force availability run on %s') % pick['name'])
702 return super(stock_picking, self).force_assign(cr, uid, ids)
703
704 @check_cp_rw
705 def action_assign(self, cr, uid, ids, context=None):
706+ for pick in self.read(cr, uid, ids, ['name'], context=context):
707+ self.infolog(cr, uid, _('Check availability run on %s') % pick['name'])
708 return super(stock_picking, self).action_assign(cr, uid, ids, context=context)
709
710 @check_cp_rw
711 def cancel_assign(self, cr, uid, ids, *args, **kwargs):
712+ for pick in self.read(cr, uid, ids, ['name']):
713+ self.infolog(cr, uid, _('Cancel availability run on %s') % pick['name'])
714 return super(stock_picking, self).cancel_assign(cr, uid, ids)
715
716
717@@ -639,6 +645,14 @@
718 # Re-source the sale.order.line
719 fo_ids = set()
720 for pick in self.browse(cr, uid, ids, context=context):
721+ p_type = 'Internal move'
722+ if pick.type == 'out' and pick.subtype == 'standard':
723+ p_type = _('Outgoing delivery')
724+ else:
725+ p_type = _('Picking Ticket')
726+
727+ if pick.type != 'in':
728+ self.infolog(cr, uid, _('The %s \'%s\' has been canceled (state: %s') % (p_type, pick.name, pick.state))
729 # Don't delete lines if an Available PT is canceled
730 if pick.type == 'out' and pick.subtype == 'picking' and pick.backorder_id and True:
731 continue
732@@ -1401,6 +1415,8 @@
733 for move in self.browse(cr, uid, ids, context=context):
734 if move.product_id.id == product_tbd and move.from_wkf_line:
735 ids.pop(ids.index(move.id))
736+ else:
737+ self.infolog(cr, uid, _('Force availability run on stock move #%s of %s') % (move.line_number, move.picking_id.name))
738
739 return super(stock_move, self).force_assign(cr, uid, ids, context=context)
740
741@@ -1851,6 +1867,8 @@
742 @check_cp_rw
743 def cancel_assign(self, cr, uid, ids, context=None):
744 res = super(stock_move, self).cancel_assign(cr, uid, ids, context=context)
745+ for move in self.browse(cr, uid, ids, context=context):
746+ self.infolog(cr, uid, _('Cancel availability run on stock move #%s of %s') % (move.line_number, move.picking_id.name))
747 res = []
748
749 fields_to_read = ['picking_id', 'product_id', 'product_uom', 'location_id',
750
751=== modified file 'tender_flow/tender_flow.py'
752--- tender_flow/tender_flow.py 2015-05-26 14:25:23 +0000
753+++ tender_flow/tender_flow.py 2015-10-05 09:54:58 +0000
754@@ -294,7 +294,9 @@
755 obj_data = self.pool.get('ir.model.data')
756
757 # no suppliers -> raise error
758+ messages = []
759 for tender in self.browse(cr, uid, ids, context=context):
760+ rfq_names = []
761 # check some supplier have been selected
762 if not tender.supplier_ids:
763 raise osv.except_osv(_('Warning !'), _('You must select at least one supplier!'))
764@@ -340,7 +342,8 @@
765 }
766 # create the rfq - dic is udpated for default partner_address_id at purchase.order level
767 po_id = po_obj.create(cr, uid, values, context=dict(context, partner_id=supplier.id, rfq_ok=True))
768-
769+ rfq_names.append('\'%s\'' % po_obj.read(cr, uid, po_id, ['name'])['name'])
770+
771 for line in tender.tender_line_ids:
772 if line.line_state == 'cancel':
773 continue
774@@ -375,8 +378,17 @@
775 'res_id': po_id,
776 'domain': [('rfq_ok', '=', True)],
777 }, context={'rfq_ok': True})
778+
779+ messages.append(_('The RfQ %s have been generated from the tender \'%s\'') % (
780+ ', '.join(rfq_names),
781+ tender.name,
782+ ))
783
784 self.write(cr, uid, ids, {'state':'comparison'}, context=context)
785+
786+ for msg in messages:
787+ self.infolog(cr, uid, msg)
788+
789 return True
790
791 def wkf_action_done(self, cr, uid, ids, context=None):
792@@ -713,6 +725,7 @@
793 wf_service = netsvc.LocalService("workflow")
794
795 # set state
796+ messages = []
797 self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
798 for tender in self.browse(cr, uid, ids, context=context):
799 # trigger all related rfqs
800@@ -720,8 +733,19 @@
801 for rfq_id in rfq_ids:
802 wf_service.trg_validate(uid, 'purchase.order', rfq_id, 'purchase_cancel', cr)
803
804+ has_to_be_resourced = False
805 for line in tender.tender_line_ids:
806+ if line.has_to_be_resourced:
807+ has_to_be_resourced = True
808 t_line_obj.cancel_sourcing(cr, uid, [line.id], context=context)
809+
810+ if has_to_be_resourced:
811+ messages.append(_('The tender \'%s\' has been canceled. The needs sourced by this tender have been re-sourced.') % (tender.name))
812+ else:
813+ messages.append(_('The tender \'%s\' has been canceled.') % (tender.name))
814+
815+ for msg in messages:
816+ self.infolog(cr, uid, msg)
817
818 return True
819
820@@ -1348,7 +1372,15 @@
821 self.write(cr, uid, ids, {'rfq_id': rfq_id, 'rfq_line_id': rfq_line_id}, context=context)
822
823 # log message concerning RfQ creation
824- rfq_obj.log(cr, uid, rfq_id, "The Request for Quotation '%s' has been created and must be completed before purchase order creation."%rfq_obj.browse(cr, uid, rfq_id, context=context).name, context={'rfq_ok': 1})
825+ rfq_name = rfq_obj.browse(cr, uid, rfq_id, context=context).name
826+ rfq_obj.log(cr, uid, rfq_id, "The Request for Quotation '%s' has been created and must be completed before purchase order creation."%rfq_name, context={'rfq_ok': 1})
827+
828+ msg = _("The line #%s of %s has been sourced on the RfQ %s") % (
829+ sale_order_line.line_number,
830+ sale_order.name,
831+ rfq_name,
832+ )
833+ self.infolog(cr, uid, msg)
834 # state of procurement is Tender
835 self.write(cr, uid, ids, {'state': 'rfq'}, context=context)
836
837@@ -1383,6 +1415,7 @@
838 'priority': sale_order.priority,
839 'warehouse_id': sale_order.shop_id.warehouse_id.id,
840 'requested_date': proc.date_planned,
841+
842 }, context=context)
843 prsd_obj.chk_create(cr, uid, {
844 'order_id': sale_order.id,
845@@ -1404,7 +1437,16 @@
846 self.write(cr, uid, ids, {'tender_id': tender_id, 'tender_line_id': tender_line_id}, context=context)
847
848 # log message concerning tender creation
849- tender_obj.log(cr, uid, tender_id, "The tender '%s' has been created and must be completed before purchase order creation."%tender_obj.browse(cr, uid, tender_id, context=context).name)
850+ tender_name = tender_obj.browse(cr, uid, tender_id, context=context).name
851+ tender_obj.log(cr, uid, tender_id, "The tender '%s' has been created and must be completed before purchase order creation."%tender_name)
852+
853+ msg = _("The line #%s of %s has been sourced on the tender %s") % (
854+ sale_order_line.line_number,
855+ sale_order.name,
856+ tender_name,
857+ )
858+ self.infolog(cr, uid, msg)
859+
860 # state of procurement is Tender
861 self.write(cr, uid, ids, {'state': 'tender'}, context=context)
862
863@@ -1449,10 +1491,21 @@
864 result = super(procurement_order, self).action_po_assign(cr, uid, ids, context=context)
865 # The quotation 'SO001' has been converted to a sales order.
866 if result:
867+ po_name = po_obj.read(cr, uid, result, ['name'], context=context)['name']
868+ sol_ids = sol_obj.search(cr, uid, [
869+ ('procurement_id', 'in', ids),
870+ ], context=context)
871+ sol_flds = ['line_number', 'order_id', 'po_cft']
872+ for sol in sol_obj.read(cr, uid, sol_ids, sol_flds, context=context):
873+ msg = _("The line #%s of %s has been sourced to the %sPO %s") % (
874+ sol['line_number'], sol['order_id'][1],
875+ sol['po_cft'] == 'dpo' and 'D' or '', po_name,
876+ )
877+ self.infolog(cr, uid, msg)
878 # do not display a log if we come from po update backward update of so
879 data = self.read(cr, uid, ids, ['so_back_update_dest_po_id_procurement_order'], context=context)
880 if not data[0]['so_back_update_dest_po_id_procurement_order']:
881- po_obj.log(cr, uid, result, "The Purchase Order '%s' has been created following 'on order' sourcing."%po_obj.browse(cr, uid, result, context=context).name)
882+ po_obj.log(cr, uid, result, "The Purchase Order '%s' has been created following 'on order' sourcing."%po_name)
883 return result
884
885 def po_values_hook(self, cr, uid, ids, context=None, *args, **kwargs):
886@@ -1633,9 +1686,11 @@
887 if isinstance(ids, (int, long)):
888 ids = [ids]
889 self.hook_rfq_sent_check_lines(cr, uid, ids, context=context)
890+ messages = []
891 for rfq in self.browse(cr, uid, ids, context=context):
892 wf_service = netsvc.LocalService("workflow")
893 wf_service.trg_validate(uid, 'purchase.order', rfq.id, 'rfq_sent', cr)
894+ messages.append(_('The RfQ \'%s\' has been sent') % rfq.name)
895
896 self.write(cr, uid, ids, {'date_confirm': time.strftime('%Y-%m-%d')}, context=context)
897
898@@ -1644,6 +1699,9 @@
899 # UFTP-92: give a name to report when generated from RfQ worklow sent_rfq stage
900 datas['target_filename'] = 'RFQ_' + rfq.name
901
902+ for msg in messages:
903+ self.infolog(cr, uid, msg)
904+
905 return {'type': 'ir.actions.report.xml',
906 'report_name': 'msf.purchase.quotation',
907 'datas': datas}
908@@ -1655,6 +1713,7 @@
909 if isinstance(ids, (int, long)):
910 ids = [ids]
911
912+ messages = []
913 wf_service = netsvc.LocalService("workflow")
914 for rfq in self.browse(cr, uid, ids, context=context):
915 if not rfq.valid_till:
916@@ -1673,6 +1732,11 @@
917 'tender_id': rfq.tender_id.id,
918 'created_by_rfq': True}
919 tl_id = tl_obj.create(cr, uid, tl_vals, context=context)
920+ msg = _('A new tender line has been created from the line #%s of the RfQ \'%s\'.') % (
921+ line.line_number,
922+ rfq.name
923+ )
924+ messages.append(msg)
925 line_obj.write(cr, uid, [line.id], {'tender_line_id': tl_id}, context=context)
926 elif rfq.rfq_ok:
927 line_ids = line_obj.search(cr, uid, [
928@@ -1687,6 +1751,10 @@
929 )
930
931 wf_service.trg_validate(uid, 'purchase.order', rfq.id, 'rfq_updated', cr)
932+ messages.append(_('The RfQ \'%s\' has been updated') % (rfq.name))
933+
934+ for msg in messages:
935+ self.infolog(cr, uid, msg)
936
937 return {
938 'type': 'ir.actions.act_window',
939@@ -1936,6 +2004,16 @@
940 if so_obj._get_ready_to_cancel(cr, uid, so_id, context=context)[so_id]:
941 so_to_cancel_ids.append(so_id)
942
943+ for line in line_obj.browse(cr, uid, line_ids, context=context):
944+ rsrc = ''
945+ if line.has_to_be_resourced:
946+ rsrc = _(' The needs sourced by this line have been resourced.')
947+ self.infolog(cr, uid, _('The line with the product \'%s\' of the tender \'%s\' has been canceled.%s') % (
948+ line.product_id.default_code,
949+ line.tender_id.name,
950+ rsrc
951+ ))
952+
953 if so_to_cancel_ids:
954 # Ask user to choose what must be done on the FO/IR
955 context.update({

Subscribers

People subscribed via source and target branches