Skip to content

Commit

Permalink
Update base_action_rule change resource calendar method to use
Browse files Browse the repository at this point in the history
schedule_hours_get_date when Delay Hours
  • Loading branch information
Stephen Levenhagen committed Jan 19, 2016
1 parent 76b6b5c commit 3f52db2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ def _check_delay(self, cr, uid, action, record, record_dt, context=None):
If no calendar is found, fallback on the default behavior. """


if action.trg_date_calendar_id and action.trg_date_range_type in ['day','hours','minutes'] and action.trg_date_resource_field_id:
if action.trg_date_calendar_id and action.trg_date_range_type == 'hour' and action.trg_date_resource_field_id:
user = record[action.trg_date_resource_field_id.name]
if user.employee_ids and user.employee_ids[0].contract_id \
and user.employee_ids[0].contract_id.working_hours:
calendar = user.employee_ids[0].contract_id.working_hours
start_dt = get_datetime(record_dt)
resource_id = user.employee_ids[0].resource_id.id
action_dt = self.pool['resource.calendar'].schedule_days_get_date(
cr, uid, calendar.id, action.trg_date_range,
day_date=start_dt, compute_leaves=True, resource_id=resource_id,
action_dt = self.pool['resource.calendar'].schedule_hours_get_date(
cr, uid,action.trg_date_calendar_id.id, hours= action.trg_date_range,
day_dt=start_dt, compute_leaves=True, resource_id=resource_id,
context=context
)
return action_dt

elif action.trg_date_calendar_id and action.trg_date_range_type in ['day','hours','minutes']:
elif action.trg_date_calendar_id and action.trg_date_range_type == 'hour':
start_dt = get_datetime(record_dt)
action_dt = self.pool['resource.calendar'].schedule_days_get_date(
action_dt = self.pool['resource.calendar'].schedule_hours_get_date(
cr, uid, action.trg_date_calendar_id.id, action.trg_date_range,
day_date=start_dt, compute_leaves=True, context=context
day_dt=start_dt, compute_leaves=True, context=context
)
return action_dt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<field name="inherit_id" ref="hr_contract.view_base_action_rule_form_resource"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='trg_date_calendar_id']" position="attributes">
<attribute name="attrs">{'invisible':['|', ('trg_date_id','=',False), ('trg_date_range_type', 'not in', ('day','hour','minutes'))]}</attribute>
<attribute name="attrs">{'invisible':['|', ('trg_date_id','=',False), ('trg_date_range_type', 'not in', ('day','hour'))]}</attribute>
</xpath>

<xpath expr="//field[@name='trg_date_resource_field_id']" position="attributes">

<attribute name="attrs">{'invisible': ['|', ('trg_date_id','=',False), ('trg_date_range_type', 'not in', ('day','hour','minutes'))]}</attribute>
<attribute name="attrs">{'invisible': ['|', ('trg_date_id','=',False), ('trg_date_range_type', 'not in', ('day','hour'))]}</attribute>
</xpath>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion odoo
Submodule odoo updated 2219 files

0 comments on commit 3f52db2

Please sign in to comment.