跳至內容
選單
此問題已被標幟
3 回覆
7990 瀏覽次數

In Odoo 11 code added below:

class Users(models.Model):

_inherit = "res.users"

branch_id = fields.Many2one('bi.branch.transaction',string = "Current Branch",store=True)

XML code:

<record id="view_users_form_inherit" model="ir.ui.view">

    <field name="name">res.users.form.inherit</field>

    <field name="model">res.users</field>

    <field eval="12" name="priority"/>

    <field name="inherit_id" ref="base.view_users_form"/>

    <field name="arch" type="xml">

            <xpath expr="//form/sheet/notebook/page[@name='access_rights']/group" position="after">

<group string="Branch" style="width:50%">

                        <field name="branch_id"/>

                    </group>             

                </xpath>

    </field>

</record>

After restarting the server its shows INTERNAL SERVER ERROR in the log file below error shows:-

ProgrammingError: column res_users.branch_id does not exist 
頭像
捨棄
最佳答案

Hi,

In this case, when you add fields to res.partner model or res.users model, try to upgrade the corresponding module from the command line as the user interface wont be accessible due to the internal server error.

To upgrade the module from the command line / terminal:

odoo-bin -c odoo.conf -d database_name -u module_name


See an example here:  How To Upgrade Module From Terminal in Odoo


Another trick way you can follow is that, before restarting the service, open the corresponding apps page, open the app to upgrade in apps menu, immediately after restarting the service click the upgrade button.


Thanks

頭像
捨棄
最佳答案

Hi, not sure, but I would try to proceed without the view first (just model) so that Odoo installs the field, and then add the XML view inheritance.

頭像
捨棄
最佳答案

It seems like its a bug in Odoo code. Happened to me in Odoo 12 too. Look at this post for more details:

https://www.odoo.com/es_ES/forum/ayuda-1/question/unable-to-add-column-in-res-users-table-48972

Hope it helps!

頭像
捨棄