def onchange_check_dates(self, checkin_date=False, checkout_date=False,
                             duration=False):
        '''
        This method gives the duration between check in checkout if
        customer will leave only for some hour it would be considers
        as a whole day. If customer will checkin checkout for more or equal
        hours, which configured in company as additional hours than it would
        be consider as full days
        --------------------------------------------------------------------
        @param self: object pointer
        @return: Duration and checkout_date
        '''
        value = {}
        configured_addition_hours = 0
        wc_id = self.warehouse_id
        whcomp_id = wc_id or wc_id.company_id
        if whcomp_id:
            configured_addition_hours = wc_id.company_id.additional_hours
        duration = 0
        if checkin_date and checkout_date:
            chkin_dt = datetime.strptime(checkin_date, dt)
            chkout_dt = datetime.strptime(checkout_date, dt)
            dur = chkout_dt - chkin_dt
            duration = dur.days + 1
            if configured_addition_hours > 0:
                additional_hours = abs((dur.seconds / 60))
                if additional_hours <= abs(configured_addition_hours * 60):
                    duration -= 1
        value.update({'duration': duration})
        return value
def onchange_check_dates ( self , checkin_date = False , checkout_date = False , duration = False ) : value = { } configured_addition_hours = 0 wc_id = self . warehouse_id whcomp_id = wc_id or wc_id . company_id if whcomp_id : configured_addition_hours = wc_id . company_id . additional_hours duration = 0 if checkin_date and checkout_date : chkin_dt = datetime . strptime ( checkin_date , dt ) chkout_dt = datetime . strptime ( checkout_date , dt ) dur = chkout_dt - chkin_dt duration = dur . days + 1 if configured_addition_hours > 0 : additional_hours = abs ( ( dur . seconds / 60 ) ) if additional_hours <= abs ( configured_addition_hours * 60 ) : duration -= 1 value . update ( { 'duration' : duration } ) return value
This method gives the duration between check in checkout if
        customer will leave only for some hour it would be considers
        as a whole day. If customer will checkin checkout for more or equal
        hours, which configured in company as additional hours than it would
        be consider as full days
        --------------------------------------------------------------------
        @param self: object pointer
        @return: Duration and checkout_date