Skip to Content
Menu
This question has been flagged
12 Replies
47516 Views

Hello all, I am getting an error while refreshing the page in V7

server/openerp/addons/base/ir/ir_ui_menu.py", line 336, in get_needaction_data dom = menu.action.domain and eval(menu.action.domain, {'uid': uid}) or []

erver/openerp/tools/safe_eval.py", line 241, in safe_eval return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict) File "", line 1, in <module> NameError: name 'time' is not defined

What may be the issue? Please help..

Avatar
Discard
Best Answer

Hi,

It seems that's a known bug: https://code.launchpad.net/~openerp-dev/openobject-server/7.0-opw-603382-ado 

I went through the the fix proposed and tested it and, at a first glance, it works!


Hope this helps!

Avatar
Discard
Best Answer

Add this line at top of your code, with the other import lines:

import time

Avatar
Discard
Author

Dear Francesco and Keyur,Thank you for the reply, I tried this one, but my case is different. I am getting this error for Admin users only. All other users get expected result.

I was trying to create new Groups via GUI and to give acces rights in the Menus.

Best Answer

Hi GuruDev,

Maybe you have not imported time library in your py file. That's why it is giving error of time.

Hope it will work after importing time in py file.

Avatar
Discard
Author

Thanks for the reply, Keyur..

I should import it in the ir_ui_menu.py file? How to import? in the .py file.. import time is it ok?

Have you created your custom module? Have you created any menu or apply domain on any action? I think the error comes because of the domain in action.

Author

I didint create any module. But I duplicated some groups and made some modification in acces. And also, I didnt add any domain.

Basic addons are not error prone. Maybe there can be other reason. You should try different database maybe then it will work properly.

Author

Dear Keyur, I was creating a new user group for Approvals. I've added a new Menu item into the Existing Accounting-Menu and gave acces rights for this newly created user group. That menu item contains...an action---Purchase Orders Waiting for Approval.

This was the only change that I made.

Can you please paste your action code here? I will try it in my custom module. Then I can figure out what exactly the problem is.

hello Keyur...I need your help..i am adding domain in action the its giving error of time is not defined..I have defined import time in .py file..but of no use..Please help

Best Answer
 <record id="action_view_task" model="ir.actions.act_window">
            <field name="name">Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_mode">kanban,tree,form,calendar,gantt,graph</field>
            <field name="domain">[('date','=',time.strftime('%Y-%m-%d')),('user_id','=',uid)]</field>
            <field name="filter" eval="True"/>
            <field name="search_view_id" ref="view_task_search_form"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a new task.
              </p><p>
                OpenERP's project management allows you to manage the pipeline
                of tasks in order to get things done efficiently. You can
                track progress, discuss on tasks, attach documents, etc.
              </p>
            </field>
        </record>

This is my action code.

Avatar
Discard
Related Posts Replies Views Activity
3
Mar 15
8742
0
Mar 15
3430
0
Mar 15
7707
2
Mar 15
7173
9
Apr 19
10559