Guest User

Untitled

a guest
Jun 14th, 2018
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         for year in xrange(2015,2020):
  2.             start_date = datetime.date(year, 6, 1)
  3.             end_date = start_date + relativedelta(years=1, months=-1, day=31)
  4.             fiscalyear = FiscalYear(name='%s-%s' % (year, year+1))
  5.             fiscalyear.start_date = start_date
  6.             fiscalyear.end_date = end_date
  7.             fiscalyear.company = company
  8.             fiscalyear.post_move_sequence = post_move_sequence
  9.             for attr, name in (('out_invoice_sequence', 'Facturation'),
  10.                     ('in_invoice_sequence', 'Facturation fournisseur'),
  11.                     ('out_credit_note_sequence', 'Crédit'),
  12.                     ('in_credit_note_sequence', 'Crédit fournisseur')):
  13.                 sequence = SequenceStrict(
  14.                     name='%s-%s' % (start_date.year, name),
  15.                     code='account.invoice',
  16.                     company=company)
  17.                 sequence.padding = 3;
  18.                 sequence.prefix = '%s-' % start_date.year;
  19.                 sequence.save()
  20.                 sequence, = SequenceStrict.find([('name', '=', '%s-%s' % (start_date.year, name))])
  21.                 setattr(fiscalyear, attr, sequence)
  22.             fiscalyear.save()
  23.             FiscalYear.create_period([fiscalyear.id], config.context)
RAW Paste Data