Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
17 Odpowiedzi
24220 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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
Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Autor

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

Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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>
Awatar
Odrzuć
Autor

i already tried its shows same error

Can u give your xml file ?

Autor

Hi jack updated xml file.

Update ans pls check

Autor

updated your source code and checked it shows same error.

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

Autor

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

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

Autor

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.

Nice, but this code is working at my end

You do a --update on your module ?

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

Najlepsza odpowiedź

Try updating the module from command line itself. using

python openerp-server  -c config_file.conf -u <module name>

You can even select database using -d <db_name>

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
gru 18
19481
1
lip 15
7058
2
mar 15
8618
2
mar 15
5372
2
mar 15
10739