1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 TeMPO Consulting, MSF
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
23
from osv import fields
24
from tools.translate import _
26
class purchase_order(osv.osv):
27
_name = 'purchase.order'
28
_inherit = 'purchase.order'
31
'cross_docking_ok': fields.boolean('Cross docking?'),
32
'stock_location_id': fields.many2one('stock.location','Location'),
35
def onchange_cross_docking_ok(self, cr, uid, ids, cross_docking_ok, context=None):
36
""" Finds location id for changed cross_docking_ok.
37
@param cross_docking_ok: Changed value of cross_docking_ok.
38
@return: Dictionary of values.
41
w = self.pool.get('stock.location').search(cr, uid, [('name', '=', 'Cross docking')], context=context)
42
v = {'stock_location_id': w}
43
elif cross_docking_ok == False:
44
v = {'stock_location_id': False}
48
def test_cross_docking_ok(self, cr, uid, ids):
49
""" Tests whether cross docking is True or False.
50
@return: True or False
52
for order in self.browse(cr, uid, ids):
53
return order.cross_docking_ok
55
# def _hook_action_picking_create_stock_picking(self, cr, uid, ids, context=None, *args, **kwargs):
57
# modify data for stock move creation
58
# - location_dest_id is set to Cross docking
62
# move_values = super(purchase_order, self)._hook_action_picking_create_stock_picking(cr, uid, ids, context=context, *args, **kwargs)
63
# w = self.pool.get('stock.location').search(cr, uid, [('name', '=', 'Cross docking')], context=context)
64
# move_values.update({'location_dest_id': w,})
68
# def action_picking_create(self, cr, uid, ids, context=None):
70
# Checks if the the option Cross Docking has been chosen
74
# if isinstance(ids, (int, long)):
77
# for order in self.browse(cr, uid, ids, context=context):
78
# if order.cross_docking_ok:
81
# return super(purchase_order, self).action_picking_create(cr, uid, ids, context=context)
b'\\ No newline at end of file'