Hello,
I try to add this feature:
class account_invoice(osv.osv):
_inherit = 'account.invoice'
# Pour chaque iid dans Invoice_IDS
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='char', string='Poids Total')
}
account_invoice()
but it returns me this erreure:
AttributeError: 'float' object has no attribute 'get'
Someone has an idea?
THX
what do you want to do exactly ?