<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#    Copyright (C) 2010-2010 Camptocamp Austria (<http://www.camptocamp.at>)
#
#    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/>.
#
##############################################################################

import pooler
from osv import fields, osv
import netsvc
import sys

class stock_move(osv.osv):
    _inherit= "stock.move"

    def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
                            loc_dest_id=False, address_id=False):
        res = super(stock_move,self).onchange_product_id( cr, uid, ids, prod_id, loc_id,
                            loc_dest_id, address_id)
        if prod_id :
            product_obj = self.pool.get('product.product').browse(cr, uid, prod_id, context=False)
            loc_id = product_obj.property_stock_location.id or  product_obj.categ_id.property_stock_location.id or ''
            print >> sys.stderr,'on change productid ', res
            print >> sys.stderr,'on change productid loc ',loc_id 
            res['value'].update({'location_id' : loc_id})
            print >> sys.stderr,'on change productid ', res
            
        return res
stock_move()<commit_msg>[FIX] for incoming shippments default location is used as destination location<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#    Copyright (C) 2010-2010 Camptocamp Austria (<http://www.camptocamp.at>)
#
#    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/>.
#
##############################################################################

import pooler
from osv import fields, osv
import netsvc
import sys

class stock_move(osv.osv):
    _inherit= "stock.move"

    def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
                            loc_dest_id=False, address_id=False):
        res = super(stock_move,self).onchange_product_id( cr, uid, ids, prod_id, loc_id,
                            loc_dest_id, address_id)
        if prod_id :
            product_obj = self.pool.get('product.product').browse(cr, uid, prod_id, context=False)
            product_loc_id = product_obj.property_stock_location.id or  product_obj.categ_id.property_stock_location.id or ''
            if loc_id:
               loc = self.pool.get('stock.location').browse(cr, uid, loc_id, context=False)
               if loc.usage == 'supplier':
                   res['value']['location_dest_id'] = product_loc_id
            else:
                   res['value']['location_id'] = product_loc_id
            #print >> sys.stderr,'on change productid ', res
            #print >> sys.stderr,'on change productid loc ',loc_id 
            #print >> sys.stderr,'on change productid ', res
            
        return res
stock_move()
{'fraction_non_alphanumeric': 0.1586064634425854, 'fraction_numerical': 0.00825120330048132, 'mean_word_length': 3.0595348837209304, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1662958', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1165, 'n_words': 398}