Divyesh Makwana(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-leave_improvement-mdi into
lp:~openerp-dev/openobject-addons/trunk-leave_improvment.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-leave_improvement-mdi/+merge/99302
Hello Sir,
I have done the following changes :
1. Improved the field defination and its related changes.
2. Improved the buttons alignment with states.
3. Improved the calendar view to display the name of the user and leave
type.
This works fine for GTK but not for Web-Client(Seems this feature is not
supported in Web-Client).
4. Remove the filter.
Thanks,
Divyesh
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-leave_improvement-mdi/+merge/99302
Your team OpenERP R&D Team is requested to review the proposed merge of
lp:~openerp-dev/openobject-addons/trunk-leave_improvement-mdi into
lp:~openerp-dev/openobject-addons/trunk-leave_improvment.
=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py 2012-01-03 13:52:24 +0000
+++ hr_holidays/hr_holidays.py 2012-03-26 12:12:22 +0000
@@ -118,8 +118,8 @@
\nThe state is \'Refused\', when holiday request is refused by manager.\
\nThe state is \'Approved\', when holiday request is approved by manager.'),
'user_id':fields.related('employee_id', 'user_id', type='many2one', relation='res.users', string='User', store=True),
- 'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}, select=True),
- 'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
+ 'date_from': fields.date('Start Date', readonly=True, states={'draft':[('readonly',False)]}, select=True),
+ 'date_to': fields.date('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
#'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'),
@@ -186,11 +186,11 @@
def _get_number_of_days(self, date_from, date_to):
"""Returns a float equals to the timedelta between two dates given as string."""
- DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
+ DATETIME_FORMAT = "%Y-%m-%d"
from_dt = datetime.datetime.strptime(date_from, DATETIME_FORMAT)
to_dt = datetime.datetime.strptime(date_to, DATETIME_FORMAT)
timedelta = to_dt - from_dt
- diff_day = timedelta.days + float(timedelta.seconds) / 86400
+ diff_day = timedelta.days
return diff_day
def unlink(self, cr, uid, ids, context=None):
@@ -413,8 +413,8 @@
def _get_leave_status(self, cr, uid, ids, name, args, context=None):
holidays_id = self.pool.get('hr.holidays').search(cr, uid,
- [('employee_id', 'in', ids), ('date_from','<=',time.strftime('%Y-%m-%d %H:%M:%S')),
- ('date_to','>=',time.strftime('%Y-%m-%d %H:%M:%S')),('type','=','remove'),('state','not in',('cancel','refuse'))],
+ [('employee_id', 'in', ids), ('date_from','<=',time.strftime('%Y-%m-%d')),
+ ('date_to','>=',time.strftime('%Y-%m-%d')),('type','=','remove'),('state','not in',('cancel','refuse'))],
context=context)
result = {}
for id in ids:
=== modified file 'hr_holidays/hr_holidays_view.xml'
--- hr_holidays/hr_holidays_view.xml 2012-03-21 06:56:21 +0000
+++ hr_holidays/hr_holidays_view.xml 2012-03-26 12:12:22 +0000
@@ -51,6 +51,7 @@
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Leave Request" color="user_id" date_start="date_from" date_stop="date_to">
+ <field name="user_id"/>
<field name="holiday_status_id"/>
</calendar>
</field>
@@ -86,9 +87,8 @@
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}"/>
<separator string="Reasons" colspan="4"/>
<field name="notes" nolabel="1" colspan="4"/>
- <newline/>
- <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}' colspan="2"/>
- <group colspan="2" col="6">
+ <group colspan="4" col="8">
+ <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}'/>
<button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_user,base.group_hr_manager"/>
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
@@ -129,9 +129,8 @@
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}"/>
<separator string="Reasons" colspan="4"/>
<field name="notes" nolabel="1" colspan="4"/>
- <newline/>
- <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}' colspan="2"/>
- <group colspan="2" col="6">
+ <group colspan="4" col="8">
+ <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}'/>
<button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
@@ -258,7 +257,7 @@
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_id" ref="edit_holiday_new"/>
- <field name="context">{"search_default_department_id": department_id, "search_default_my_leaves": 1}</field>
+ <field name="context">{"search_default_department_id": department_id}</field>
<field name="domain">[('type','=','remove')]</field>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
<field name="help">Leave requests can be recorded by employees and validated by their managers. Once a leave request is validated, it appears automatically in the agenda of the employee. You can define several allowance types (paid holidays, sickness, etc.) and manage allowances per type.</field>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp