please help me..what’s wrong
def _amount_all(self, cr, uid, ids, name, args, context=None):
res = {}
for invoice in self.browse(cr, uid, ids, context=context):
res[invoice.id] = {
'amount_untaxed': 0.0,
'amount_tax': 0.0,
'amount_total': 0.0
}
for line in invoice.invoice_line:
res[invoice.id]['amount_untaxed'] += line.price_subtotal
for line in invoice.tax_line:
res[invoice.id]['amount_tax'] += line.amount
res[invoice.id]['amount_total'] = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed']
cr.execute('select payment from sale_order where name = %s',(invoice.origin,))
ads = cr.fetchone()
pay = ads and ads[0] or None
if pay == 'deposit':
if invoice.partner_id.avail < 0:
raise osv.except_osv(_('Invalid action !'), _('Deposit must be recharged')
if invoice.amount_total != res[invoice.id]['amount_total']:
temp = invoice.partner_id.depot - res[invoice.id]['amount_total']
cr.execute('update res_partner set depot=%s where id = %s', (temp, invoice.partner_id.id,))
return res
I checked the condition that if he paid using a deposit and is available if less than zero if not then deposit reduction is done. I think..this is correct..but when I running, appear like this
if invoice.amount_total != res[invoice.id][‘amount_total’]:
SyntaxError: invalid syntax
Why have you given 2tabs(8 spaces) after the line
raise osv.except_osv()Your code should be like