Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

UnboundLocalError: local variable 'amount' referenced before assignment

By
Marco
on 8/7/14, 10:04 AM 1,273 views

Hi,

I just installed a version 7 on a fresh Centos 6.3 32 bit using this script http://forum.openerp.com/forum/topic36094.html

All seemes to be ok but when I try to save a quotation I get this error:

OpenERP Server Error

Client Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, **self.params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/controllers/main.py", line 1128, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(*args, **kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info) Server Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/sale_stock/sale_stock.py", line 75, in create order = super(sale_order, self).create(cr, uid, vals, context=context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/sale/sale.py", line 338, in create return super(sale_order, self).create(cr, uid, vals, context=context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/mail/mail_thread.py", line 252, in create thread_id = super(mail_thread, self).create(cr, uid, values, context=context_operation) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 4561, in create self.pool.get(object)._store_set_values(cr, user, ids, fields2, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 4688, in _store_set_values result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/fields.py", line 1145, in get result = self._fnct(obj, cr, uid, ids, name, self._arg, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/sale/sale.py", line 100, in _amount_all val1 += line.price_subtotal File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 502, in __getattr__ return self[name] File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 405, in __getitem__ field_values = self._table.read(self._cr, self._uid, ids, field_names, context=self._context, load="_classic_write") File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 3679, in read result = self._read_flat(cr, user, select, fields, context, load) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/orm.py", line 3800, in _read_flat res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/osv/fields.py", line 1145, in get result = self._fnct(obj, cr, uid, ids, name, self._arg, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/sale/sale.py", line 661, in _amount_line taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.product_id, line.order_id.partner_id) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/account/account.py", line 2123, in compute_all tin = self.compute_inv(cr, uid, tin, price_unit, quantity, product=product, partner=partner, precision=tax_compute_precision) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/account/account.py", line 2251, in compute_inv res = self._unit_compute_inv(cr, uid, taxes, price_unit, product, partner=None) File "/usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons/account/account.py", line 2198, in _unit_compute_inv cur_price_unit -= amount UnboundLocalError: local variable 'amount' referenced before assignment

What I'm doing wrong?

Thank you very much for your support.

Regards,

Marco

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/7/14, 10:04 AM
Seen: 1273 times
Last updated: 3/16/15, 8:10 AM