Merge lp:~dorian-kemps/unifield-server/US-7204 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5638
Proposed branch: lp:~dorian-kemps/unifield-server/US-7204
Merge into: lp:unifield-server
Diff against target: 54 lines (+27/-3)
1 file modified
bin/addons/stock/report/stock_reception_report.py (+27/-3)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-7204
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+379569@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/stock/report/stock_reception_report.py'
2--- bin/addons/stock/report/stock_reception_report.py 2020-02-03 10:43:58 +0000
3+++ bin/addons/stock/report/stock_reception_report.py 2020-02-20 15:04:51 +0000
4@@ -39,6 +39,31 @@
5 func_price_unit = round(curr_obj.compute(self.cr, self.uid, po.pricelist_id.currency_id.id,
6 move.company_id.currency_id.id, move.price_unit,
7 round=False, context=self.localcontext), 2)
8+
9+ # Get the linked INT's move destination location
10+ int_move_dest_loc = False
11+ int_domain = [('type', '=', 'internal'), ('line_number', '=', move.line_number),
12+ ('picking_id.previous_chained_pick_id', '=', pick.id)]
13+ linked_int_move_ids = move_obj.search(self.cr, self.uid, int_domain, context=self.localcontext)
14+ if linked_int_move_ids:
15+ int_move_dest_loc = move_obj.browse(self.cr, self.uid, linked_int_move_ids[0],
16+ fields_to_fetch=['location_dest_id'],
17+ context=self.localcontext).location_dest_id.name
18+ if sol:
19+ if sol.procurement_request:
20+ if int_move_dest_loc and sol.order_id.location_requestor_id.usage == 'internal':
21+ final_dest_loc = int_move_dest_loc
22+ else:
23+ final_dest_loc = sol.order_id.location_requestor_id.name
24+ else:
25+ final_dest_loc = sol.order_id.partner_id.name
26+ elif int_move_dest_loc:
27+ final_dest_loc = int_move_dest_loc
28+ elif move.location_dest_id:
29+ final_dest_loc = move.location_dest_id.name
30+ else:
31+ final_dest_loc = ''
32+
33 res.append({
34 'ref': pick.name,
35 'reason_type': move.reason_type_id and move.reason_type_id.name or '',
36@@ -46,7 +71,7 @@
37 'supplier': pick.partner_id and pick.partner_id.name or '',
38 'purchase_id': po, # For category, type and priority
39 'dr_date': pol.date_planned or po.delivery_requested_date,
40- 'dc_date': pol.confirmed_delivery_date or po.confirmed_delivery_date,
41+ 'dc_date': pol.confirmed_delivery_date or po.delivery_confirmed_date,
42 'origin': move.origin,
43 'backorder': pick.backorder_id and pick.backorder_id.name or '',
44 'line': move.line_number,
45@@ -60,8 +85,7 @@
46 'total_cost': move.product_qty * move.price_unit,
47 'total_cost_func': move.product_qty * func_price_unit,
48 'dest_loc': move.location_dest_id and move.location_dest_id.name or '',
49- 'final_dest_loc': sol and (sol.order_id.procurement_request and sol.order_id.location_requestor_id.name or sol.order_id.partner_id.name)
50- or move.location_dest_id and move.location_dest_id.name or '',
51+ 'final_dest_loc': final_dest_loc,
52 'exp_receipt_date': move.date_expected,
53 'actual_receipt_date': move.date,
54 'phys_recep_date': pick.physical_reception_date,

Subscribers

People subscribed via source and target branches