diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 7e1f7f35cdb..140442aa02e 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -167,15 +167,14 @@ class account_voucher(osv.osv): return {'value':{'account_id':account_id.id}} def open_voucher(self, cr, uid, ids, context={}): - obj=self.pool.get('account.voucher').browse(cr,uid,ids) - total=0 + obj = self.pool.get('account.voucher').browse(cr,uid,ids) + total = 0 for i in obj[0].payment_ids: - total+=i.amount - if total!=0: - self.write(cr,uid,ids,{'amount':total}) - self.write(cr, uid, ids, {'state':'proforma'}) + total += i.amount + if total != 0: + self.write(cr, uid, ids, {'amount':total, 'state':'proforma'}) else: - raise osv.except_osv('Invalid action !', 'You can not post to Pro-Forma a voucher with Total amount = 0') + raise osv.except_osv('Invalid action !', 'You cannot post to Pro-Forma a voucher with Total amount = 0 !') return True def proforma_voucher(self, cr, uid, ids, context={}): diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index c5c2af729a0..fe238d373be 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -100,7 +100,7 @@ class hr_analytic_timesheet(osv.osv): 'for this product: "%s" (id:%d)') % \ (r.product_id.name, r.product_id.id,)) # Compute based on pricetype - amount_unit=self.on_change_unit_amount(cr, uid, ids, + amount_unit = self.on_change_unit_amount(cr, uid, ids, r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit @@ -136,7 +136,7 @@ class hr_analytic_timesheet(osv.osv): 'for this product: "%s" (id:%d)') % \ (r.product_id.name, r.product_id.id,)) # Compute based on pricetype - amount_unit=self.on_change_unit_amount(cr, uid, ids, + amount_unit = self.on_change_unit_amount(cr, uid, ids, r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit