~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to cost_structure/model/cost_structure.py

  • Committer: Moises Lopez
  • Date: 2014-10-09 21:30:17 UTC
  • mfrom: (879.1.7 trunk-addons-vauxoo)
  • Revision ID: moylop260@vauxoo.com-20141009213017-u3jicyg8xery3r8c
[MERGE] upforward 7.0
-Fix unused import
-Fix relative import
-Fix full path import
-Fix trailing whitespace pylint error C0303
-Fix autopep8 ignoring E501 & E128
-Fix reimported
-Fix __openerp__.py files
-Translate update

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
##########################################################################
25
25
 
26
26
from openerp.osv import osv, fields
27
 
import openerp.tools as tools
28
 
from openerp.tools.translate import _
29
27
 
30
 
from tools import config
31
 
import openerp.netsvc as netsvc
32
28
from openerp.addons.decimal_precision import decimal_precision as dp
33
29
 
34
30
 
105
101
    _rec_name = 'description'
106
102
 
107
103
    _defaults = {
108
 
        'company_id': lambda s, cr, uid, c: s.pool.get('res.company').\
109
 
                    _company_default_get(cr, uid, 'cost.structure', context=c),
 
104
        'company_id': lambda s, cr, uid, c: s.pool.get('res.company').
 
105
        _company_default_get(cr, uid, 'cost.structure', context=c),
110
106
    }
111
107
 
112
108
 
113
 
 
114
 
 
115
109
class method_price(osv.Model):
116
110
 
117
111
    def default_get(self, cr, uid, fields, context=None):
178
172
    _rec_name = 'unit_price'
179
173
 
180
174
    _defaults = {
181
 
        'company_id': lambda s, cr, uid, c: s.pool.get('res.company').\
182
 
                    _company_default_get(cr, uid, 'cost.structure', context=c),
 
175
        'company_id': lambda s, cr, uid, c: s.pool.get('res.company').
 
176
        _company_default_get(cr, uid, 'cost.structure', context=c),
183
177
 
184
178
    }
185
179
    _order = 'sequence'
197
191
            cost_brw = cost_obj.browse(
198
192
                cr, uid, cost_structure_id, context=context)
199
193
            margin_reference and cost_brw.cost_ult and\
200
 
            res['value'].update({'unit_price': (
201
 
                ((float(margin_reference)/100) * cost_brw.cost_ult) +\
 
194
                res['value'].update({'unit_price': (
 
195
                    ((float(margin_reference) / 100) * cost_brw.cost_ult) +
202
196
                    cost_brw.cost_ult)})
203
197
            unit_price and cost_brw.cost_ult\
204
 
            and res['value'].update({'margin_reference':
205
 
                    ((unit_price - cost_brw.cost_ult)/cost_brw.cost_ult)*100})
 
198
                and res['value'].update({'margin_reference':
 
199
                    ((unit_price - cost_brw.cost_ult) / cost_brw.cost_ult) * 100})
206
200
        return res
207
 
 
208