diff --git a/addons/product_extended/product_extended.py b/addons/product_extended/product_extended.py index 29f600360ad..01c87ea5dbe 100644 --- a/addons/product_extended/product_extended.py +++ b/addons/product_extended/product_extended.py @@ -56,7 +56,6 @@ class product_product(osv.osv): if test: testdict.update({prod_id : price}) if test: - print testdict return testdict else: return True @@ -93,7 +92,7 @@ class product_product(osv.osv): ctx = context.copy() ctx.update({'active_id': bom.product_id.id}) wiz_id = wizard_obj.create(cr, uid, {'new_price': price}, context=ctx) - wizard_obj.change_price(cr, uid, [wiz_id], context=context) + wizard_obj.change_price(cr, uid, [wiz_id], context=ctx) return price product_product() diff --git a/addons/stock/product.py b/addons/stock/product.py index 69eb6dccabb..8382b65e7da 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -273,11 +273,22 @@ class product_product(osv.osv): def get_product_available(self, cr, uid, ids, context=None): """ Finds the quantity available of product(s) depending on parameters in the context - for date, location, state (allows e.g. for calculating future stock), what, - production lot + for what, states, locations (company, warehouse, ), date, lot, + states: state of the move + what: in (dest in locations) or out (source in locations) moves + LOCATIONS: + shop: warehouse of the shop + warehouse: stock location of the warehouse + location: name (ilike) or id of the location + force_company: if not warehouse or shop given: will only take from this company + compute_child (True if not specified): will also include child locations of locations above + (when force_company only from that company) + + from_date and to_date: dates from or to for the date of the stock move to include (=scheduled of effective date) + prodlot: lot of the move + @return: Dictionary of values for every product id """ - #TODO complete the docstring with possible keys in context + their effect if context is None: context = {} diff --git a/addons/stock/stock_fifo_lifo.py b/addons/stock/stock_fifo_lifo.py index 40df0f33bd9..a635f391db0 100644 --- a/addons/stock/stock_fifo_lifo.py +++ b/addons/stock/stock_fifo_lifo.py @@ -23,7 +23,6 @@ from openerp import tools from openerp.osv import osv, fields -#TODO: remove this FILE and put everything in existing core modules (purchase, stock, product...) class product_product (osv.osv): _name = "product.product" _inherit = "product.product" @@ -84,15 +83,14 @@ class product_product (osv.osv): return super(product_product, self).write(cr, uid, ids, vals, context=context) def get_stock_matchings_fifolifo(self, cr, uid, ids, qty, fifo, product_uom_id=False, currency_id=False, context=None): - #TODO: document the parameters (what is fifo? what's its type and is it used for?)... - #TODO: check if possible to refactore and to split this big method into several smaller + # TODO: currency conversions could be omitted ''' This method returns a list of tuples with quantities from stock in moves - These are the quantities that would go out theoretically according to the fifo or lifo method if qty needs to go out - (move_in_id, qty in uom of move out, price (converted to move out), qty in uom of move in + These are the quantities from the in moves that would go out theoretically according to the fifo or lifo method + (move_in_id, qty in uom of move out, price (converted to move out), qty in uom of move in) This should be called for only one product at a time UoMs and currencies from the corresponding moves are converted towards that given in the params - It is good to use force_company in the context + force_company should be used in the context ''' assert len(ids) == 1, 'Only the fifolifo stock matchings of one product can be calculated at a time.' if context is None: @@ -146,10 +144,8 @@ class stock_move(osv.osv): _inherit = 'stock.move' def _get_moves_from_matchings(self, cr, uid, ids, context=None): - #TOCHECK: self == match_obj ? - match_obj = self.pool.get("stock.move.matching") res = set() - for match in match_obj.browse(cr, uid, ids, context=context): + for match in self.browse(cr, uid, ids, context=context): res.add(match.move_out_id.id) res.add(match.move_in_id.id) return list(res) diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index a9bc4e65457..202a921a2bc 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -213,8 +213,6 @@ class stock_partial_picking(osv.osv_memory): 'prodlot_id': wizard_line.prodlot_id.id, } if (picking_type == 'in') and (wizard_line.product_id.cost_method != 'standard'): - #TODO Maybe better ways to get company or main currency - #TODO Should not this currency be calculated at the date of the purchase order? (not the case now?) partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,) stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context) return {'type': 'ir.actions.act_window_close'}