Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

unable to add column in res.users table

By
Prakash
on 4/8/14, 7:56 AM 4,534 views

In OpenERP 7.0-20131109-002558 added the below code:-

class res_users(osv.osv): 
      _inherit = "res.users" 

      _columns = {
            'fieldname_id'  : fields.many2one("master.table",  "Data"),
      }

res_users()

Depends added in __openerp__.py

"depends" :  ["base", "master_module"],

xml Code

<?xml version="1.0"?>
<openerp>
    <data>
    <record model="ir.ui.view" id="view_resuser_field_form">
        <field name="name">resusers_field_form</field>
        <field name="model">res.users</field>
        <field name="inherit_id" ref="base.view_users_form"/>
        <field name="type">form</field>
        <field name="arch" type="xml">
        <xpath expr="//notebook" position="inside">
            <page string="Exta Details">
               <group col="4">
                  <field name="fieldname_id"/>
                </group>
             </page>
        </xpath>
        </field>
    </record>
    </data>
</openerp>

After restarting the server its shows blank white page in the log file below error shows:-

File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\openerp\addons\base\res\res_users.py", line 363, in context_get
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\osv\orm.py", line 486, in __getattr__
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\osv\orm.py", line 401, in __getitem__
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\openerp\addons\base\res\res_users.py", line 810, in read
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\openerp\addons\base\res\res_users.py", line 272, in read
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\osv\orm.py", line 3612, in read
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\osv\orm.py", line 3664, in _read_flat
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\sql_db.py", line 161, in wrapper
  File "D:\Program Files\OpenERP 7.0-20131109-002558\Server\server\.\openerp\sql_db.py", line 226, in execute
ProgrammingError: column res_users.fieldname_id does not exist
LINE 1: ...",res_users."gmail_password",res_users."alias_id",res_users....
                                                             ^

2014-04-08 09:40:41,312 2544 INFO cvw_new werkzeug: 127.0.0.1 - - [08/Apr/2014 09:40:41] "POST /web/session/get_session_info HTTP/1.1" 200 -

Note: using inherit able to add column in other table

1

Brett Lehrer

--Brett Lehrer--
1252
| 5 4 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 4/10/14, 2:11 PM

This is caused by an OpenERP bug modifying res.users or res.partner in an already installed module. Before the module is upgraded, new fields are found on startup since the module itself has already been installed, and it's trying to run a flat query on them before you get a chance to upgrade! Try manually starting the server:

./openerp-server -c server_config_file.conf -d mydatabase -u this_modified_module

This will upgrade the module this_modified_module in your database "mydatabase" as the server starts itself up, which gets around this bug.

Thanks for giving information. I am using windows i already fixed issues by adding column in pg_admin directly and updating the module.

Prakash
on 4/14/14, 8:25 AM
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/8/14, 8:16 AM

Hi,

Try this code

class res_users(osv.Model):
    _inherit = 'res.users'
    _columns = {
            'fieldname_id'  : fields.many2one("master.table",  "Data"),
      }
res_users()

<openerp>
    <data>


        <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 name="type">form</field>
            <field name="inherit_id" ref="base.view_users_form"/>
            <field name="arch" type="xml">
            <xpath expr="//notebook" position="inside">
                <page string="Exta Details">
                   <group col="4">
                      <field name="manager_id" invisible='1'/>
                    </group>
                 </page>
            </xpath>

            </field>
        </record>

    </data>
</openerp>

i already tried its shows same error

Prakash
on 4/8/14, 8:21 AM

Can u give your xml file ?

Jagdish Panchal
on 4/8/14, 8:24 AM

Hi jack updated xml file.

Prakash
on 4/8/14, 9:03 AM

Update ans pls check

Jagdish Panchal
on 4/8/14, 9:10 AM

updated your source code and checked it shows same error.

Prakash
on 4/8/14, 9:20 AM

pls upgrade your module with my code because its woking at my end.

Jagdish Panchal
on 4/8/14, 9:34 AM

In my case after restarting server its shows blank page. At the log file shows same error.

Prakash
on 4/8/14, 9:47 AM

its shows blank page ? means its add Page "Exta Details" on User Form ?

Jagdish Panchal
on 4/8/14, 9:49 AM

After typing http://localhost:8069 its shows blank white page unable to create field in res_users table using python file. I fixed the issue by created the field using pgadmin tools.

Prakash
on 4/8/14, 10:03 AM

Nice, but this code is working at my end

Jagdish Panchal
on 4/8/14, 10:09 AM

You do a --update on your module ?

where you added :"depends" : ["base", "master_module"], ??????

Serge
on 4/8/14, 4:42 PM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 4/10/14, 7:57 AM

Is the master_module, the module you are trying to install or a module already installed ?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/8/14, 7:56 AM
Seen: 4534 times
Last updated: 3/16/15, 8:10 AM