bzr revid: jvo@tinyerp.com-20100517131713-kh7s2n85elr52xjf
This commit is contained in:
Jay (Open ERP) 2010-05-17 18:47:13 +05:30
parent 6137359620
commit 3fa1e69ffd
2 changed files with 8 additions and 9 deletions

View File

@ -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={}):

View File

@ -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