Commit 3304fe9b authored by Jérome Perrin's avatar Jérome Perrin

accounting_ui_test: fix pylint warnings

This ERP5 Python script was not checked until now, and add wrong indentation
parent 08a1b22a
...@@ -10,41 +10,41 @@ The test operates on 'today' transactions. ...@@ -10,41 +10,41 @@ The test operates on 'today' transactions.
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
accounting_module = portal.accounting_module
account_module = portal.account_module account_module = portal.account_module
ledger = portal.portal_categories.ledger ledger = portal.portal_categories.ledger
organisation_module = portal.organisation_module organisation_module = portal.organisation_module
person_module = portal.person_module
one_hour = 1.0 / 24.0 one_hour = 1.0 / 24.0
now = DateTime() now = DateTime()
today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour
if with_ledger: if with_ledger:
extra_kwargs_general = {'ledger': 'accounting/general'} extra_kwargs_general = {'ledger': 'accounting/general'}
extra_kwargs_detailed = {'ledger': 'accounting/detailed'} extra_kwargs_detailed = {'ledger': 'accounting/detailed'}
accounting_ledger = ledger.get('accounting', None) accounting_ledger = ledger.get('accounting', None)
if accounting_ledger is None: if accounting_ledger is None:
accounting_ledger = ledger.newContent(portal_type='Category', id='accounting') accounting_ledger = ledger.newContent(portal_type='Category',
id='accounting')
for sub_category_name in ('general', 'detailed'): for sub_category_name in ('general', 'detailed'):
sub_category = accounting_ledger.get(sub_category_name, None) sub_category = accounting_ledger.get(sub_category_name, None)
if sub_category is None: if sub_category is None:
sub_category = accounting_ledger.newContent(portal_type='Category', id=sub_category_name) sub_category = accounting_ledger.newContent(portal_type='Category',
id=sub_category_name)
# necessary for the "ledger" form field to appear and have correct options # necessary for the "ledger" form field to appear and have correct options
accounting_transaction = portal.portal_types.get('Accounting Transaction') accounting_transaction = portal.portal_types.get('Accounting Transaction')
ledger_list = accounting_transaction.getLedgerList() ledger_list = accounting_transaction.getLedgerList()
if 'accounting/general' not in ledger_list: if 'accounting/general' not in ledger_list:
ledger_list.append('accounting/general') ledger_list.append('accounting/general')
if 'accounting/detailed' not in ledger_list: if 'accounting/detailed' not in ledger_list:
ledger_list.append('accounting/detailed') ledger_list.append('accounting/detailed')
accounting_transaction.setLedgerList(ledger_list) accounting_transaction.setLedgerList(ledger_list)
else: else:
extra_kwargs_general = {} extra_kwargs_general = {}
extra_kwargs_detailed = {} extra_kwargs_detailed = {}
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
...@@ -54,13 +54,12 @@ context.AccountingTransactionModule_createAccountingTestDocument( ...@@ -54,13 +54,12 @@ context.AccountingTransactionModule_createAccountingTestDocument(
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 1 * one_hour, start_date=today + 1 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable, source_value=account_module.receivable,
source_debit=100.0), source_debit=100.0),
dict(portal_type='Accounting Transaction Line', dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales, source_value=account_module.goods_sales,
source_credit=100.0)), source_credit=100.0)),
**extra_kwargs_general **extra_kwargs_general)
)
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
...@@ -70,25 +69,25 @@ context.AccountingTransactionModule_createAccountingTestDocument( ...@@ -70,25 +69,25 @@ context.AccountingTransactionModule_createAccountingTestDocument(
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 2 * one_hour, start_date=today + 2 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=200.0), source_value=account_module.payable,
source_debit=200.0),
dict(portal_type='Accounting Transaction Line', dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales, source_value=account_module.goods_sales,
source_credit=200.0)), source_credit=200.0)),
**extra_kwargs_general **extra_kwargs_general)
)
if with_ledger: if with_ledger:
context.AccountingTransactionModule_createAccountingTestDocument( context.AccountingTransactionModule_createAccountingTestDocument(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 3', title='Transaction 3',
source_reference='3', source_reference='3',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
start_date=today + 3 * one_hour, start_date=today + 3 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line', embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=400.0), source_value=account_module.payable,
dict(portal_type='Accounting Transaction Line', source_debit=400.0),
source_value=account_module.goods_sales, dict(portal_type='Accounting Transaction Line',
source_credit=400.0)), source_value=account_module.goods_sales,
**extra_kwargs_detailed source_credit=400.0)),
) **extra_kwargs_detailed)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment