13
13
'unit', # one entry for each register/ccy in first period
14
14
'period', # one entry for each register/ccy in all periods
15
15
'fake', # process virtually flow iterations, no entry generated
16
'full_1st_period', # full process of the first period (Jan of first FY)
18
TEST_MODE = 'full_1st_period'
20
21
'register': "%s %s",
545
546
self.proxy.get(analytic_obj).create(vals)
546
547
return distrib_id
548
def create_journal_entry(self, year, month, items_count, with_ad):
549
def create_journal_entry(self, booking_ccy_id, year, month, items_count,
550
552
create a JE (with items_count JI in it (expense and counterpart lines)
551
553
:param with_ad: True if AD should be generated
615
618
'document_date': entry_date,
616
619
'account_id': random_account_id,
621
'currency_id': booking_ccy_id,
618
622
'amount_currency': random_amount,
1073
1081
fy_count = self.get_cfg_int('fy_count')
1075
je_per_month = 1 if TEST_MODE else self.get_cfg_int('je_per_month')
1083
je_per_month = 1 if TEST_MODE and TEST_MODE != 'full_1st_period' \
1084
else self.get_cfg_int('je_per_month')
1076
1085
ji_min_count = self.get_cfg_int('ji_min_count')
1077
1086
ji_max_count = self.get_cfg_int('ji_max_count')
1085
1094
if TEST_MODE and TEST_MODE == 'fake':
1088
for je_index in xrange(0, je_per_month):
1089
# random count of ji for each je of the period
1090
ji_count = 2 if TEST_MODE else randrange(ji_min_count,
1092
self.chrono_start('ji', year, m)
1093
self.create_journal_entry(year, m, ji_count,
1096
if TEST_MODE and TEST_MODE == 'unit':
1097
for ccy_id in ccy_ids:
1098
for je_index in xrange(0, je_per_month):
1099
# random count of ji for each je of the period
1100
ji_count = 2 if TEST_MODE and \
1101
TEST_MODE != 'full_1st_period' \
1102
else randrange(ji_min_count, ji_max_count)
1103
self.chrono_start('ji', year, m)
1104
self.create_journal_entry(ccy_id, year, m, ji_count,
1107
if TEST_MODE and TEST_MODE == 'unit':
1099
1110
# update report at each period process (in case of crash)
1100
1111
self.chrono_report('finance_direct_entries', ('ji', ))
1112
if TEST_MODE == 'full_1st_period':
1101
1114
year_index += 1
1189
1202
# update report at each period process (in case of crash)
1190
1203
self.chrono_report('finance_flow', report_entry_types)
1192
if TEST_MODE and TEST_MODE == 'unit':
1205
if TEST_MODE and TEST_MODE in ('unit', 'full_1st_period'):
1193
1206
break # 1st period only
1194
if TEST_MODE and TEST_MODE == 'unit':
1207
if TEST_MODE and TEST_MODE in ('unit', 'full_1st_period'):
1195
1208
break # 1st FY only
1196
1209
year_index += 1