~mikel-martin/openobject-addons/extra-5.0_esale_osc_enhancement

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- encoding: utf-8 -*-
#########################################################################
#This module intergrates Open ERP with the magento core                 #
#Core settings are stored here                                          #
#########################################################################
#                                                                       #
# Copyright (C) 2009  Raphaƫl Valyi                                     #
#                                                                       #
#This program is free software: you can redistribute it and/or modify   #
#it under the terms of the GNU 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 General Public License for more details.                           #
#                                                                       #
#You should have received a copy of the GNU General Public License      #
#along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#########################################################################

from osv import fields,osv

class stock_picking(osv.osv):
    _inherit = "stock.picking"
    
    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
        if view_type == 'form' and context.get('view', False) == 'rma':
            view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','stock.picking.rma.form')])[0]
        return  super(stock_picking, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)

stock_picking()


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

    def _default_product_id(self, cr, uid, context={}):
        return context.get('product_id', False)
    
    def _default_prodlot_id(self, cr, uid, context={}):
        return context.get('prodlot_id', False)
    
    def _default_location_id(self, cr, uid, context={}):
        return context.get('location_id', False) or super(stock_move, self)._default_location_source(cr, uid, context)
    
    def _default_location_dest_id(self, cr, uid, context={}):
        return context.get('location_dest_id', False) or super(stock_move, self)._default_location_destination(cr, uid, context)
    
    def _default_name(self, cr, uid, context={}):
        return "RMA_move"
    
    _defaults = {
        'product_id': _default_product_id,
        'prodlot_id': _default_prodlot_id,
        'location_id': _default_location_id,
        'location_dest_id': _default_location_dest_id,
        'name': _default_name,
    }

stock_move()