Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(68)  |  Call(55)  |  Derive(0)  |  Import(13)

src/e/r/erp5-HEAD/product/ERP5/Tool/SimulationTool.py   erp5(Download)
      return active_process
 
from Products.ERP5Type.DateUtils import addToDate
 
class SequenceItem:
    current_from_date = from_date
    while current_from_date < to_date:
      current_to_date = addToDate(current_from_date,
                                  second=second,
                                  minute=minute,

src/e/r/erp5-HEAD/product/ERP5/Document/EmploymentContract.py   erp5(Download)
from Products.ERP5.Document.SubscriptionItem import SubscriptionItem
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.DateUtils import addToDate, atTheEndOfPeriod
from DateTime import DateTime
 
        for month_count in range(stop_date.month() - start_date.month()+1):
          # for first movement, we use the start_date day
          movement_start_date = addToDate(start_date, year=year_count, month=month_count)
          if month_count != 0 or year_count != 0:
            # if there is more than one movement in the period, start date is the begining of the month
            movement_start_date = DateTime(movement_start_date.strftime('%Y/%m/01 00:00:00'))
          movement_stop_date = atTheEndOfPeriod(movement_start_date, 'month')-1
          # create only one year in the future
          if movement_start_date > addToDate(current_date, year=1):

src/e/r/erp5-HEAD/product/ERP5/Document/ImmobilisableItem.py   erp5(Download)
 
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.DateUtils import addToDate, getClosestDate, roundDate
from Products.ERP5Type.DateUtils import getRoundedMonthBetween, millis
from Products.ERP5Type.DateUtils import getAccountableYearFraction
        initial_date = immo_period['initial_date']
        initial_duration = immo_period['initial_duration']
        stop_date = addToDate(initial_date, month=initial_duration)
        stop_durability = 0
 
          period_stop_date = next_movement.getStopDate()
        else:
          period_stop_date = addToDate(period_start_date, month=period_start_duration)
      if at_date > period_stop_date:
        return self.getAmortisationPrice(at_date=period_stop_date, **kw)
                                        precision=date_precision, before=0, strict=0)
      # Calculate remaining annuities at bound dates
      local_stop_date = addToDate(period_start_date, month = period_start_duration)
      initial_remaining_annuities = getAccountableYearFraction(
                                                        from_date=period_start_date,
                                                             to_date=local_stop_date)
 
      local_stop_date = addToDate(period_stop_date, month=stop_duration)
      stop_remaining_annuities = getAccountableYearFraction(from_date=period_stop_date,
                                                            to_date=local_stop_date)

src/e/r/erp5-HEAD/product/ERP5/Document/AmortisationRule.py   erp5(Download)
from string import capitalize
 
from Products.ERP5Type.DateUtils import centis, getClosestDate, addToDate
from Products.ERP5Type.DateUtils import getDecimalNumberOfYearsBetween
from Products.ERP5Type import Permissions
          # XXX FIXME : do something if currency is None
            currency = self.currency_module[currency.split('/')[-1]]
          stop_date = immo_period.get('stop_date', addToDate(initial_date, month=initial_duration))
 
        # Period start and previous period stop
          adding_dict = {precision:1}
          if end_date == initial_date:
            end_date = addToDate(end_date, **adding_dict)
          annuity_number = 0
          if continuous:
                          ] ) )
            current_price -= annuity_price
            end_date = addToDate(end_date, **adding_dict)
            annuity_number += 1
 

src/e/r/erp5-HEAD/product/ERP5/Document/PresencePeriod.py   erp5(Download)
from Products.ERP5.mixin.periodicity import PeriodicityMixin
from Products.ERP5.Document.Movement import Movement
from Products.ERP5Type.DateUtils import addToDate
 
class PresencePeriod(Movement, PeriodicityMixin):
  #             yield (next_start_date, next_start_date+duration)
            result.append([next_start_date,
               addToDate(next_start_date, second=second_duration)])
            # Update the next exception date
            if len(exception_date_list) != 0:
  #             yield (next_start_date, next_start_date+duration)
            result.append({'start_date': next_start_date,
                           'stop_date': addToDate(next_start_date, second=second_duration),
                           'quantity': self.getQuantity()})
          next_start_date = self.getNextPeriodicalDate(next_start_date)
      next_start_date = next_start_date + day_count
 
    next_start_date = addToDate(next_start_date, day=1)
    while 1:
      if (self._validateDay(next_start_date)) and \
         (self._validateWeek(next_start_date)) and \
         (self._validateMonth(next_start_date)):
        break
      else:
        next_start_date = addToDate(next_start_date, day=1)

