Hello friend, i need to display a single message on return the quotation calculation, i change the method as i saw hints here in the forum and overall internet but it's not working. Bellow follow the method and the error message that i am facing.
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res = {}
if context is None:
context = {}
for line in self.browse(cr, uid, ids, context=context):
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return {'value':res, 'warning':{_("Message"),_("Amount Calculation without erros!")}}
O erro que está surgindo:
2014-04-27 02:37:33,611 17796 ERROR ? openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
File "/opt/projetos/openerp/master/server/openerp/osv/osv.py", line 129, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/projetos/openerp/master/server/openerp/osv/osv.py", line 195, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/projetos/openerp/master/server/openerp/osv/osv.py", line 183, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/projetos/openerp/master/server/openerp/osv/orm.py", line 3424, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/opt/projetos/openerp/master/server/openerp/osv/orm.py", line 3550, in _read_flat
record[f] = res2[record['id']]
KeyError: 113
Please any help will be welcome.