~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to procurement_location/procurement.py

  • Committer: Gabriela (Vauxoo)
  • Date: 2012-01-03 00:42:58 UTC
  • Revision ID: gabrielaquilarque97@gmail.com-20120103004258-w881e8vj51secs2q

[IMP] Changed name of modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- encoding: utf-8 -*-
2
 
###########################################################################
3
 
#    Module Writen to OpenERP, Open Source Management Solution
4
 
#
5
 
#    Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
6
 
#    All Rights Reserved.
7
 
#    info@vauxoo.com
8
 
############################################################################
9
 
#    Coded by: Luis Torres (luis_t@vauxoo.com)
10
 
############################################################################
11
 
#
12
 
#    This program is free software: you can redistribute it and/or modify
13
 
#    it under the terms of the GNU Affero General Public License as
14
 
#    published by the Free Software Foundation, either version 3 of the
15
 
#    License, or (at your option) any later version.
16
 
#
17
 
#    This program is distributed in the hope that it will be useful,
18
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
#    GNU Affero General Public License for more details.
21
 
#
22
 
#    You should have received a copy of the GNU Affero General Public License
23
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 
#
25
 
##############################################################################
26
 
from openerp.osv import osv, fields
27
 
 
28
 
 
29
 
class procurement_order(osv.Model):
30
 
    _inherit = 'procurement.order'
31
 
 
32
 
    def make_mo(self, cr, uid, ids, context=None):
33
 
        res = super(procurement_order, self).make_mo(
34
 
            cr, uid, ids, context=context)
35
 
        mrp_prod_obj = self.pool.get('mrp.production')
36
 
        cat_prod = self.browse(
37
 
            cr, uid, ids, context=context)[0].product_id.categ_id
38
 
        loc_src = cat_prod.location_src_id and\
39
 
                    cat_prod.location_src_id.id or False
40
 
        loc_dest = cat_prod.location_dest_id and\
41
 
                    cat_prod.location_dest_id.id or False
42
 
        if loc_src:
43
 
            mrp_prod_obj.write(cr, uid, res.values()[
44
 
                               0], {'location_src_id': loc_src})
45
 
        if loc_dest:
46
 
            mrp_prod_obj.write(cr, uid, res.values()[
47
 
                               0], {'location_dest_id': loc_dest})
48
 
        return res