Hello,
Please, help me!
Where is my error???
def _amount_weight(self, cr, uid, ids, name, args, context=None):
invoice_ids = self.pool.get('account.invoice').search(cr, uid, [])
total_weight = 0
for iid in invoice_ids:
line_ids = self.pool.get('account.invoice.line').search(cr, uid, [('id', '=', iid)], offset=0, limit=None, order=None, context=None, count=False)
for lid in line_ids:
i_line = self.pool.get('account.invoice.line').browse(cr, uid, iid, context=context)
i_weight = i_line.weight
total_weight = total_weight + i_weight
return total_weight
_columns = {
'weight_tot_test': fields.function(_amount_weight, type='float', string='Poids Total'),
}
Error Message
File "/opt/openerp/openerp/addons/invoice/invoice.py", line 22 return total_weight SyntaxError: 'return' outside function