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

Adding a float custom field generates errors

By
Victor Tanvuia
on 1/8/15, 11:04 AM 692 views

I've added a custom field to the Invoice model called x_contract_currency_rate which is a float field. I've added the field into the view and it's working OK on existing invoices.

If I try to add a new invoice it throws me the error below and the invoice form will not load. As far as I can tell it's got something to do with the field's default value, but I have not set a default nor do I see an option to do so.

Thanks.

Odoo Server Error

Traceback (most recent call last): File "/opt/odoo/openerp/http.py", line 518, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/openerp/http.py", line 539, in dispatch result = self._call_function(**self.params) File "/opt/odoo/openerp/http.py", line 295, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/openerp/service/model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/openerp/http.py", line 292, in checked_call return self.endpoint(*a, **kw) File "/opt/odoo/openerp/http.py", line 755, in __call__ return self.method(*args, **kw) File "/opt/odoo/openerp/http.py", line 388, in response_wrap response = f(*args, **kw) File "/opt/odoo/addons/web/controllers/main.py", line 949, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/addons/web/controllers/main.py", line 941, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 332, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 1337, in default_get defaults[name] = field.default(self) File "/opt/odoo/openerp/fields.py", line 379, in <lambda> func(recs), recs, validate=False, File "/opt/odoo/openerp/fields.py", line 375, in <lambda> func = lambda recs: value(recs._model, recs._cr, recs._uid, recs._context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 332, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/fields.py", line 363, in <lambda> lambda recs: self.convert_to_write(value(recs)) File "/opt/odoo/openerp/fields.py", line 1490, in convert_to_write return value.id AttributeError: 'int' object has no attribute 'id'

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: 1/8/15, 11:04 AM
Seen: 692 times
Last updated: 3/16/15, 8:10 AM