Merge lp:~openerp-dev/openobject-addons/trunk-bug-725908-ksa into lp:openobject-addons

Proposed by Kirti Savalia(OpenERP)
Status: Merged
Approved by: Rucha (Open ERP)
Approved revision: no longer in the source branch.
Merged at revision: 4587
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-725908-ksa
Merge into: lp:openobject-addons
Diff against target: 105 lines (+40/-40)
1 file modified
stock/wizard/stock_fill_inventory.py (+40/-40)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-725908-ksa
Reviewer Review Type Date Requested Status
qdp (OpenERP) Abstain
Kirti Savalia(OpenERP) (community) Needs Resubmitting
OpenERP buildbot (community) Needs Fixing
Rucha (Open ERP) (community) Needs Fixing
Review via email: mp+52519@code.launchpad.net

This proposal supersedes a proposal from 2011-03-04.

Description of the change

set key value in sorting.

To post a comment you must log in.
Revision history for this message
Rucha (Open ERP) (rpa-openerp) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Rucha (Open ERP) (rpa-openerp) wrote :

Not working for all child locations,
Improve code and remove unused code

review: Needs Fixing
Revision history for this message
OpenERP buildbot (openerp-buildbot) wrote :

crm_partner_assign/test/test_crm_partner_assign.yml[warning]: AssertionError in Python code : SMTP not configured !
project_timesheet/test/worktask_entry_to_timesheetline_entry.yml[warning]: Assertion "After hr manager's work task" FAILED test: len(timesheet_ids) > 0 values: ! 0 > 0
~/addons/anonymization/anonymization.py:298[pywarn]: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
~/addons/anonymization/anonymization.py:300[pywarn]: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.

review: Needs Fixing
Revision history for this message
OpenERP buildbot (openerp-buildbot) wrote :

crm_partner_assign/test/test_crm_partner_assign.yml[warning]: AssertionError in Python code : SMTP not configured !
project_timesheet/test/worktask_entry_to_timesheetline_entry.yml[warning]: Assertion "After hr manager's work task" FAILED test: len(timesheet_ids) > 0 values: ! 0 > 0
~/addons/anonymization/anonymization.py:298[pywarn]: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
~/addons/anonymization/anonymization.py:300[pywarn]: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.

review: Needs Fixing
Revision history for this message
Kirti Savalia(OpenERP) (ksa-openerp) wrote :

hello mam,
 changes is done as per your given suggestion.

review: Needs Resubmitting
Revision history for this message
qdp (OpenERP) (qdp) wrote :

need to double-check

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stock/wizard/stock_fill_inventory.py'
--- stock/wizard/stock_fill_inventory.py 2011-01-14 00:11:01 +0000
+++ stock/wizard/stock_fill_inventory.py 2011-03-08 13:38:41 +0000
@@ -58,61 +58,61 @@
58 @return:58 @return:
59 """59 """
60 if context is None:60 if context is None:
61 context = {} 61 context = {}
62 inventory_line_obj = self.pool.get('stock.inventory.line')62 inventory_line_obj = self.pool.get('stock.inventory.line')
63 location_obj = self.pool.get('stock.location')63 location_obj = self.pool.get('stock.location')
64 product_obj = self.pool.get('product.product')64 product_obj = self.pool.get('product.product')
65 stock_location_obj = self.pool.get('stock.location')65 stock_location_obj = self.pool.get('stock.location')
66 if ids and len(ids): 66 move_obj = self.pool.get('stock.move')
67 if ids and len(ids):
67 ids = ids[0]68 ids = ids[0]
68 else:69 else:
69 return {'type': 'ir.actions.act_window_close'} 70 return {'type': 'ir.actions.act_window_close'}
70 fill_inventory = self.browse(cr, uid, ids, context=context)71 fill_inventory = self.browse(cr, uid, ids, context=context)
71 res = {}72 res = {}
72 res_location = {}73 res_location = {}
73 if fill_inventory.recursive :74 if fill_inventory.recursive :
74 location_ids = location_obj.search(cr, uid, [('location_id',75 location_ids = location_obj.search(cr, uid, [('location_id',
75 'child_of', fill_inventory.location_id.id)])76 'child_of', fill_inventory.location_id.id)], order="id")
76 for location in location_ids :
77 res = location_obj._product_get(cr, uid, location)
78 res_location[location] = res
79 else:77 else:
80 context.update({'compute_child': False})78 location_ids = [fill_inventory.location_id.id]
81 res = location_obj._product_get(cr, uid,79
82 fill_inventory.location_id.id, context=context)80 res = {}
83 res_location[fill_inventory.location_id.id] = res81 flag = False
84 82 for location in location_ids:
85 product_ids = []83 datas = {}
86 for location in res_location.keys():84 res[location] = {}
87 res = res_location[location]85 move_ids = move_obj.search(cr, uid, [('location_dest_id','=',location),('state','=','done')], context=context)
88 for product_id in res.keys():86
89 prod = product_obj.browse(cr, uid, product_id, context=context)87 for move in move_obj.browse(cr, uid, move_ids, context=context):
90 uom = prod.uom_id.id88 lot_id = move.prodlot_id.id
91 context.update(uom=uom, compute_child=False)89 prod_id = move.product_id.id
92 amount = stock_location_obj._product_get(cr, uid,90 qty = move.product_qty
93 location, [product_id], context=context)[product_id]91 location_dest_id = move.location_dest_id.id
94 if(amount):92 if datas.get((prod_id, lot_id)):
93 qty = datas[(prod_id, lot_id)]['product_qty'] + qty
94 datas[(prod_id, lot_id)] = {'product_id': prod_id, 'location_id': location_dest_id, 'product_qty': qty, 'product_uom': move.product_id.uom_id.id, 'prod_lot_id': lot_id}
95 if datas:
96 flag = True
97 res[location] = datas
98
99 if not flag:
100 raise osv.except_osv(_('Message !'), _('No product in this location.'))
101
102 for i in res.values():
103 if i.values():
104 for mydata in i.values():
105 mydata.update({'inventory_id': context['active_ids'][0]})
106 domain = []
95 if fill_inventory.set_stock_zero:107 if fill_inventory.set_stock_zero:
96 amount = 0 108 mydata.update({'product_qty': 0})
97 line_ids=inventory_line_obj.search(cr, uid,109 for k, v in mydata.items():
98 [('inventory_id', '=', context['active_ids']),110 domain.append((k, '=', v))
99 ('location_id', '=', location),111 line_ids = inventory_line_obj.search(cr, uid, domain)
100 ('product_id', '=', product_id),112
101 ('product_uom', '=', uom),
102 ('product_qty', '=', amount)])
103 if not len(line_ids):113 if not len(line_ids):
104 inventory_line = {114 inventory_line_obj.create(cr, uid, mydata)
105 'inventory_id': context['active_ids'][0],
106 'location_id': location,
107 'product_id': product_id,
108 'product_uom': uom,
109 'product_qty': amount
110 }
111 inventory_line_obj.create(cr, uid, inventory_line)
112 product_ids.append(product_id)
113115
114 if(len(product_ids) == 0):
115 raise osv.except_osv(_('Message !'), _('No product in this location.'))
116 return {'type': 'ir.actions.act_window_close'}116 return {'type': 'ir.actions.act_window_close'}
117117
118stock_fill_inventory()118stock_fill_inventory()

Subscribers

People subscribed via source and target branches

to all changes: