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

Proposed by jftempo
Status: Merged
Merged at revision: 5185
Proposed branch: lp:~dorian-kemps/unifield-server/US-5362
Merge into: lp:unifield-server
Diff against target: 89 lines (+15/-15)
1 file modified
bin/addons/stock/wizard/reserved_products_wizard.py (+15/-15)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5362
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+359586@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/wizard/reserved_products_wizard.py'
2--- bin/addons/stock/wizard/reserved_products_wizard.py 2018-11-08 13:25:22 +0000
3+++ bin/addons/stock/wizard/reserved_products_wizard.py 2018-11-27 08:12:35 +0000
4@@ -47,45 +47,45 @@
5 lot_obj = self.pool.get('stock.production.lot')
6 pick_obj = self.pool.get('stock.picking')
7 ship_obj = self.pool.get('shipment')
8- partner_obj = self.pool.get('res.partner')
9+ so_line_obj = self.pool.get('sale.order.line')
10
11 wizard = self.browse(cr, uid, ids[0], context=context)
12 loc_id = wizard.location_id and wizard.location_id.id or False
13- loc_name = wizard.location_id and wizard.location_id.name or False
14+ header_loc_name = wizard.location_id and wizard.location_id.name or False
15 prod_id = wizard.product_id and wizard.product_id.id or False
16- prod_name = wizard.product_id and wizard.product_id.name or False
17+ header_prod_name = wizard.product_id and wizard.product_id.default_code or False
18
19 if loc_id and prod_id:
20 cr.execute('''
21- SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, partner_id, origin
22+ SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, sale_line_id
23 FROM stock_move
24 WHERE state = 'assigned' AND product_qty > 0 AND type in ('internal', 'out')
25 AND location_id = %s AND product_id = %s
26- GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, partner_id, origin, product_qty
27+ GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, sale_line_id, product_qty
28 ORDER BY location_id, product_id
29 ''', (loc_id, prod_id))
30 elif loc_id and not prod_id:
31 cr.execute('''
32- SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, partner_id, origin
33+ SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, sale_line_id
34 FROM stock_move
35 WHERE state = 'assigned' AND product_qty > 0 AND type in ('internal', 'out') AND location_id = %s
36- GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, partner_id, origin, product_qty
37+ GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, sale_line_id, product_qty
38 ORDER BY location_id, product_id
39 ''', (loc_id,))
40 elif not loc_id and prod_id:
41 cr.execute('''
42- SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, partner_id, origin
43+ SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, sale_line_id
44 FROM stock_move
45 WHERE state = 'assigned' AND product_qty > 0 AND type in ('internal', 'out') AND product_id = %s
46- GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, partner_id, origin, product_qty
47+ GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, sale_line_id, product_qty
48 ORDER BY location_id, product_id
49 ''', (prod_id,))
50 else:
51 cr.execute('''
52- SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, partner_id, origin
53+ SELECT location_id, product_id, product_uom, product_qty, prodlot_id, picking_id, pick_shipment_id, sale_line_id
54 FROM stock_move
55 WHERE state = 'assigned' AND product_qty > 0 AND type in ('internal', 'out')
56- GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, partner_id, origin, product_qty
57+ GROUP BY location_id, product_id, prodlot_id, picking_id, pick_shipment_id, product_uom, sale_line_id, product_qty
58 ORDER BY location_id, product_id
59 ''')
60
61@@ -103,7 +103,7 @@
62 context=context) or False
63 pick_name = pick_obj.browse(cr, uid, line[5], fields_to_fetch=['name'], context=context).name
64 ship = ship_obj.browse(cr, uid, line[6], fields_to_fetch=['name'], context=context)
65- partner_name = partner_obj.browse(cr, uid, line[7], fields_to_fetch=['name'], context=context).name
66+ sale = so_line_obj.browse(cr, uid, line[7], fields_to_fetch=['order_id'], context=context).order_id
67 docs_name = pick_name or ''
68 if ship:
69 docs_name += pick_name and '/' + ship.name or ship.name
70@@ -117,8 +117,8 @@
71 'exp_date': prodlot and prodlot.life_date or '',
72 'prod_qty': line[3],
73 'documents': docs_name,
74- 'partner_name': partner_name,
75- 'origin': line[8],
76+ 'partner_name': sale and not sale.procurement_request and sale.partner_id and sale.partner_id.name or '',
77+ 'origin': sale and sale.procurement_request and sale.location_requestor_id and sale.location_requestor_id.name or '',
78 'sum_qty': 0.00,
79 })
80 current_tuple = (loc_name, product and product.id or False, prodlot and prodlot.name or False)
81@@ -148,7 +148,7 @@
82 if i == len(lines) - 1:
83 lines_data.insert(index, line_sum)
84
85- return {'loc_name': loc_name, 'prod_name': prod_name, 'lines_data': lines_data}
86+ return {'loc_name': header_loc_name, 'prod_name': header_prod_name, 'lines_data': lines_data}
87
88 def export_reserved_products_report_xls(self, cr, uid, ids, context=None):
89 if context is None:

Subscribers

People subscribed via source and target branches