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

I want create menu that show list of employee birthday in current month.

By
Jagdish Panchal
on 7/16/14, 1:10 AM 2,031 views

Hi,

I want create menu that show list of employee birthday in current month. I have pass domain in action but getting issue .

Domain:

  <field name="domain" eval="['&amp;', ('birthday','&gt;=', time.strftime('%%m-%%d')),('birthday','&lt;=', time.strftime('%%m-%%d'))]"/>
  <field name="domain" eval="['&amp;', ('birthday','&gt;=', time.strftime('%Y-%m-%d')),('birthday','&lt;=', time.strftime('%Y-%m-%d')))]"/>

help please

can u post your domain condition code?..

Prakash
on 7/16/14, 1:24 AM

@prakash: I have update my que. I have try both this domain but facing issue

Jagdish Panchal
on 7/16/14, 1:53 AM
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 7/16/14, 11:42 PM

Hi,

Prakash and nehal thanx for the answer i have found solution. Create one function field that get month and date from employee birthday. I have use this field with domain [('month','&lt;=',(context_today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('month','&gt;=',(context_today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))] its work fine.

1

Nehal

--Nehal--
2090
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
On 7/16/14, 2:34 AM

Hi,

Refer the following link it may help you:
http://stackoverflow.com/questions/16535704/openerp-7-many2one-with-current-month-filter
 

1

Prakash

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

OpenERP Devloper at SunARC Technology

Prakash
On 7/16/14, 2:33 AM

Please see the link  http://stackoverflow.com/questions/14537302/want-to-show-data-group-by-year-month-week-in-openerp-7

Try the below code:-

filter icon="terp-go-month" string="Month" name="month" domain="[('birthday','&lt;=',(context_today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('birthday','&gt;=',(context_today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" help="Current Month" context="{'group_by':'birthday'}"/>

Prakash i have try this code but getting " name 'context_today' is not defined" error I want pass this domain in action.

Jagdish Panchal
on 7/16/14, 2:38 AM
This domain is work but it check like birthday between 01-07-2014 to 31-07-2014 there is no employee birthday between this date
Jagdish Panchal
on 7/16/14, 2:41 AM

oh.. yes i think need to change domain condition..

Prakash
on 7/16/14, 2:51 AM

have update answer with new domain ?

Jagdish Panchal
on 7/16/14, 2:58 AM
0
Bruno JOLIVEAU
On 7/17/15, 11:52 AM

Hi,

Maybe, you'll need to display other dates on event, you can user super_calendar module to unify in one calendar view

0
Gaurav Sahu
On 7/17/15, 3:43 AM

Hi

I have created a sql view for employee Birthday and show in calendar. 


Sql View:
select h.id,concat(concat(date_part('Year',current_date),'-'),to_char(h.birthday, 'mm-dd')),r.name from hr_employee as h join resource_resource as r on h.resource_id=r.id where r.active='t';


employee_birthday.py


from openerp import tools

from openerp.osv import fields,osv

class birthday_report(osv.osv):

_name = "birthday.report"

_auto = False

_columns = {

'name': fields.many2one('hr.employee','Employee'),

'dob' : fields.date('Birthday'),

}

def init(self, cr):

tools.drop_view_if_exists(cr, 'birthday_report')

cr.execute("""

create or replace view birthday_report as (

select

h.id as id,

h.id as name,

concat(concat(date_part('Year',current_date),'-'),to_char(h.birthday, 'mm-dd')) as dob

from

hr_employee as h

join

resource_resource as r

on

h.resource_id=r.id

where 
r.active ='t'

)

""")

birthday_report()



employee_birthday_view.xml



<record id="view_birthday_report_calendar" model="ir.ui.view">

<field name="name">Employee Birthday</field>

<field name="model">birthday.report</field>

<field name="arch" type="xml">

<calendar string="Birthday" color="name"

date_start="dob"

quick_add="False" avatar_model="hr.employee">

<field name="name"/>

</calendar>

</field>

</record>


 

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

2 follower(s)

Stats

Asked: 7/16/14, 1:10 AM
Seen: 2031 times
Last updated: 7/17/15, 11:52 AM