Skip to Content
Menu
This question has been flagged
2 Replies
10504 Views

Hello, I encounter the following problem, when I try to extend the model 'res_users', this one does not take the extra fields,

Model:

class res_users(models.Model):

    _inherit = 'res.users' consultation_place = fields.Many2one('oocular.place', string=_('Consultations Place'))

    def __init__(self, pool, cr):

        init_res = super(res_users, self).__init__(pool, cr) self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) self.SELF_WRITEABLE_FIELDS.extend(['consultation_place']) return init_res


XML:

<?xml version="1.0" encoding="utf-8"?>

<openerp>

    <data>
        <record id="add_to_user_preferences" model="ir.ui.view">
            <field name="name">Inhetitance In Preference</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_form_simple_modif"/>
            <field name="arch" type="xml">
                <xpath expr="//page/group/field[@name='preferences']" position="after"> <field name="consultation_place" readonly="0"/> </xpath>
            </field>
        </record>
    </data>
</openerp>

I do not understand from where my mistake can you orient me towards the solution?

Avatar
Discard
Author

Sorry and error :

ProgrammingError: column res_users.consultation_place does not exist

LINE 1: ... as "create_uid","res_users"."active" as "active","res_users...

Best Answer

You could remove all the code for the __init__ method because is no needed. After that just start/restart the server to install/update your module so the field is installed properly in the model

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
1866
1
Oct 17
14375
2
Oct 17
5656
1
May 16
4264
1
Aug 24
421