跳至内容
菜单
此问题已终结
12 回复
47550 查看

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

形象
丢弃
最佳答案

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!

形象
丢弃
最佳答案

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.

最佳答案

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?

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.

编写者

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.

编写者

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

最佳答案
 <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.

形象
丢弃
相关帖文 回复 查看 活动
3
3月 15
8772
0
3月 15
3448
0
3月 15
7736
2
3月 15
7181
9
4月 19
10573