diff options
Diffstat (limited to 'addons/analytic_user_function/analytic_user_function.py')
| -rw-r--r-- | addons/analytic_user_function/analytic_user_function.py | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 3c8972f4df9..0d5e2200265 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -1,27 +1,6 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ -# -# 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 from osv import orm -from tools.translate import _ class analytic_user_funct_grid(osv.osv): @@ -66,7 +45,7 @@ class hr_analytic_timesheet(osv.osv): return False - def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): + def on_change_account_id(self, cr, uid, ids,user_id, account_id, unit_amount=0): #{'value': {'to_invoice': False, 'amount': (-162.0,), 'product_id': 7, 'general_account_id': (5,)}} res = {} if not (account_id): @@ -95,11 +74,11 @@ class hr_analytic_timesheet(osv.osv): if not a: a = r.product_id.categ_id.property_account_expense_categ.id if not a: - raise osv.except_osv(_('Error !'), - _('There is no expense account define ' \ - 'for this product: "%s" (id:%d)') % \ + raise osv.except_osv('Error !', + 'There is no expense account define ' \ + 'for this product: "%s" (id:%d)' % \ (r.product_id.name, r.product_id.id,)) - amount = unit_amount * self.pool.get('product.uom')._compute_price(cr, uid, + amount = unit_amount * r.product_id.uom_id._compute_price(cr, uid, r.product_id.uom_id.id, r.product_id.standard_price, False) res ['value']['amount']= - round(amount, 2) res ['value']['general_account_id']= a @@ -128,9 +107,9 @@ class hr_analytic_timesheet(osv.osv): if not a: a = r.product_id.categ_id.property_account_expense_categ.id if not a: - raise osv.except_osv(_('Error !'), - _('There is no expense account define ' \ - 'for this product: "%s" (id:%d)') % \ + raise osv.except_osv('Error !', + 'There is no expense account define ' \ + 'for this product: "%s" (id:%d)' % \ (r.product_id.name, r.product_id.id,)) amount = unit_amount * r.product_id.uom_id._compute_price(cr, uid, r.product_id.uom_id.id, r.product_id.standard_price, False) @@ -140,3 +119,5 @@ class hr_analytic_timesheet(osv.osv): hr_analytic_timesheet() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + |
