Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
11789 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Tác giả

Sorry and error :

ProgrammingError: column res_users.consultation_place does not exist

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
3411
1
thg 10 17
15795
2
thg 10 17
7053
1
thg 5 16
5679
4
thg 2 25
2437