Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
11772 Представления

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?

Аватар
Отменить
Автор

Sorry and error :

ProgrammingError: column res_users.consultation_place does not exist

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

Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
нояб. 24
3396
1
окт. 17
15763
2
окт. 17
7040
1
мая 16
5648
4
февр. 25
2367