Odoo Help


Name Error : Name 'time' is not defined

on 6/24/13, 4:54 AM 12,225 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..




| 5 4 7
Buenos Aires, Argentina
Karma will give me a place in heaven!
On 7/20/15, 7:45 PM


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!

On 11/28/13, 7:57 AM
 <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.
                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.

This is my action code.


Francesco OpenCode

--Francesco OpenCode--

| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 6/24/13, 8:51 AM

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

import time

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.

on 6/24/13, 9:26 AM


| 4 4 8
Ahmedabad, India

Odoo Expert

On 6/24/13, 6:39 AM

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.

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?

on 6/24/13, 6:59 AM

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.

on 6/24/13, 9:02 AM

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

on 6/24/13, 10:43 AM

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

on 6/24/13, 11:11 AM

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.

on 6/25/13, 4:08 AM

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.

on 6/25/13, 4:32 AM

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

on 11/28/13, 7:55 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/24/13, 4:54 AM
Seen: 12225 times
Last updated: 7/20/15, 7:45 PM