src/e/r/erp5-HEAD/product/ERP5/Document/DayMovementGroup.py   erp5(Download)
 
from Products.ERP5.Document.MovementGroup import MovementGroup
from Products.ERP5Type.DateUtils import addToDate
from DateTime import DateTime
 
  def _getPropertyDict(self, movement, **kw):
    property_dict = {}
    start_date = self._getStartDate(movement)
    property_dict['start_date'] = start_date
    property_dict['stop_date'] = addToDate(start_date, day=1)

src/e/r/erp5-HEAD/product/ERP5/tests/testAlarm.py   erp5(Download)
from DateTime import DateTime
from zLOG import LOG
from Products.ERP5Type.DateUtils import addToDate
 
class TestAlarm(ERP5TypeTestCase):
    self.tic()
    now = DateTime()
    date = addToDate(now,day=1)
    alarm.setPeriodicityStartDate(date)
    self.assertEqual(alarm.getAlarmDate(), None)
    alarm = self.newAlarm(enabled=True)
    now = DateTime()
    date = addToDate(now, day=2)
    alarm.setPeriodicityStartDate(date)
    alarm.setPeriodicityHourFrequency(1)
    self.tic()
    alarm.setNextAlarmDate(current_date=now)
    self.assertEqual(alarm.getAlarmDate(), date)
    LOG(message + ' now :',0,now)
    now = addToDate(now,day=2)
    LOG(message + ' now :',0,now)
    alarm.setNextAlarmDate(current_date=now)
    next_date = addToDate(date,hour=1)
    self.assertEqual(alarm.getAlarmDate(),next_date)
    now = addToDate(now,hour=1,minute=5)

src/s/l/slapos.core-HEAD/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py   slapos.core(Download)
import tempfile
from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate, getClosestDate
from zExceptions import Unauthorized
 
    self.assertEqual(min(DateTime().day(), 28),
                     subscription.getPeriodicityMonthDay())
    start_date = addToDate(line.getStartDate(), to_add={'month': 1})
    start_date = addToDate(start_date, to_add={'second': -1})
    while start_date.day() >= 28:
      start_date = addToDate(start_date, to_add={'day': -1})
    now = now.toZone(request_time.timezone())
    stop_date = getClosestDate(target_date=now, precision='month')
    stop_date = addToDate(stop_date, to_add={'second': -1})
    self.assertEqual(stop_date, line.getStopDate())
 

src/s/l/slapos.core-HEAD/master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py   slapos.core(Download)
from zExceptions import Unauthorized
from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate
from App.Common import rfc1123_date
from functools import wraps
    memcached_dict[self.computer.getReference()] = json.dumps({
        'text': '#access ok',
        'created_at': rfc1123_date(addToDate(DateTime(), 
                                             to_add={'minute': -11}))
    })
        'actor': 'ERP5TypeTestCase',
        'slap_state': '',
        'time': addToDate(DateTime(), to_add={'day': -6}),
        'action': 'edit'
    })
        'actor': 'ERP5TypeTestCase',
        'slap_state': '',
        'time': addToDate(DateTime(), to_add={'day': -8}),
        'action': 'edit'
    })
        'actor': 'ERP5TypeTestCase',
        'slap_state': '',
        'time': addToDate(DateTime(), to_add={'day': -8}),
        'action': 'edit'
    })

src/s/l/slapos.core-HEAD/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingRule.py   slapos.core(Download)
  testSlapOSMixin, withAbort
from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate
from Products.ERP5.Document.SimulationMovement import SimulationMovement
import transaction
    for simulation_movement in simulation_movement_list:
      simulation_movement = simulation_movement.getObject()
      movement_start_date = addToDate(self.initial_date, to_add=dict(month=idx))
      movement_stop_date = addToDate(self.initial_date, to_add=dict(month=idx+1))
      # Check simulation movement property
    for simulation_movement in simulation_movement_list:
      simulation_movement = simulation_movement.getObject()
      movement_start_date = addToDate(self.initial_date, to_add=dict(month=idx))
      movement_stop_date = addToDate(self.initial_date, to_add=dict(month=idx+1))
      # Check simulation movement property

  1 | 2  Next