Odoo Help

Welcome!

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

0

add function on date field

By
eman ibrahim
on 4/13/14, 4:34 PM 1,333 views

i need to add function to insurance_expire_date field if this field is less by 5 days than the current date then send massage to hr manager group how i can do that and what the syntax please i need a quick help.

0

Nehal

--Nehal--
2090
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
On 4/14/14, 2:36 AM

Hi,

You can create onchange method for expire_date field. For e.g. In your xml file:

<field name="expire_date" on_change="onchange_expire_date(expire_date)"/>

In your py file add the function below:

def onchange_expire_date((self, cr, uid, ids, expire_date, context=None):
      datetime_today = datetime.now()
      if (datetime_today - expire_date).days <= 5:
        # Send message
      else:
        # else part

Hope this may help you.

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 4/14/14, 3:21 AM

Create an Automated Action which calls the Server Action 5 days before a insurance_exp ire_date and send Email to hr manager group using Email Template

Refer the below link:-

https://accounts.openerp.com/forum/Help-1/question/9871

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 4/13/14, 4:34 PM
Seen: 1333 times
Last updated: 3/16/15, 8:10 AM