This question has been flagged
1 Reply
9454 Views

I have this error when i want to install any module on odoo 9

can you help me please

this is the server error:

 File "/odoo/odoo-9.0c-20170217/openerp/fields.py", line 1718, in convert_to_write
    return value.id
AttributeError: 'int' object has no attribute 'id'

this is the part of my code fields.py:


    def convert_to_write(self, value):
        return value.id

    def convert_to_export(self, value, env):
        return value.name_get()[0][1] if value else ''

    def convert_to_display_name(self, value, record=None):
        return ustr(value.display_name)

    def convert_to_onchange(self, value, fnames=None):
        if not value.id:
            return False
        return super(Many2one, self).convert_to_onchange(value, fnames)

Avatar
Discard
Best Answer

Hi,

if you are getting the same error on installing any module, then you have to check whether there is any module which is currently in cancel install state. If so please uninstall it .

Then the above problem is due to for a integer field you are given .id , in above case it may be value.id, not sure . Just print the value in the field and check whether it is a record or not. you will have id only for records not for a integer field.

Thanks

Avatar
Discard