Odoo Help


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




ERP Harbor Consulting Services

Website: http://www.erpharbor.com
Sudhir Arya (ERP Harbor Consulting Services)
On 2/7/13, 3:16 AM

I found solution and it worked for me:

<field name="domain">[('date_from', '&lt;', (context_today()-datetime.timedelta(weeks=1)).strftime('%Y-%m-%d'))]</field>

Hello Sudhir..I had used your code but its giving error like context_today is not defined..My code is <field name="domain">[('date', '=', context_today().strftime('%Y-%m-%d'))]</field>

on 11/28/13, 8:08 AM

Hello, I am getting same issue "NameError: name 'context_today' is not defined." I dont get it why even it might work well at your side. Can help me ?

Denero Team
on 1/18/14, 3:42 AM
On 2/7/13, 1:12 AM

You can try __import__('datetime') instead of datetime.date.today()


Antonin Bourguignon (abo)

--Antonin Bourguignon (abo)--

| 0 0 0
--Antonin Bourguignon (abo)--
Murder simulators enthusiast. http://gaming.stackexchange.com/users/15726/anto
Antonin Bourguignon (abo)
On 2/5/13, 11:04 AM

In a XML file, you have to use html entities to express inequality symbols < and > in a domain: respectively &lt; and &gt;.

Also a proper syntax for datetime can be found in a few places with a simple grep, for instance in stock/board_warehouse_view.xml:

<field name="domain">[('type','=','in'),('day','&lt;=', time.strftime('%Y-%m-%d')),('day','&gt;',(context_today()-datetime.timedelta(days=15)).strftime('%Y-%m-%d'))]</field>

Nicolas Bessi

--Nicolas Bessi--

| 5 7 8
Lausanne, Switzerland
--Nicolas Bessi--
Nicolas Bessi
On 2/5/13, 11:12 AM


It won't work, the domain is not aware of datetime.

In V7.0 you have to use the code directive of action: `<record id="ir_actions_server_timsheet_sheet" model="ir.actions.server">

        <field name="sequence" eval="5"/>
        <field name="state">code</field>
        <field name="type">ir.actions.server</field>
        <field name="model_id" ref="model_hr_timesheet_current_open"/>
        <field name="code">action = pool.get('hr.timesheet.current.open').open_timesheet(cr, uid, None, context)</field>
        <field name="condition">True</field>
        <field name="name">My Timesheet</field>


Thank you for you answer. But can you please explain how can I achieve my requirement?

Sudhir Arya (ERP Harbor Consulting Services)
on 2/6/13, 12:33 AM

About This Community

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

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

0 follower(s)


Asked: 2/5/13, 9:38 AM
Seen: 9894 times
Last updated: 9/30/17, 6:21 AM