~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to mrp_advance/mrp_routing_cost/mrp_routing.py

  • Committer: nhomar at vauxoo
  • Date: 2011-06-11 22:55:27 UTC
  • Revision ID: nhomar@vauxoo.com-20110611225527-v2mlv4fbx38j0gg3
[SHELDON ] commiting ortografy

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
 
#    Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
5
 
#    All Rights Reserved
6
 
# Credits######################################################
7
 
#    Coded by: nhomar@openerp.com.ve,
8
 
#    Planified by: Nhomar Hernandez
9
 
#    Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
10
 
#    Audited by: Humberto Arocha humberto@openerp.com.ve
11
 
#############################################################################
12
 
#    This program is free software: you can redistribute it and/or modify
13
 
#    it under the terms of the GNU General Public License as published by
14
 
#    the Free Software Foundation, either version 3 of the License, or
15
 
#    (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 General Public License for more details.
21
 
#
22
 
#    You should have received a copy of the GNU General Public License
23
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 
##############################################################################
25
 
 
26
 
from openerp.osv import fields, osv
27
 
from openerp.tools.translate import _
28
 
 
29
 
from tools import config
30
 
 
31
 
 
32
 
class mrp_routing_workcenter(osv.Model):
33
 
    _inherit = "mrp.routing.workcenter"
34
 
 
35
 
    def _calcular(self, cr, uid, ids, field_name, arg, context):
36
 
        res = {}
37
 
        for i in self.browse(cr, uid, ids):
38
 
            cost = 0.00
39
 
            cost = i.hour_nbr*i.costo
40
 
            res[i.id] = cost
41
 
        return res
42
 
 
43
 
    _columns = {
44
 
        'costo': fields.float('Costo Unitario', required=True),
45
 
        'costo_total': fields.function(_calcular, method=True, type='float',
46
 
            string='Costo Total', store=False),
47
 
    }
48
 
    _defaults = {
49
 
        'costo': lambda *a: 0.0,
50
 
    }