1
# -*- coding: utf-8 -*-
2
#################################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr>
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (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 General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#################################################################################
22
from osv import fields, osv
23
from tools.translate import _
25
class stock_packaging_move(osv.osv_memory):
27
_name = "stock.packaging.move"
30
'reference': fields.char('Reference', size=128, required=True),
31
'pack_id': fields.many2one('stock.tracking', 'Pack to move', required=True),
35
'pack_id': lambda s,cr,uid,c: c.get('active_id',False),
38
def add_move(self, cr, uid, ids, context=None):
40
barcode_obj = self.pool.get('tr.barcode')
41
tracking_obj = self.pool.get('stock.tracking')
46
parent_id = context.get('active_id',False)
47
for obj in self.browse(cr, uid, ids):
49
barcode_ids = barcode_obj.search(cr, uid, [('code', '=', ref)], limit=1)
50
''' Call for the adding function '''
51
tracking_obj.add_validation(cr, uid, [parent_id], barcode_ids, context=None)
52
return {'type': 'ir.actions.act_window_close'}
54
def remove_move(self, cr, uid, ids, context=None):
56
barcode_obj = self.pool.get('tr.barcode')
57
tracking_obj = self.pool.get('stock.tracking')
58
move_obj = self.pool.get('stock.move')
59
to_validate_obj = self.pool.get('stock.scan.to.validate')
64
parent_id = context.get('active_id',False)
65
for obj in self.browse(cr, uid, ids):
67
barcode_ids = barcode_obj.search(cr, uid, [('code', '=', ref)], limit=1)
68
''' Call for the removal function '''
69
tracking_obj.remove_validation(cr, uid, [parent_id], barcode_ids, context=None)
70
return {'type': 'ir.actions.act_window_close'}
72
stock_packaging_move()
74
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
b'\\ No newline at end of file'