2010-03-17 07:56:05 +00:00
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
2014-05-07 16:59:51 +00:00
import time
2012-12-06 14:56:32 +00:00
from openerp . osv import fields
from openerp . osv import osv
2013-10-22 06:54:46 +00:00
from openerp . tools . translate import _
2014-02-07 11:26:06 +00:00
from openerp import SUPERUSER_ID
2014-09-29 15:48:38 +00:00
from openerp . tools import DEFAULT_SERVER_DATETIME_FORMAT , float_compare
2010-03-17 07:56:05 +00:00
class StockMove ( osv . osv ) :
_inherit = ' stock.move '
2014-01-29 13:10:46 +00:00
2010-03-17 07:56:05 +00:00
_columns = {
2014-07-06 14:44:26 +00:00
' production_id ' : fields . many2one ( ' mrp.production ' , ' Production Order for Produced Products ' , select = True , copy = False ) ,
2013-09-25 08:37:49 +00:00
' raw_material_production_id ' : fields . many2one ( ' mrp.production ' , ' Production Order for Raw Materials ' , select = True ) ,
2014-02-05 09:34:11 +00:00
' consumed_for ' : fields . many2one ( ' stock.move ' , ' Consumed for ' , help = ' Technical field used to make the traceability of produced products ' ) ,
2010-03-17 07:56:05 +00:00
}
2011-01-12 16:44:40 +00:00
2014-01-07 10:39:15 +00:00
def check_tracking ( self , cr , uid , move , lot_id , context = None ) :
super ( StockMove , self ) . check_tracking ( cr , uid , move , lot_id , context = context )
if move . product_id . track_production and ( move . location_id . usage == ' production ' or move . location_dest_id . usage == ' production ' ) and not lot_id :
raise osv . except_osv ( _ ( ' Warning! ' ) , _ ( ' You must assign a serial number for the product %s ' ) % ( move . product_id . name ) )
2014-01-20 16:28:28 +00:00
if move . raw_material_production_id and move . location_dest_id . usage == ' production ' and move . raw_material_production_id . product_id . track_production and not move . consumed_for :
2014-02-05 09:34:11 +00:00
raise osv . except_osv ( _ ( ' Warning! ' ) , _ ( " Because the product %s requires it, you must assign a serial number to your raw material %s to proceed further in your production. Please use the ' Produce ' button to do so. " ) % ( move . raw_material_production_id . product_id . name , move . product_id . name ) )
2014-02-10 14:54:46 +00:00
def _check_phantom_bom ( self , cr , uid , move , context = None ) :
""" check if product associated to move has a phantom bom
return list of ids of mrp . bom for that product """
2014-02-14 08:46:50 +00:00
user_company = self . pool . get ( ' res.users ' ) . browse ( cr , uid , uid , context = context ) . company_id . id
2014-02-14 13:44:57 +00:00
#doing the search as SUPERUSER because a user with the permission to write on a stock move should be able to explode it
#without giving him the right to read the boms.
2014-05-27 07:42:52 +00:00
domain = [
' | ' , ( ' product_id ' , ' = ' , move . product_id . id ) ,
' & ' , ( ' product_id ' , ' = ' , False ) , ( ' product_tmpl_id.product_variant_ids ' , ' = ' , move . product_id . id ) ,
2014-02-14 08:46:50 +00:00
( ' type ' , ' = ' , ' phantom ' ) ,
2014-02-14 13:44:57 +00:00
' | ' , ( ' date_start ' , ' = ' , False ) , ( ' date_start ' , ' <= ' , time . strftime ( DEFAULT_SERVER_DATETIME_FORMAT ) ) ,
' | ' , ( ' date_stop ' , ' = ' , False ) , ( ' date_stop ' , ' >= ' , time . strftime ( DEFAULT_SERVER_DATETIME_FORMAT ) ) ,
2014-05-27 07:42:52 +00:00
( ' company_id ' , ' = ' , user_company ) ]
return self . pool . get ( ' mrp.bom ' ) . search ( cr , SUPERUSER_ID , domain , context = context )
2014-02-10 14:54:46 +00:00
2010-11-19 13:48:01 +00:00
def _action_explode ( self , cr , uid , move , context = None ) :
2010-04-05 12:28:03 +00:00
""" Explodes pickings.
@param move : Stock moves
@return : True
"""
2010-04-06 08:57:06 +00:00
bom_obj = self . pool . get ( ' mrp.bom ' )
move_obj = self . pool . get ( ' stock.move ' )
2014-08-08 15:22:14 +00:00
prod_obj = self . pool . get ( " product.product " )
proc_obj = self . pool . get ( " procurement.order " )
2014-09-11 14:02:44 +00:00
uom_obj = self . pool . get ( " product.uom " )
2014-02-14 08:46:50 +00:00
to_explode_again_ids = [ ]
2014-02-07 11:26:06 +00:00
processed_ids = [ ]
2014-02-14 08:46:50 +00:00
bis = self . _check_phantom_bom ( cr , uid , move , context = context )
2013-09-09 11:55:15 +00:00
if bis :
2014-02-10 16:03:46 +00:00
bom_point = bom_obj . browse ( cr , SUPERUSER_ID , bis [ 0 ] , context = context )
2014-09-11 14:02:44 +00:00
factor = uom_obj . _compute_qty ( cr , SUPERUSER_ID , move . product_uom . id , move . product_uom_qty , bom_point . product_uom . id ) / bom_point . product_qty
2014-09-09 17:06:26 +00:00
res = bom_obj . _bom_explode ( cr , SUPERUSER_ID , bom_point , move . product_id , factor , [ ] , context = context )
2014-08-08 15:22:14 +00:00
2014-02-05 09:34:11 +00:00
for line in res [ 0 ] :
2014-08-08 15:22:14 +00:00
product = prod_obj . browse ( cr , uid , line [ ' product_id ' ] , context = context )
if product . type != ' service ' :
valdef = {
' picking_id ' : move . picking_id . id if move . picking_id else False ,
' product_id ' : line [ ' product_id ' ] ,
' product_uom ' : line [ ' product_uom ' ] ,
' product_uom_qty ' : line [ ' product_qty ' ] ,
' product_uos ' : line [ ' product_uos ' ] ,
' product_uos_qty ' : line [ ' product_uos_qty ' ] ,
[FIX] mrp: perform location chaining for kit exploded moves
This rev. 7307227 ensured to not (re-)set the state 'confirmed' to exploded moves with a more advanced state (for instance, 'assigned')
Nevertheless, the location chaining is performed on the move confirmation, through the action_confirm method of the stock.move model. Besides, the resulting moves of the _action_explode method had the state 'confirmed' on creation, the 'confirmed' state wasn't set by the method 'action_confirm', meaning that the moves were confirmed without having the location chaining done. Allowing moves to go through the action_confirm method even if the state was 'confirmed' or further triggered the location chaining.
Preventing already confirmed moves to go through the action_confirm method prevented the location chaining, thus.
We now create the resulting moves with the 'draft' state, and then confirm them through the procurement workflow signal 'button_confirm'. Thus, the resulting moves are confirmed by going through the action_confirm method, writing the confirmed state and triggering the location chaining at the same time. We then write the 'assigned' state if necessary.
opw-617235
2014-11-19 12:24:32 +00:00
' state ' : ' draft ' , #will be confirmed below
2014-08-08 15:22:14 +00:00
' name ' : line [ ' name ' ] ,
' procurement_id ' : move . procurement_id . id ,
2014-09-11 14:02:44 +00:00
' split_from ' : move . id , #Needed in order to keep sale connection, but will be removed by unlink
2014-08-08 15:22:14 +00:00
}
2014-08-14 14:12:59 +00:00
mid = move_obj . copy ( cr , uid , move . id , default = valdef , context = context )
2014-08-08 15:22:14 +00:00
to_explode_again_ids . append ( mid )
else :
if prod_obj . need_procurement ( cr , uid , [ product . id ] , context = context ) :
2014-08-14 14:12:59 +00:00
valdef = {
2014-08-08 15:22:14 +00:00
' name ' : move . rule_id and move . rule_id . name or " / " ,
' origin ' : move . origin ,
' company_id ' : move . company_id and move . company_id . id or False ,
' date_planned ' : move . date ,
' product_id ' : line [ ' product_id ' ] ,
' product_qty ' : line [ ' product_qty ' ] ,
' product_uom ' : line [ ' product_uom ' ] ,
' product_uos_qty ' : line [ ' product_uos_qty ' ] ,
' product_uos ' : line [ ' product_uos ' ] ,
' group_id ' : move . group_id . id ,
' priority ' : move . priority ,
2014-08-11 13:06:03 +00:00
' partner_dest_id ' : move . partner_id . id ,
2014-08-08 15:22:14 +00:00
}
2014-08-14 14:12:59 +00:00
if move . procurement_id :
proc = proc_obj . copy ( cr , uid , move . procurement_id . id , default = valdef , context = context )
else :
proc = proc_obj . create ( cr , uid , valdef , context = context )
2014-08-20 08:03:23 +00:00
proc_obj . run ( cr , uid , [ proc ] , context = context ) #could be omitted
2013-09-25 12:50:39 +00:00
2014-08-14 14:12:59 +00:00
2014-02-10 14:54:46 +00:00
#check if new moves needs to be exploded
2014-02-14 08:46:50 +00:00
if to_explode_again_ids :
for new_move in self . browse ( cr , uid , to_explode_again_ids , context = context ) :
processed_ids . extend ( self . _action_explode ( cr , uid , new_move , context = context ) )
2014-08-14 14:12:59 +00:00
2014-08-14 22:42:28 +00:00
if not move . split_from and move . procurement_id :
# Check if procurements have been made to wait for
moves = move . procurement_id . move_ids
if len ( moves ) == 1 :
proc_obj . write ( cr , uid , [ move . procurement_id . id ] , { ' state ' : ' done ' } , context = context )
2014-11-20 10:37:23 +00:00
if processed_ids and move . state == ' assigned ' :
# Set the state of resulting moves according to 'assigned' as the original move is assigned
move_obj . write ( cr , uid , list ( set ( processed_ids ) - set ( [ move . id ] ) ) , { ' state ' : ' assigned ' } , context = context )
2014-08-14 22:42:28 +00:00
2014-08-14 14:12:59 +00:00
#delete the move with original product which is not relevant anymore
move_obj . unlink ( cr , SUPERUSER_ID , [ move . id ] , context = context )
2014-08-19 10:26:05 +00:00
#return list of newly created move or the move id otherwise, unless there is no move anymore
return processed_ids or ( not bis and [ move . id ] ) or [ ]
2013-09-25 12:50:39 +00:00
2014-02-07 11:26:06 +00:00
def action_confirm ( self , cr , uid , ids , context = None ) :
2014-02-10 14:54:46 +00:00
move_ids = [ ]
2014-02-07 11:26:06 +00:00
for move in self . browse ( cr , uid , ids , context = context ) :
2014-02-14 08:46:50 +00:00
#in order to explode a move, we must have a picking_type_id on that move because otherwise the move
#won't be assigned to a picking and it would be weird to explode a move into several if they aren't
#all grouped in the same picking.
2014-02-10 14:54:46 +00:00
if move . picking_type_id :
move_ids . extend ( self . _action_explode ( cr , uid , move , context = context ) )
else :
move_ids . append ( move . id )
2014-02-14 08:46:50 +00:00
#we go further with the list of ids potentially changed by action_explode
2014-02-10 14:54:46 +00:00
return super ( StockMove , self ) . action_confirm ( cr , uid , move_ids , context = context )
2013-09-25 12:50:39 +00:00
2014-02-05 09:34:11 +00:00
def action_consume ( self , cr , uid , ids , product_qty , location_id = False , restrict_lot_id = False , restrict_partner_id = False ,
consumed_for = False , context = None ) :
2014-01-17 16:42:32 +00:00
""" Consumed product with specific quantity from specific source location.
2014-09-22 20:17:15 +00:00
@param product_qty : Consumed / produced product quantity ( = in quantity of UoM of product )
2010-04-05 12:28:03 +00:00
@param location_id : Source location
2014-02-05 09:34:11 +00:00
@param restrict_lot_id : optionnal parameter that allows to restrict the choice of quants on this specific lot
@param restrict_partner_id : optionnal parameter that allows to restrict the choice of quants to this specific partner
@param consumed_for : optionnal parameter given to this function to make the link between raw material consumed and produced product , for a better traceability
2014-09-29 09:13:44 +00:00
@return : New lines created if not everything was consumed for this line
2013-09-25 12:50:39 +00:00
"""
2014-02-05 10:43:24 +00:00
if context is None :
context = { }
2010-03-17 07:56:05 +00:00
res = [ ]
production_obj = self . pool . get ( ' mrp.production ' )
2014-02-05 09:34:11 +00:00
2014-01-28 15:18:34 +00:00
if product_qty < = 0 :
raise osv . except_osv ( _ ( ' Warning! ' ) , _ ( ' Please provide proper quantity. ' ) )
2014-02-14 08:46:50 +00:00
#because of the action_confirm that can create extra moves in case of phantom bom, we need to make 2 loops
ids2 = [ ]
2013-09-25 12:50:39 +00:00
for move in self . browse ( cr , uid , ids , context = context ) :
2014-01-28 15:18:34 +00:00
if move . state == ' draft ' :
2014-05-07 16:59:51 +00:00
ids2 . extend ( self . action_confirm ( cr , uid , [ move . id ] , context = context ) )
2014-02-14 08:46:50 +00:00
else :
2014-05-07 16:59:51 +00:00
ids2 . append ( move . id )
2014-02-14 08:46:50 +00:00
2014-09-22 20:17:15 +00:00
prod_orders = set ( )
2014-02-14 08:46:50 +00:00
for move in self . browse ( cr , uid , ids2 , context = context ) :
2014-09-22 20:17:15 +00:00
prod_orders . add ( move . raw_material_production_id . id or move . production_id . id )
2014-01-28 15:18:34 +00:00
move_qty = move . product_qty
if move_qty < = 0 :
raise osv . except_osv ( _ ( ' Error! ' ) , _ ( ' Cannot consume a move with negative or zero quantity. ' ) )
2014-09-22 15:42:59 +00:00
quantity_rest = move_qty - product_qty
2014-09-29 15:48:38 +00:00
# Compare with numbers of move uom as we want to avoid a split with 0 qty
quantity_rest_uom = move . product_uom_qty - self . pool . get ( " product.uom " ) . _compute_qty_obj ( cr , uid , move . product_id . uom_id , product_qty , move . product_uom )
if float_compare ( quantity_rest_uom , 0 , precision_rounding = move . product_uom . rounding ) != 0 :
2014-09-22 20:17:15 +00:00
new_mov = self . split ( cr , uid , move , quantity_rest , context = context )
2014-09-29 09:13:44 +00:00
res . append ( new_mov )
2014-09-22 20:17:15 +00:00
vals = { ' restrict_lot_id ' : restrict_lot_id ,
' restrict_partner_id ' : restrict_partner_id ,
' consumed_for ' : consumed_for }
2014-09-22 07:27:52 +00:00
if location_id :
2014-09-22 20:17:15 +00:00
vals . update ( { ' location_id ' : location_id } )
self . write ( cr , uid , [ move . id ] , vals , context = context )
2014-09-29 09:13:44 +00:00
# Original moves will be the quantities consumed, so they need to be done
self . action_done ( cr , uid , ids2 , context = context )
if res :
self . action_assign ( cr , uid , res , context = context )
2014-09-22 20:17:15 +00:00
if prod_orders :
production_obj . signal_workflow ( cr , uid , list ( prod_orders ) , ' button_produce ' )
2010-03-17 07:56:05 +00:00
return res
2013-09-25 12:50:39 +00:00
2014-01-24 15:49:53 +00:00
def action_scrap ( self , cr , uid , ids , product_qty , location_id , restrict_lot_id = False , restrict_partner_id = False , context = None ) :
2010-04-05 12:28:03 +00:00
""" Move the scrap/damaged product into scrap location
@param product_qty : Scraped product quantity
@param location_id : Scrap location
@return : Scraped lines
2013-09-25 12:50:39 +00:00
"""
2010-03-17 07:56:05 +00:00
res = [ ]
production_obj = self . pool . get ( ' mrp.production ' )
2010-11-19 13:48:01 +00:00
for move in self . browse ( cr , uid , ids , context = context ) :
2014-02-05 09:34:11 +00:00
new_moves = super ( StockMove , self ) . action_scrap ( cr , uid , [ move . id ] , product_qty , location_id ,
restrict_lot_id = restrict_lot_id ,
restrict_partner_id = restrict_partner_id , context = context )
2011-06-03 06:59:38 +00:00
#If we are not scrapping our whole move, tracking and lot references must not be removed
2010-03-17 07:56:05 +00:00
production_ids = production_obj . search ( cr , uid , [ ( ' move_lines ' , ' in ' , [ move . id ] ) ] )
for prod_id in production_ids :
2014-07-07 09:50:30 +00:00
production_obj . signal_workflow ( cr , uid , [ prod_id ] , ' button_produce ' )
2010-03-17 07:56:05 +00:00
for new_move in new_moves :
production_obj . write ( cr , uid , production_ids , { ' move_lines ' : [ ( 4 , new_move ) ] } )
res . append ( new_move )
2011-05-24 12:19:58 +00:00
return res
2010-03-17 07:56:05 +00:00
2013-09-18 13:56:12 +00:00
def write ( self , cr , uid , ids , vals , context = None ) :
if isinstance ( ids , ( int , long ) ) :
ids = [ ids ]
res = super ( StockMove , self ) . write ( cr , uid , ids , vals , context = context )
from openerp import workflow
2014-08-26 10:10:05 +00:00
if vals . get ( ' state ' ) == ' assigned ' :
moves = self . browse ( cr , uid , ids , context = context )
orders = list ( set ( [ x . raw_material_production_id . id for x in moves if x . raw_material_production_id and x . raw_material_production_id . state == ' confirmed ' ] ) )
for order_id in orders :
if self . pool . get ( ' mrp.production ' ) . test_ready ( cr , uid , [ order_id ] ) :
workflow . trg_validate ( uid , ' mrp.production ' , order_id , ' moves_ready ' , cr )
2013-09-18 13:56:12 +00:00
return res
2010-03-17 07:56:05 +00:00
2013-10-22 06:54:46 +00:00
class stock_warehouse ( osv . osv ) :
_inherit = ' stock.warehouse '
2013-10-23 13:40:21 +00:00
_columns = {
2014-04-22 12:33:26 +00:00
' manufacture_to_resupply ' : fields . boolean ( ' Manufacture in this Warehouse ' ,
help = " When products are manufactured, they can be manufactured in this warehouse. " ) ,
2013-10-23 13:40:21 +00:00
' manufacture_pull_id ' : fields . many2one ( ' procurement.rule ' , ' Manufacture Rule ' ) ,
2013-10-22 06:54:46 +00:00
}
2013-10-23 13:40:21 +00:00
2014-12-02 17:15:43 +00:00
_defaults = {
' manufacture_to_resupply ' : True ,
}
2013-10-23 13:40:21 +00:00
def _get_manufacture_pull_rule ( self , cr , uid , warehouse , context = None ) :
route_obj = self . pool . get ( ' stock.location.route ' )
2013-10-22 06:54:46 +00:00
data_obj = self . pool . get ( ' ir.model.data ' )
try :
manufacture_route_id = data_obj . get_object_reference ( cr , uid , ' stock ' , ' route_warehouse0_manufacture ' ) [ 1 ]
except :
manufacture_route_id = route_obj . search ( cr , uid , [ ( ' name ' , ' like ' , _ ( ' Manufacture ' ) ) ] , context = context )
manufacture_route_id = manufacture_route_id and manufacture_route_id [ 0 ] or False
if not manufacture_route_id :
2013-10-23 13:40:21 +00:00
raise osv . except_osv ( _ ( ' Error! ' ) , _ ( ' Can \' t find any generic Manufacture route. ' ) )
2013-10-22 06:54:46 +00:00
return {
2013-10-23 13:40:21 +00:00
' name ' : self . _format_routename ( cr , uid , warehouse , _ ( ' Manufacture ' ) , context = context ) ,
2013-10-23 09:12:26 +00:00
' location_id ' : warehouse . lot_stock_id . id ,
2013-10-22 06:54:46 +00:00
' route_id ' : manufacture_route_id ,
2013-10-23 09:12:26 +00:00
' action ' : ' manufacture ' ,
2013-10-23 13:40:21 +00:00
' picking_type_id ' : warehouse . int_type_id . id ,
2014-04-23 14:17:00 +00:00
' propagate ' : False ,
2013-10-23 15:19:12 +00:00
' warehouse_id ' : warehouse . id ,
2013-10-22 06:54:46 +00:00
}
2013-10-23 13:40:21 +00:00
def create_routes ( self , cr , uid , ids , warehouse , context = None ) :
pull_obj = self . pool . get ( ' procurement.rule ' )
2013-10-22 06:54:46 +00:00
res = super ( stock_warehouse , self ) . create_routes ( cr , uid , ids , warehouse , context = context )
2013-10-23 13:40:21 +00:00
if warehouse . manufacture_to_resupply :
manufacture_pull_vals = self . _get_manufacture_pull_rule ( cr , uid , warehouse , context = context )
2013-10-22 06:54:46 +00:00
manufacture_pull_id = pull_obj . create ( cr , uid , manufacture_pull_vals , context = context )
res [ ' manufacture_pull_id ' ] = manufacture_pull_id
return res
2013-10-23 13:40:21 +00:00
2013-10-22 06:54:46 +00:00
def write ( self , cr , uid , ids , vals , context = None ) :
pull_obj = self . pool . get ( ' procurement.rule ' )
if isinstance ( ids , ( int , long ) ) :
ids = [ ids ]
2013-10-23 13:40:21 +00:00
if ' manufacture_to_resupply ' in vals :
if vals . get ( " manufacture_to_resupply " ) :
2013-10-22 06:54:46 +00:00
for warehouse in self . browse ( cr , uid , ids , context = context ) :
if not warehouse . manufacture_pull_id :
manufacture_pull_vals = self . _get_manufacture_pull_rule ( cr , uid , warehouse , context = context )
manufacture_pull_id = pull_obj . create ( cr , uid , manufacture_pull_vals , context = context )
vals [ ' manufacture_pull_id ' ] = manufacture_pull_id
else :
2013-10-23 13:40:21 +00:00
for warehouse in self . browse ( cr , uid , ids , context = context ) :
2013-10-22 06:54:46 +00:00
if warehouse . manufacture_pull_id :
2013-10-23 13:40:21 +00:00
pull_obj . unlink ( cr , uid , warehouse . manufacture_pull_id . id , context = context )
return super ( stock_warehouse , self ) . write ( cr , uid , ids , vals , context = None )
2013-10-22 06:54:46 +00:00
def get_all_routes_for_wh ( self , cr , uid , warehouse , context = None ) :
2013-10-23 13:40:21 +00:00
all_routes = super ( stock_warehouse , self ) . get_all_routes_for_wh ( cr , uid , warehouse , context = context )
if warehouse . manufacture_to_resupply and warehouse . manufacture_pull_id and warehouse . manufacture_pull_id . route_id :
all_routes + = [ warehouse . manufacture_pull_id . route_id . id ]
2013-10-22 06:54:46 +00:00
return all_routes
2014-02-13 09:48:20 +00:00
def _handle_renaming ( self , cr , uid , warehouse , name , code , context = None ) :
res = super ( stock_warehouse , self ) . _handle_renaming ( cr , uid , warehouse , name , code , context = context )
2013-11-05 15:49:23 +00:00
pull_obj = self . pool . get ( ' procurement.rule ' )
#change the manufacture pull rule name
2014-02-13 09:48:20 +00:00
if warehouse . manufacture_pull_id :
pull_obj . write ( cr , uid , warehouse . manufacture_pull_id . id , { ' name ' : warehouse . manufacture_pull_id . name . replace ( warehouse . name , name , 1 ) } , context = context )
2013-11-05 15:49:23 +00:00
return res
2013-10-22 06:54:46 +00:00
def _get_all_products_to_resupply ( self , cr , uid , warehouse , context = None ) :
2013-10-23 13:40:21 +00:00
res = super ( stock_warehouse , self ) . _get_all_products_to_resupply ( cr , uid , warehouse , context = context )
if warehouse . manufacture_pull_id and warehouse . manufacture_pull_id . route_id :
2013-10-23 09:12:26 +00:00
for product_id in res :
2013-10-23 13:40:21 +00:00
for route in self . pool . get ( ' product.product ' ) . browse ( cr , uid , product_id , context = context ) . route_ids :
if route . id == warehouse . manufacture_pull_id . route_id . id :
res . remove ( product_id )
break
2013-10-22 06:54:46 +00:00
return res