Commit 709b71ef authored by Jérome Perrin's avatar Jérome Perrin

accounting py3

parent add91892
......@@ -43,22 +43,12 @@ class InventoryKey(UserDict):
self.data = {}
self.data.update(kw)
def clear(self):
def _raise_immutable(self, *args, **kw):
raise TypeError('InventoryKey are immutable')
def pop(self, keys, *args):
raise TypeError('InventoryKey are immutable')
def update(self, dict=None, **kwargs): # pylint: disable=redefined-builtin
raise TypeError('InventoryKey are immutable')
def __delitem__(self, key):
raise TypeError('InventoryKey are immutable')
def __setitem__(self, key, item):
raise TypeError('InventoryKey are immutable')
clear = pop = update = __delitem__ = __setitem__ = _raise_immutable
def setdefault(self, key, failobj=None):
def setdefault(self, key, default=None):
if key in self.data:
return self.data[key]
raise TypeError('InventoryKey are immutable')
......@@ -440,7 +430,7 @@ class BalanceTransaction(AccountingTransaction, Inventory):
return factory
def _immediateReindexObject(self, **kw):
def _immediateReindexObject(self, *args, **kw):
"""Reindexes the object.
This is different indexing that the default Inventory indexing, because
we want to take into account that lines in this balance transaction to
......
......@@ -2,12 +2,8 @@ import six
from Products.ERP5Type.Message import translateString
from Products.ERP5Form.Report import ReportSection
if six.PY2:
def translate(*args, **kw):
return unicode(translateString(*args, **kw))
else:
def translate(*args, **kw):
return str(translateString(*args, **kw))
def translate(*args, **kw):
return six.text_type(translateString(*args, **kw))
request = container.REQUEST
section_category = request['section_category']
......
......@@ -28,14 +28,14 @@ for line in transaction_lines:
line.getDestinationSectionValue(portal_type=section_portal_type_list),
line.getSourcePaymentValue(portal_type=bank_account_portal_type),
lambda: (x[1] for x in getBankAccountItemList(
organisation=line.getSourceSection(portal_type=section_portal_type_list))),
organisation=line.getSourceSection(portal_type=section_portal_type_list))), # pylint:disable=cell-var-from-loop
),
(
line.getDestinationValue(portal_type='Account'),
line.getSourceSectionValue(portal_type=section_portal_type_list),
line.getDestinationPaymentValue(portal_type=bank_account_portal_type),
lambda: (x[1] for x in getBankAccountItemList(
organisation=line.getDestinationSection(portal_type=section_portal_type_list))),
organisation=line.getDestinationSection(portal_type=section_portal_type_list))), # pylint:disable=cell-var-from-loop
),
):
if account is not None and account.getValidationState() != 'validated':
......
......@@ -21,17 +21,14 @@ if accounting_module.getProperty('current_content_script',
'') == current_script_data_id:
return "Accounting Transactions Created."
# first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to
# workaround some security checks
if 1:
for module_id in ['accounting_module',
'sale_packing_list_module',
'portal_simulation', ]:
module = portal[module_id]
if len(module) > 200:
raise ValueError("Do not run this on production !!!")
module.manage_delObjects(list(module.objectIds()))
# first, cleanup modules
for module_id in ['accounting_module',
'sale_packing_list_module',
'portal_simulation', ]:
module = portal[module_id]
if len(module) > 200:
raise ValueError("Do not run this on production !!!")
module.manage_delObjects(list(module.objectIds()))
# if `set_ledger`is true, allow all test ledgers in accounting types.
for accounting_type_id in portal.getPortalAccountingTransactionTypeList():
......
......@@ -16,10 +16,7 @@ if accounting_module.getProperty('current_content_script',
return "Accounting Transactions Created."
# first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to
# workaround some security checks
if 1:
accounting_module.manage_delObjects(list(accounting_module.objectIds()))
accounting_module.manage_delObjects(list(accounting_module.objectIds()))
# XXX copy & paste
def getAccountByTitle(title):
......
......@@ -15,15 +15,12 @@ if accounting_module.getProperty('current_content_script',
return "Accounting Transactions Created."
# first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to
# workaround some security checks
if 1:
for module_id in ['accounting_module',
'sale_packing_list_module',
'portal_simulation', ]:
module = portal[module_id]
module.manage_delObjects(list(module.objectIds()))
# first, cleanup modules
for module_id in ['accounting_module',
'sale_packing_list_module',
'portal_simulation', ]:
module = portal[module_id]
module.manage_delObjects(list(module.objectIds()))
# XXX copy & paste
def getAccountByTitle(title):
......
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