Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexander Emmerich
erp5
Commits
a12f1c00
Commit
a12f1c00
authored
2 years ago
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
1 year ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: modernize -f dict_six.
parent
431c34d4
Changes
81
Hide whitespace changes
Inline
Side-by-side
Showing
81 changed files
with
262 additions
and
147 deletions
+262
-147
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
...accounting/AccountModule_getAccountListForTrialBalance.py
+3
-2
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_roundDebitCredit.py
...erp5_accounting/AccountingTransaction_roundDebitCredit.py
+2
-1
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.py
...em/portal_components/extension.erp5.ERP5Administration.py
+3
-2
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
...teItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
+1
-1
bt5/erp5_api_style/TestTemplateItem/portal_components/test.erp5.testJioApiStyle.py
...mplateItem/portal_components/test.erp5.testJioApiStyle.py
+2
-1
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.SimulatedDeliveryBuilder.py
...rtal_components/document.erp5.SimulatedDeliveryBuilder.py
+2
-1
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
...TemplateItem/portal_components/mixin.erp5.BuilderMixin.py
+2
-1
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPrimaryGroup.py
...lateItem/portal_skins/erp5_base/Person_getPrimaryGroup.py
+1
-1
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetLine.py
...emplateItem/portal_components/document.erp5.BudgetLine.py
+2
-1
bt5/erp5_commerce_loyalty_program/DocumentTemplateItem/portal_components/document.erp5.LoyaltyTransactionSimulationRule.py
...ponents/document.erp5.LoyaltyTransactionSimulationRule.py
+2
-1
bt5/erp5_computer_immobilisation/DocumentTemplateItem/portal_components/document.erp5.InternetProtocolAddress.py
...ortal_components/document.erp5.InternetProtocolAddress.py
+2
-1
bt5/erp5_computer_immobilisation/TestTemplateItem/portal_components/test.erp5.testComputerWithComputerModel.py
...tal_components/test.erp5.testComputerWithComputerModel.py
+2
-1
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
...ts/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
+2
-1
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.SolverConfiguratorItem.py
...portal_components/document.erp5.SolverConfiguratorItem.py
+2
-1
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateObjectStructure.py
...kins/erp5_consulting/FastInput_generateObjectStructure.py
+1
-1
bt5/erp5_core_test/MixinTemplateItem/portal_components/mixin.erp5.TestWorkflowMixin.py
...ateItem/portal_components/mixin.erp5.TestWorkflowMixin.py
+2
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+5
-4
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
...tTemplateItem/portal_components/test.erp5.testERP5Base.py
+2
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+4
-4
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFields.py
...estTemplateItem/portal_components/test.erp5.testFields.py
+3
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
...lateItem/portal_components/test.erp5.testIdToolUpgrade.py
+2
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
...plateItem/portal_components/test.erp5.testPasswordTool.py
+5
-5
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
...tTemplateItem/portal_components/test.erp5.testWorklist.py
+3
-2
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testERP5WebWithCRM.py
...ateItem/portal_components/test.erp5.testERP5WebWithCRM.py
+3
-2
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py
...teItem/portal_components/extension.erp5.JupyterCompile.py
+6
-5
bt5/erp5_data_protection/TestTemplateItem/portal_components/test.erp5.testDataProtection.py
...ateItem/portal_components/test.erp5.testDataProtection.py
+1
-1
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
...s/TestTemplateItem/portal_components/test.erp5.testDms.py
+13
-13
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
...tTemplateItem/portal_components/module.erp5.Subversion.py
+2
-1
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
...em/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
+2
-1
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.py
...Item/portal_skins/erp5_toolbox/Base_viewSimulationTree.py
+2
-1
bt5/erp5_immobilisation/TestTemplateItem/portal_components/test.erp5.testImmobilisation.py
...ateItem/portal_components/test.erp5.testImmobilisation.py
+2
-2
bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.py
...s/erp5_ingestion/Document_getPropertyDictFromUserLogin.py
+2
-1
bt5/erp5_ingestion/ToolComponentTemplateItem/portal_components/tool.erp5.UrlRegistryTool.py
...mplateItem/portal_components/tool.erp5.UrlRegistryTool.py
+2
-1
bt5/erp5_inotify/ToolComponentTemplateItem/portal_components/tool.erp5.InotifyTool.py
...ntTemplateItem/portal_components/tool.erp5.InotifyTool.py
+2
-1
bt5/erp5_interfaces/DocumentTemplateItem/portal_components/document.erp5.SOAPBinding.py
...mplateItem/portal_components/document.erp5.SOAPBinding.py
+2
-1
bt5/erp5_invoicing/DocumentTemplateItem/portal_components/document.erp5.TradeModelSimulationRule.py
...rtal_components/document.erp5.TradeModelSimulationRule.py
+2
-1
bt5/erp5_invoicing/ModuleComponentTemplateItem/portal_components/module.erp5.TestInvoiceMixin.py
...ateItem/portal_components/module.erp5.TestInvoiceMixin.py
+3
-2
bt5/erp5_mrp/DocumentTemplateItem/portal_components/document.erp5.TransformationSimulationRule.py
..._components/document.erp5.TransformationSimulationRule.py
+2
-1
bt5/erp5_mrp/TestTemplateItem/portal_components/test.erp5.testMRP.py
...p/TestTemplateItem/portal_components/test.erp5.testMRP.py
+2
-1
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
...ort_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
+2
-1
bt5/erp5_payline/SkinTemplateItem/portal_skins/erp5_payline/PaylineSOAPConnector_archiveExchange.py
...kins/erp5_payline/PaylineSOAPConnector_archiveExchange.py
+1
-1
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getEditableObjectLineList.py
..._payroll/PaySheetTransaction_getEditableObjectLineList.py
+1
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEndOfContractReport_makeReport.py
...erp5_payroll_l10n_fr/DSNEndOfContractReport_makeReport.py
+3
-2
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
...kins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
+2
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
...5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
+2
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
...skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
+9
-8
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getPayslipData.py
...rp5_payroll_l10n_fr/PaySheetTransaction_getPayslipData.py
+2
-1
bt5/erp5_payroll_l10n_fr/TestTemplateItem/portal_components/test.erp5.testSimplifiedPayslipReport.py
...ortal_components/test.erp5.testSimplifiedPayslipReport.py
+4
-3
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
...lateItem/portal_components/document.erp5.PayzenService.py
+1
-1
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
...l_components/test.erp5.testRealTimeInventoryAccounting.py
+2
-1
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testBPMCore.py
...stTemplateItem/portal_components/test.erp5.testBPMCore.py
+2
-1
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testTradeModelLine.py
...ateItem/portal_components/test.erp5.testTradeModelLine.py
+7
-6
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.AcceptSolver.py
...plateItem/portal_components/document.erp5.AcceptSolver.py
+2
-1
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.AdoptSolver.py
...mplateItem/portal_components/document.erp5.AdoptSolver.py
+2
-1
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.ItemListSplitSolver.py
...em/portal_components/document.erp5.ItemListSplitSolver.py
+2
-1
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.MovementSplitSolver.py
...em/portal_components/document.erp5.MovementSplitSolver.py
+4
-3
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.QuantitySplitSolver.py
...em/portal_components/document.erp5.QuantitySplitSolver.py
+2
-1
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.SolverProcess.py
...lateItem/portal_components/document.erp5.SolverProcess.py
+1
-0
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.TradeModelSolver.py
...eItem/portal_components/document.erp5.TradeModelSolver.py
+4
-3
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.UnifySolver.py
...mplateItem/portal_components/document.erp5.UnifySolver.py
+2
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5Conduit.py
...TemplateItem/portal_components/module.erp5.ERP5Conduit.py
+5
-4
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5DocumentConduit.py
...Item/portal_components/module.erp5.ERP5DocumentConduit.py
+1
-1
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
...Item/portal_components/document.erp5.WebServiceRequest.py
+1
-1
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeBrain.py
...lateItem/portal_components/extension.erp5.TioSafeBrain.py
+4
-3
bt5/erp5_tiosafe_core/SkinTemplateItem/portal_skins/erp5_integration/IntegrationSite_updateCategoryMappingLineList.py
...egration/IntegrationSite_updateCategoryMappingLineList.py
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
...m/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
+6
-5
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testOrderBuilder.py
...plateItem/portal_components/test.erp5.testOrderBuilder.py
+2
-1
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
...plateItem/portal_components/test.erp5.testTradeReports.py
+3
-2
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py
...skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py
+2
-1
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/TravelRequestRecord_updateRelatedTicket.py
...erp5_hr_record/TravelRequestRecord_updateRelatedTicket.py
+2
-1
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Base_getConstraintTypeListPerPortalType.py
.../erp5_upgrader/Base_getConstraintTypeListPerPortalType.py
+2
-1
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_checkUpgraderConsistency.py
..._skins/erp5_upgrader/ERP5Site_checkUpgraderConsistency.py
+2
-1
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkWorkflowChainConsistency.py
...p5_upgrader/TemplateTool_checkWorkflowChainConsistency.py
+3
-2
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testERP5Web.py
...stTemplateItem/portal_components/test.erp5.testERP5Web.py
+2
-2
erp5/util/benchmark/report.py
erp5/util/benchmark/report.py
+1
-1
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
...mplateItem/portal_components/module.erp5.MovementGroup.py
+1
-1
product/ERP5/tests/testSpellChecking.py
product/ERP5/tests/testSpellChecking.py
+2
-2
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+1
-1
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+58
-2
product/Formulator/Field.py
product/Formulator/Field.py
+2
-2
product/ZSQLCatalog/Query/ComplexQuery.py
product/ZSQLCatalog/Query/ComplexQuery.py
+1
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
View file @
a12f1c00
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.PythonScripts.standard
import
Object
from
ZTUtils
import
LazyFilter
import
six
portal
=
context
.
getPortalObject
()
portal_categories
=
portal
.
portal_categories
...
...
@@ -42,7 +43,7 @@ src_list = []
def
getInventoryList
(
node_uid
=
None
,
**
kw
):
if
not
node_uid
and
node_uid
is
not
None
:
return
[]
for
key
,
value
in
inventory_params
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
inventory_params
):
assert
key
not
in
kw
,
key
kw
[
key
]
=
value
result
=
getInventoryList_
(
...
...
@@ -632,7 +633,7 @@ def getPaymentTitleFromUid(uid):
return
title
line_list
=
[]
for
key
,
data
in
line_per_account
.
iteritems
(
):
for
key
,
data
in
six
.
iteritems
(
line_per_account
):
node_relative_url
=
key
[
0
]
mirror_section_uid
=
key
[
1
]
payment_uid
=
key
[
2
]
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_roundDebitCredit.py
View file @
a12f1c00
...
...
@@ -9,6 +9,7 @@ What is expected with this script:
- In reality we probably also want that amount on vat line match invoice vat
amount, but we have ignored this.
"""
import
six
line_list
=
context
.
getMovementList
(
portal_type
=
context
.
getPortalAccountingMovementTypeList
())
...
...
@@ -41,7 +42,7 @@ receivable_type = account_type.asset.receivable
payable_type
=
account_type
.
liability
.
payable
asset_line
=
None
for
line
,
account_type_list
in
account_type_dict
.
iteritems
(
):
for
line
,
account_type_list
in
six
.
iteritems
(
account_type_dict
):
if
receivable_type
in
account_type_list
or
payable_type
in
account_type_list
:
if
line
.
getSourceSection
()
==
context
.
getSourceSection
()
and
\
line
.
getDestinationSection
()
==
context
.
getDestinationSection
():
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.ERP5Administration.py
View file @
a12f1c00
...
...
@@ -5,6 +5,7 @@ from zExceptions import ExceptionFormatter
from
Products.CMFActivity.ActiveResult
import
ActiveResult
from
zLOG
import
LOG
,
INFO
import
six
def
dumpWorkflowChain
(
self
,
ignore_default
=
False
,
ignore_id_set
=
None
,
keep_order
=
False
,
batch_mode
=
False
):
...
...
@@ -89,7 +90,7 @@ def MessageCatalog_getMessageDict(self):
Get Localizer's MessageCatalog instance messages.
"""
d
=
{}
for
k
,
v
in
s
elf
.
_messages
.
iteritems
(
):
for
k
,
v
in
s
ix
.
iteritems
(
self
.
_messages
):
d
[
k
]
=
v
return
d
...
...
@@ -99,7 +100,7 @@ def MessageCatalog_getNotTranslatedMessageDict(self):
"""
not_translated_message_dict
=
{}
messages
=
MessageCatalog_getMessageDict
(
self
)
for
k
,
v
in
messages
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
messages
):
if
not
[
x
for
x
in
v
.
values
()
if
x
]:
not_translated_message_dict
[
k
]
=
v
return
not_translated_message_dict
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
View file @
a12f1c00
...
...
@@ -60,7 +60,7 @@ mode_dict = {
}
if
mode
not
in
mode_dict
:
return
"Used Mode is not defined in the mode list %s"
%
mode_dict
.
keys
(
)
return
"Used Mode is not defined in the mode list %s"
%
list
(
mode_dict
.
keys
()
)
# Check JSON Form
try
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_api_style/TestTemplateItem/portal_components/test.erp5.testJioApiStyle.py
View file @
a12f1c00
...
...
@@ -31,6 +31,7 @@ import json
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
six
class
TestjIOApiStyle
(
ERP5TypeTestCase
):
...
...
@@ -77,7 +78,7 @@ class TestjIOApiStyle(ERP5TypeTestCase):
"alldocs"
:
"object_json_api_all_docs"
,
"get"
:
"object_json_api_get"
,
}
for
key
,
action_type
in
s
elf
.
action_type_dict
.
iteritems
(
):
for
key
,
action_type
in
s
ix
.
iteritems
(
self
.
action_type_dict
):
self
.
updateCreateActionType
(
action_type
)
self
.
api_web_section
.
setProperty
(
"configuration_%s_action_type"
%
key
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.SimulatedDeliveryBuilder.py
View file @
a12f1c00
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from
erp5.component.mixin.BuilderMixin
import
BuilderMixin
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.CopySupport
import
CopyError
,
tryMethodCallWithTemporaryPermission
import
six
class
SimulatedDeliveryBuilder
(
BuilderMixin
):
...
...
@@ -202,7 +203,7 @@ class SimulatedDeliveryBuilder(BuilderMixin):
if
property_dict
in
(
None
,
{}):
return
delivery
=
self
.
getPortalObject
().
restrictedTraverse
(
delivery_relative_url
)
for
(
prop
,
value
)
in
property_dict
.
iteritems
(
):
for
(
prop
,
value
)
in
six
.
iteritems
(
property_dict
):
delivery
.
setPropertyList
(
prop
,
value
)
# Try to remove existing properties/categories from Movements that
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.BuilderMixin.py
View file @
a12f1c00
...
...
@@ -39,6 +39,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from
erp5.component.module.ExplanationCache
import
_getExplanationCache
from
DateTime
import
DateTime
from
Acquisition
import
aq_parent
,
aq_inner
import
six
class
CollectError
(
Exception
):
pass
class
MatrixError
(
Exception
):
pass
...
...
@@ -336,7 +337,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
edit_order
=
[]
property_dict
=
{
'edit_order'
:
edit_order
}
for
d
in
property_dict_list
:
for
k
,
v
in
d
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
d
):
if
k
in
property_dict
:
raise
DuplicatedPropertyDictKeysError
(
k
)
property_dict
[
k
]
=
v
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPrimaryGroup.py
View file @
a12f1c00
...
...
@@ -33,7 +33,7 @@ for assignment in context.contentValues(portal_type='Assignment'):
# If we have multiple groups defined on assignments, this scripts does not
# try to guess, and fallback to the default career's group
if
len
(
existing_group_set
.
keys
())
==
1
:
return
existing_group_set
.
keys
(
)[
0
]
return
list
(
existing_group_set
.
keys
()
)[
0
]
# no group found on open assignments, returns the default group
# (on a person document this is acquired on the default career's subordination)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetLine.py
View file @
a12f1c00
...
...
@@ -35,6 +35,7 @@ from Products.ERP5Type.Core.Predicate import Predicate
from
Products.ERP5.mixin.variated
import
VariatedMixin
from
Products.ERP5Type.Cache
import
transactional_cached
from
ZTUtils
import
make_query
import
six
class
TempBudgetCell
(
object
):
__allow_access_to_unprotected_subobjects__
=
1
...
...
@@ -118,7 +119,7 @@ class BudgetLine(Predicate, XMLMatrix, VariatedMixin):
the value is the engaged budget.
"""
budget_dict
=
{
k
:
v
*
-
1
for
k
,
v
in
s
elf
.
getEngagedBudgetDict
(
**
kw
).
iteritems
(
)}
for
k
,
v
in
s
ix
.
iteritems
(
self
.
getEngagedBudgetDict
(
**
kw
)
)}
cell_key_list
=
self
.
getCellKeyList
()
for
cell_key
in
cell_key_list
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_commerce_loyalty_program/DocumentTemplateItem/portal_components/document.erp5.LoyaltyTransactionSimulationRule.py
View file @
a12f1c00
...
...
@@ -38,6 +38,7 @@ from Acquisition import aq_base
from
erp5.component.interface.IRule
import
IRule
from
erp5.component.interface.IDivergenceController
import
IDivergenceController
from
erp5.component.interface.IMovementCollectionUpdater
import
IMovementCollectionUpdater
import
six
@
zope
.
interface
.
implementer
(
IRule
,
IDivergenceController
,
...
...
@@ -107,7 +108,7 @@ class LoyaltyTransactionRuleMovementGenerator(MovementGeneratorMixin):
# Only take loyalty trade model line
if
amount
.
getResource
()
and
[
x
for
x
in
amount
.
getBaseApplicationList
()
if
x
in
[
'base_amount/loyalty_program/collect_point'
,
'base_amount/loyalty_program/using_point'
]]:
movement
=
input_movement
.
asContext
(
**
{
k
:
v
for
k
,
v
in
amount
.
__dict__
.
iteritems
(
)
for
k
,
v
in
six
.
iteritems
(
amount
.
__dict__
)
if
k
[
0
]
!=
'_'
and
k
!=
'categories'
})
base_category_set
=
set
([
x
for
x
in
amount
.
getBaseCategoryList
()
if
x
not
in
(
'price_currency'
)])
movement
.
_setCategoryMembership
(
base_category_set
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_computer_immobilisation/DocumentTemplateItem/portal_components/document.erp5.InternetProtocolAddress.py
View file @
a12f1c00
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.Utils import convertToUpperCase
from
Products.ERP5Type.Utils
import
deprecated
from
erp5.component.document.Coordinate
import
Coordinate
import
six
class
InternetProtocolAddress
(
Coordinate
):
"""
...
...
@@ -95,7 +96,7 @@ class InternetProtocolAddress(Coordinate):
self
.
_setCoordinateText
(
coordinate_text
)
kw_dict
=
self
.
_splitCoordinateText
(
coordinate_text
)
for
name
,
value
in
kw_dict
.
iteritems
(
):
for
name
,
value
in
six
.
iteritems
(
kw_dict
):
setter_name
=
'set%s'
%
convertToUpperCase
(
name
)
setter_method
=
getattr
(
self
,
setter_name
)
setter_method
(
value
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_computer_immobilisation/TestTemplateItem/portal_components/test.erp5.testComputerWithComputerModel.py
View file @
a12f1c00
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
six
class
TestComputerWithComputerModel
(
ERP5TypeTestCase
):
def
afterSetUp
(
self
):
...
...
@@ -116,7 +117,7 @@ class TestComputerWithComputerModel(ERP5TypeTestCase):
model
=
self
.
newModel
(
**
category_dict
)
category_list
=
[]
for
k
,
v
in
category_dict
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
category_dict
):
for
l
in
v
:
category_list
.
append
(
'%s/%s'
%
(
k
,
l
))
category_list
.
append
(
'specialise/%s'
%
model
.
getRelativeUrl
())
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
View file @
a12f1c00
...
...
@@ -34,6 +34,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.mixin.ConfiguratorItemMixin
import
ConfiguratorItemMixin
from
erp5.component.interface.IConfiguratorItem
import
IConfiguratorItem
import
six
class
UnrestrictedStringIO
(
StringIO
):
...
...
@@ -149,7 +150,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
category_path_dict
=
{
item
[
'path'
]:
item
for
item
in
cache
[
base_category_id
]}
for
path
in
category_path_dict
.
iterkeys
(
):
for
path
in
six
.
iterkeys
(
category_path_dict
):
# the first item in this list is the base category itself, so we skip it.
if
path
==
base_category_id
:
continue
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.SolverConfiguratorItem.py
View file @
a12f1c00
...
...
@@ -32,6 +32,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.mixin.ConfiguratorItemMixin
import
ConfiguratorItemMixin
from
erp5.component.interface.IConfiguratorItem
import
IConfiguratorItem
import
six
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
...
...
@@ -66,7 +67,7 @@ class SolverConfiguratorItem(ConfiguratorItemMixin, XMLObject):
property_dict
=
solver_property_dict
.
get
(
self
.
getId
())
argument_dict
=
{}
for
k
,
v
in
property_dict
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
property_dict
):
if
k
not
in
(
"content_list"
,)
and
k
in
self
.
showDict
():
argument_dict
[
k
]
=
v
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateObjectStructure.py
View file @
a12f1c00
...
...
@@ -137,7 +137,7 @@ for i in range(len(ordered_items)):
# item is level-coherent, so keep it
if
item_ok
==
True
:
# add to the clean list
clean_data
.
append
(
current_item_data
.
values
(
)[
0
])
clean_data
.
append
(
list
(
current_item_data
.
values
()
)[
0
])
# add to the processed list of level
processed_level
.
append
(
current_item_level
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/MixinTemplateItem/portal_components/mixin.erp5.TestWorkflowMixin.py
View file @
a12f1c00
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
six
class
TestWorkflowMixin
(
ERP5TypeTestCase
):
def
getWorklistDocumentCountFromActionName
(
self
,
action_name
):
...
...
@@ -35,7 +36,7 @@ class TestWorkflowMixin(ERP5TypeTestCase):
selection_name
=
getattr
(
self
,
'module_selection_name'
,
None
)
if
selection_name
is
not
None
:
selection_parameter_dict
=
self
.
portal
.
portal_selections
.
getSelectionParamsFor
(
selection_name
)
for
parameter
,
value
in
url_parameter_dict
.
iteritems
(
):
for
parameter
,
value
in
six
.
iteritems
(
url_parameter_dict
):
self
.
assertIn
(
parameter
,
selection_parameter_dict
)
self
.
assertEqual
(
value
,
selection_parameter_dict
[
parameter
])
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
a12f1c00
...
...
@@ -48,6 +48,7 @@ import glob
import
sys
from
OFS.Image
import
Pdata
from
six.moves
import
range
import
six
WORKFLOW_TYPE
=
'erp5_workflow'
...
...
@@ -979,8 +980,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertIsNotNone
(
form
)
group_dict
=
sequence
.
get
(
'group_dict'
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
(
group_dict
.
iterkeys
(
)))
for
group
in
group_dict
.
iterkeys
(
):
sorted
(
six
.
iterkeys
(
group_dict
)))
for
group
in
six
.
iterkeys
(
group_dict
):
id_list
=
[]
for
field
in
form
.
get_fields_in_group
(
group
):
id_list
.
append
(
field
.
getId
())
...
...
@@ -2720,7 +2721,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
for
item_name
in
item_list
:
item
=
getattr
(
bt
,
item_name
)
if
item
is
not
None
:
for
data
in
item
.
_objects
.
itervalues
(
):
for
data
in
six
.
itervalues
(
item
.
_objects
):
if
hasattr
(
data
,
'__ac_local_roles__'
):
self
.
assertTrue
(
data
.
__ac_local_roles__
is
None
)
if
hasattr
(
data
,
'_owner'
):
...
...
@@ -3313,7 +3314,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
copied
,
=
template_tool
.
manage_pasteObjects
(
cb_data
)
current
=
current_bt
.
_property_sheet_item
.
_objects
.
copy
()
current_bt
.
_property_sheet_item
.
_objects
=
PersistentMapping
()
for
k
,
v
in
current
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
current
):
k
=
k
.
lstrip
(
'portal_property_sheets/'
)
current_bt
.
_property_sheet_item
.
_objects
[
k
]
=
v
sequence
.
edit
(
current_bt
=
template_tool
.
_getOb
(
copied
[
'new_id'
]))
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
View file @
a12f1c00
...
...
@@ -36,6 +36,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
FileUpload
from
AccessControl.SecurityManagement
import
newSecurityManager
import
six
class
TestERP5Base
(
ERP5TypeTestCase
):
"""ERP5 Base tests.
...
...
@@ -1910,7 +1911,7 @@ class TestERP5Base(ERP5TypeTestCase):
assertPublishedHeaderEqual
(
portal
,
header_name
,
script_value
)
assertPublishedHeaderEqual
(
person_module
,
header_name
,
script_value
+
', '
+
other_value
)
finally
:
for
document
,
header_name_set
in
response_header_dict
.
iteritems
(
):
for
document
,
header_name_set
in
six
.
iteritems
(
response_header_dict
):
for
header_name
in
header_name_set
:
try
:
document
.
deleteResponseHeaderRule
(
header_name
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
a12f1c00
...
...
@@ -66,7 +66,7 @@ def format_stack(thread=None):
thread_id
,
' '
.
join
(
traceback
.
format_stack
(
frame
)),
)
for
thread_id
,
frame
in
frame_dict
.
iteritems
(
)
for
thread_id
,
frame
in
six
.
iteritems
(
frame_dict
)
))
finally
:
del
frame
,
frame_dict
...
...
@@ -350,7 +350,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
activity_tool
.
distribute
()
# XXX: duplicate ActivityTool.tic, without locking as we are being
# multiple activity nodes in a single process.
for
activity
in
ActivityTool
.
activity_dict
.
itervalues
(
):
for
activity
in
six
.
itervalues
(
ActivityTool
.
activity_dict
):
while
not
activity
.
dequeueMessage
(
activity_tool
,
node_id
,
()):
pass
# Monkey-patch catalog to synchronise between main thread and the
...
...
@@ -2093,7 +2093,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
def
newContent
(
container
,
portal_type
,
acquire_view_permission
,
view_role_list
,
local_role_dict
):
document
=
container
.
newContent
(
portal_type
=
portal_type
)
document
.
manage_permission
(
'View'
,
roles
=
view_role_list
,
acquire
=
acquire_view_permission
)
for
user
,
role_list
in
local_role_dict
.
iteritems
(
):
for
user
,
role_list
in
six
.
iteritems
(
local_role_dict
):
document
.
manage_setLocalRoles
(
userid
=
user
,
roles
=
role_list
)
return
document
...
...
@@ -2108,7 +2108,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
return
(
portal_type
,
acquire_view_permission
,
tuple
(
view_role_list
),
tuple
([(
x
,
tuple
(
y
))
for
x
,
y
in
local_role_dict
.
iteritems
(
)])
for
x
,
y
in
six
.
iteritems
(
local_role_dict
)])
)
for
container
,
portal_type
in
((
person_module
,
person
),
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFields.py
View file @
a12f1c00
...
...
@@ -54,6 +54,7 @@ from DateTime import DateTime
import
lxml.html
from
Products.Formulator.Widget
import
NSMAP
import
six
ODG_XML_WRAPPING_XPATH
=
'draw:text-box/text:p/text:span'
class
TestRenderViewAPI
(
ERP5TypeTestCase
):
...
...
@@ -65,7 +66,7 @@ class TestRenderViewAPI(ERP5TypeTestCase):
return
"{Field,Widget}.render_view"
def
test_signature
(
self
):
for
field
in
FieldRegistry
.
get_field_classes
().
itervalues
(
):
# pylint: disable=no-value-for-parameter
for
field
in
six
.
itervalues
(
FieldRegistry
.
get_field_classes
()
):
# pylint: disable=no-value-for-parameter
self
.
assertEqual
((
'self'
,
'value'
,
'REQUEST'
,
'render_prefix'
),
field
.
render_view
.
__func__
.
__code__
.
co_varnames
)
if
field
is
not
ProxyField
:
...
...
@@ -1134,7 +1135,7 @@ class TestFieldValueCache(ERP5TypeTestCase):
def
_getCacheSize
(
self
,
cache_id
):
count
=
0
for
cache_key
in
field_value_cache
.
iterkeys
(
):
for
cache_key
in
six
.
iterkeys
(
field_value_cache
):
if
cache_key
[
0
]
==
cache_id
:
count
+=
1
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
View file @
a12f1c00
...
...
@@ -35,6 +35,7 @@ from Products.ERP5Type.Utils import ScalarMaxConflictResolver
from
BTrees.Length
import
Length
from
BTrees.OOBTree
import
OOBTree
from
six.moves
import
range
import
six
class
TestIdToolUpgrade
(
ERP5TypeTestCase
):
...
...
@@ -138,7 +139,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
del
id_tool
.
__class__
.
getTypeInfo
bt
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplate
(
'erp5_core'
,
strict
=
True
)
for
path
,
obj
in
bt
.
_path_item
.
_objects
.
iteritems
(
):
for
path
,
obj
in
six
.
iteritems
(
bt
.
_path_item
.
_objects
):
path
,
obj_id
=
path
.
rsplit
(
'/'
,
1
)
if
path
==
'portal_ids'
:
id_tool
.
_setObject
(
obj_id
,
obj
.
_getCopy
(
bt
))
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
View file @
a12f1c00
...
...
@@ -173,7 +173,7 @@ class TestPasswordTool(ERP5TypeTestCase):
We don't check use of random url in mail here as we have on request
But random is also check by changeUserPassword, so it's the same
"""
key
=
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
(
)[
0
]
key
=
list
(
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
()
)[
0
]
self
.
portal
.
portal_password
.
changeUserPassword
(
user_login
=
"userA-login"
,
password
=
"secret"
,
password_confirmation
=
"secret"
,
...
...
@@ -186,7 +186,7 @@ class TestPasswordTool(ERP5TypeTestCase):
Call method that change the password with a bad user name
This must not work
"""
key
=
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
(
)[
0
]
key
=
list
(
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
()
)[
0
]
sequence
.
edit
(
key
=
key
)
self
.
portal
.
portal_password
.
changeUserPassword
(
user_login
=
"userZ-login"
,
password
=
"secret"
,
...
...
@@ -224,7 +224,7 @@ class TestPasswordTool(ERP5TypeTestCase):
Change expiration date so that reset of password is not available
"""
# save key for url
key
=
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
(
)[
0
]
key
=
list
(
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
()
)[
0
]
sequence
.
edit
(
key
=
key
)
# modify date
for
k
,
v
in
self
.
portal
.
portal_password
.
_password_request_dict
.
items
():
...
...
@@ -336,7 +336,7 @@ class TestPasswordTool(ERP5TypeTestCase):
self
.
assertEqual
(
0
,
len
(
self
.
portal
.
portal_password
.
_password_request_dict
))
self
.
portal
.
portal_password
.
mailPasswordResetRequest
(
user_login
=
"userA-login"
)
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_password
.
_password_request_dict
))
key_a
=
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
(
)[
0
]
key_a
=
list
(
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
()
)[
0
]
self
.
tic
()
self
.
portal
.
portal_password
.
mailPasswordResetRequest
(
user_login
=
"userB-login"
)
...
...
@@ -391,7 +391,7 @@ class TestPasswordTool(ERP5TypeTestCase):
self
.
portal
.
portal_password
.
mailPasswordResetRequest
(
user_login
=
"userZ-login "
)
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_password
.
_password_request_dict
))
key_a
=
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
(
)[
0
]
key_a
=
list
(
self
.
portal
.
portal_password
.
_password_request_dict
.
keys
()
)[
0
]
self
.
tic
()
self
.
_assertUserExists
(
'userZ-login '
,
'passwordZ'
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
View file @
a12f1c00
...
...
@@ -29,6 +29,7 @@
from
erp5.component.mixin.TestWorkflowMixin
import
TestWorkflowMixin
from
Products.ERP5Type.tests.utils
import
todo_erp5
import
six
class
TestWorklist
(
TestWorkflowMixin
):
...
...
@@ -179,7 +180,7 @@ class TestWorklist(TestWorkflowMixin):
if
v
:
worklist_value
.
setCriterion
(
SECURITY_PARAMETER_ID
,
[
var
.
strip
()
for
var
in
v
.
split
(
';'
)])
for
k
,
v
in
kw
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
kw
):
if
k
not
in
(
SECURITY_PARAMETER_ID
,
workflow_value
.
getStateVariable
()):
variable_value
=
workflow_value
.
getVariableValueByReference
(
k
)
if
variable_value
is
None
:
...
...
@@ -194,7 +195,7 @@ class TestWorklist(TestWorkflowMixin):
worklist_value
.
setProperties
(
''
,
actbox_name
=
'%s (%%(count)s)'
%
actbox_name
,
actbox_url
=
actbox_url
,
props
=
{
k
if
k
.
startswith
(
'guard_'
)
else
'var_match_'
+
k
:
v
for
k
,
v
in
kw
.
iteritems
(
)})
for
k
,
v
in
six
.
iteritems
(
kw
)})
def
removeWorklist
(
self
,
workflow_id
,
worklist_id_list
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testERP5WebWithCRM.py
View file @
a12f1c00
...
...
@@ -31,6 +31,7 @@ import unittest
import
transaction
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
six
class
TestERP5WebWithCRM
(
ERP5TypeTestCase
):
...
...
@@ -96,7 +97,7 @@ class TestERP5WebWithCRM(ERP5TypeTestCase):
# Now a web message has been created
telephone_key
=
'source_person_default_telephone_text'
event
=
self
.
portal
.
event_module
.
objectValues
()[
0
]
for
property_id
,
value
in
form_kw
.
iteritems
(
):
for
property_id
,
value
in
six
.
iteritems
(
form_kw
):
if
property_id
==
telephone_key
:
value
=
'+(0)-%s'
%
value
...
...
@@ -177,7 +178,7 @@ class TestERP5WebWithCRM(ERP5TypeTestCase):
telephone_key
=
"source_person_default_telephone_text"
# Now a web message has been created
event
=
self
.
portal
.
event_module
.
objectValues
()[
0
]
for
property_id
,
value
in
form_kw
.
iteritems
(
):
for
property_id
,
value
in
six
.
iteritems
(
form_kw
):
if
property_id
==
telephone_key
:
value
=
'+(0)-%s'
%
value
self
.
assertEqual
(
event
.
getProperty
(
property_id
),
value
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py
View file @
a12f1c00
...
...
@@ -27,6 +27,7 @@ from IPython.core.pylabtools import print_figure
from
IPython.core.display
import
_pngxy
from
ipykernel.jsonutil
import
json_clean
,
encode_images
import
threading
import
six
display_data_wrapper_lock
=
threading
.
Lock
()
# Well known unserializable types
...
...
@@ -415,13 +416,13 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
# Removing all the setup functions if user call environment.clearAll()
if
environment_collector
.
clearAll
():
keys
=
notebook_context
[
'setup'
].
keys
(
)
keys
=
list
(
notebook_context
[
'setup'
].
keys
()
)
for
key
in
keys
:
del
notebook_context
[
'setup'
][
key
]
# Running all the setup functions that we got
failed_setup_key_list
=
[]
for
key
,
value
in
notebook_context
[
'setup'
].
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
notebook_context
[
'setup'
]
):
try
:
code
=
compile
(
value
[
'code'
],
'<string>'
,
'exec'
)
exec
(
code
,
user_context
,
user_context
)
...
...
@@ -440,7 +441,7 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
# Iterating over envinronment.define calls captured by the environment collector
# that are functions and saving them as setup functions.
for
func_name
,
data
in
current_setup_dict
.
iteritems
(
):
for
func_name
,
data
in
six
.
iteritems
(
current_setup_dict
):
setup_string
=
(
"%s
\
n
"
"_result = %s()
\
n
"
...
...
@@ -455,7 +456,7 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
# Iterating over envinronment.define calls captured by the environment collector
# that are simple variables and saving them in the setup.
for
variable
,
value
,
in
current_var_dict
.
iteritems
(
):
for
variable
,
value
,
in
six
.
iteritems
(
current_var_dict
):
setup_string
=
"%s = %s
\
n
"
%
(
variable
,
repr
(
value
))
notebook_context
[
'setup'
][
variable
]
=
{
'func_name'
:
variable
,
...
...
@@ -558,7 +559,7 @@ def canSerialize(obj):
if
isinstance
(
obj
,
container_type_tuple
):
if
isinstance
(
obj
,
dict
):
result_list
=
[]
for
key
,
value
in
obj
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
obj
):
result_list
.
append
(
canSerialize
(
key
))
result_list
.
append
(
canSerialize
(
value
))
else
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_data_protection/TestTemplateItem/portal_components/test.erp5.testDataProtection.py
View file @
a12f1c00
...
...
@@ -114,7 +114,7 @@ class TestDataProtection(ERP5TypeTestCase):
data_protection
=
portal
.
restrictedTraverse
(
sequence
.
get
(
'data_protection_request_relative_url'
))
portal
.
portal_selections
.
setSelectionCheckedUidsFor
(
self
.
selection_name
,
self
.
document_edit_kw
.
keys
(
))
list
(
self
.
document_edit_kw
.
keys
()
))
# False means keep workflow history comments
data_protection
.
DataProtectionRequest_eraseSomeOriginalData
(
'View'
,
False
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
View file @
a12f1c00
...
...
@@ -927,7 +927,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'%s "%s"'
%
(
kw
[
'searchabletext_any'
],
kw
[
'searchabletext_phrase'
]),
\
search_string
)
parsed_string
=
parse
(
search_string
)
self
.
assertEqual
([
'searchabletext'
],
parsed_string
.
keys
(
))
self
.
assertEqual
([
'searchabletext'
],
list
(
parsed_string
.
keys
()
))
# search "with all of the words"
...
...
@@ -936,7 +936,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2'
,
\
search_string
)
parsed_string
=
parse
(
search_string
)
self
.
assertEqual
([
'searchabletext'
],
parsed_string
.
keys
(
))
self
.
assertEqual
([
'searchabletext'
],
list
(
parsed_string
.
keys
()
))
# search without these words
kw
[
"searchabletext_without"
]
=
"searchabletext_without1 searchabletext_without2"
...
...
@@ -944,7 +944,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2'
,
\
search_string
)
parsed_string
=
parse
(
search_string
)
self
.
assertEqual
([
'searchabletext'
],
parsed_string
.
keys
(
))
self
.
assertEqual
([
'searchabletext'
],
list
(
parsed_string
.
keys
()
))
# search limited to a certain date range
kw
[
'created_within'
]
=
'1w'
...
...
@@ -952,7 +952,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w'
,
\
search_string
)
parsed_string
=
parse
(
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
],
parsed_string
.
keys
(
))
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
],
list
(
parsed_string
.
keys
()
))
# search with portal_type
kw
[
'search_portal_type'
]
=
'Document'
...
...
@@ -961,7 +961,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document)'
,
\
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
# search by reference
...
...
@@ -971,7 +971,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test'
,
\
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
...
...
@@ -982,7 +982,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w AND (portal_type:Document) reference:Nxd-test version:001'
,
\
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
'version'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -995,7 +995,7 @@ class TestDocument(TestDocumentMixin):
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
\
'version'
,
'language'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -1009,7 +1009,7 @@ class TestDocument(TestDocumentMixin):
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
\
'version'
,
'language'
,
'contributor_title'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -1023,7 +1023,7 @@ class TestDocument(TestDocumentMixin):
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
\
'version'
,
'language'
,
'contributor_title'
,
'mine'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -1038,7 +1038,7 @@ class TestDocument(TestDocumentMixin):
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
\
'version'
,
'language'
,
'contributor_title'
,
'mine'
,
'newest'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -1054,7 +1054,7 @@ class TestDocument(TestDocumentMixin):
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'creation_from'
,
'portal_type'
,
'reference'
,
\
'version'
,
'language'
,
'contributor_title'
,
'mine'
,
'newest'
,
'mode'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
self
.
assertEqual
(
kw
[
'search_portal_type'
],
parsed_string
[
'portal_type'
])
self
.
assertEqual
(
kw
[
'reference'
],
parsed_string
[
'reference'
])
self
.
assertEqual
(
kw
[
'version'
],
parsed_string
[
'version'
])
...
...
@@ -1071,7 +1071,7 @@ class TestDocument(TestDocumentMixin):
self
.
assertEqual
(
'erp5 AND (portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page")'
,
\
search_string
)
self
.
assertSameSet
([
'searchabletext'
,
'portal_type'
],
\
parsed_string
.
keys
(
))
list
(
parsed_string
.
keys
()
))
#self.assertEqual(kw['search_portal_type'], parsed_string['portal_type'])
# parse with multiple portal_type containing spaces in one portal_type
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
View file @
a12f1c00
...
...
@@ -43,6 +43,7 @@ from erp5.component.module.WorkingCopy import \
from
erp5.component.module.SubversionClient
import
newSubversionClient
from
six
import
string_types
as
basestring
from
six.moves
import
range
import
six
# XXX This does not work with concurrent processes/threads accessing the
# same working copy...
...
...
@@ -415,7 +416,7 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
shutil.rmtree(x)
# Remove deleted files/dirs
self.client.remove([k for k, v in s
elf.versioned_dict.iteritems(
)
self.client.remove([k for k, v in s
ix.iteritems(self.versioned_dict
)
if v is not None and self.versioned_dict[os.path.dirname(k)] is None])
# Add new files/dirs
self.client.add([x for x in self.added_set
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
View file @
a12f1c00
from
Products.PythonScripts.standard
import
html_quote
import
six
portal
=
context
.
getPortalObject
()
skin_folder
=
portal
.
portal_skins
[
original_skin_name
]
new_skin_folder
=
portal
.
portal_skins
[
new_skin_name
]
...
...
@@ -41,7 +42,7 @@ for original_form in skin_folder.objectValues():
map
(
html_quote
,
(
'[%s]'
%
key
if
T
else
key
,
str
(
old
),
str
(
new
[
key
]))))
for
T
,
old
,
new
in
((
0
,
original_value_dict
,
new_value_dict
),
(
1
,
original_value_tales
,
new_value_tales
))
for
key
,
old
in
old
.
iteritems
(
)
for
key
,
old
in
six
.
iteritems
(
old
)
if
old
!=
new
[
key
])
output_append
(
"</table></blockquote><p>"
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_viewSimulationTree.py
View file @
a12f1c00
import
six
# License: GPL
# Author: Lukasz Nowak <lukasz.nowak@ventis.com.pl>
# Copyright 2007 Ventis s. c.
...
...
@@ -7,7 +8,7 @@ simulations_found = context.Base_getSimulationTree(start_path=start_path)
if
len
(
simulations_found
)
==
0
:
print
'No simulations related'
else
:
for
simulation_root
in
si
mulations_found
.
iterkeys
(
):
for
simulation_root
in
si
x
.
iterkeys
(
simulations_found
):
print
simulation_root
for
simulation
in
simulations_found
[
simulation_root
]:
print
'
\
t
'
,
simulation
.
getPath
(),
simulation
.
getPortalType
(),
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_immobilisation/TestTemplateItem/portal_components/test.erp5.testImmobilisation.py
View file @
a12f1c00
...
...
@@ -2057,7 +2057,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
e_movement
=
e_simulation_movement_list
[
e_cursor
]
wrong_movement
=
0
key_cursor
=
0
key_list
=
e_movement
.
keys
(
)
key_list
=
list
(
e_movement
.
keys
()
)
key_list
.
remove
(
'id'
)
while
key_cursor
<
len
(
key_list
)
and
not
wrong_movement
:
key
=
key_list
[
key_cursor
]
...
...
@@ -2895,7 +2895,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
e_transaction
=
e_transaction_list
[
e_cursor
]
wrong_transaction
=
0
key_cursor
=
0
key_list
=
e_transaction
.
keys
(
)
key_list
=
list
(
e_transaction
.
keys
()
)
if
'line_list'
in
key_list
:
key_list
.
remove
(
'line_list'
)
if
'id'
in
key_list
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.py
View file @
a12f1c00
...
...
@@ -3,6 +3,7 @@ Gets document properties discovered from the user who contributes / owns the doc
User would be usually the current user, but sometimes the name has to be given explicitly
if e.g. the doc is contributed by email, and the script is run by zope user.
"""
import
six
assignment_dict
=
context
.
ERP5Site_getPersonAssignmentDict
(
user_name
=
user_name
)
group_list
=
assignment_dict
[
'group_list'
]
...
...
@@ -15,7 +16,7 @@ if group_list:
#Get the highest levels groups of the assignments
##if group_list = ['g1', 'g1/g1.1', 'g1/g1.2'] returns ['g1']
##if group_list = ['g1/g1.1', 'g1/g1.2'] returns ['g1/g1.1', 'g1/g1.2']
highest_level_group_value
=
min
(
group_level_dict
.
itervalues
(
))
highest_level_group_value
=
min
(
six
.
itervalues
(
group_level_dict
))
highest_level_group_list
=
[
k
for
k
in
group_level_dict
if
group_level_dict
[
k
]
==
highest_level_group_value
]
return
{
'group_list'
:
highest_level_group_list
}
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion/ToolComponentTemplateItem/portal_components/tool.erp5.UrlRegistryTool.py
View file @
a12f1c00
...
...
@@ -35,6 +35,7 @@ from Acquisition import Implicit
from
BTrees.OOBTree
import
OOBTree
from
warnings
import
warn
from
six.moves
import
range
import
six
ACTIVITY_GROUPING_COUNT
=
200
...
...
@@ -151,7 +152,7 @@ class UrlRegistryTool(BaseTool):
warn
(
'context argument ignored'
,
DeprecationWarning
)
mapping
=
self
.
_getMappingDict
()
url_list
=
[]
for
url
,
stored_reference
in
mapping
.
iteritems
(
):
for
url
,
stored_reference
in
six
.
iteritems
(
mapping
):
if
reference
==
stored_reference
:
url_list
.
append
(
url
)
return
url_list
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_inotify/ToolComponentTemplateItem/portal_components/tool.erp5.InotifyTool.py
View file @
a12f1c00
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.TransactionalVariable import TransactionalResource
from
Products.ERP5.mixin.timer_service
import
TimerServiceMixin
from
AccessControl.SecurityManagement
import
newSecurityManager
,
\
getSecurityManager
,
setSecurityManager
import
six
# TODO: Current API was designed to avoid compability issues in case it is
# reimplemented using https://pypi.python.org/pypi/pyinotify
...
...
@@ -95,7 +96,7 @@ class InotifyTool(TimerServiceMixin, BaseTool):
update_state_dict
[
path
]
=
new_state
events
=
[{
'path'
:
p
,
'mask'
:
IN_DELETE
}
for
p
in
set
(
state
).
difference
(
new_state
)]
for
p
,
m
in
new_state
.
iteritems
(
):
for
p
,
m
in
six
.
iteritems
(
new_state
):
if
p
in
state
:
if
m
==
state
[
p
]:
continue
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_interfaces/DocumentTemplateItem/portal_components/document.erp5.SOAPBinding.py
View file @
a12f1c00
...
...
@@ -30,6 +30,7 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
PropertySheet
from
Products.ERP5Type.Permissions
import
AccessContentsInformation
from
Products.ERP5Type.Base
import
Base
import
six
try
:
from
spyne
import
MethodContext
except
ImportError
:
...
...
@@ -65,7 +66,7 @@ class SOAPBinding(Base):
@
classmethod
def
getRegisteredServiceClassItemList
(
cls
):
return
sorted
((
'%s (%s)'
%
(
v
.
__name__
,
v
.
__module__
),
k
)
for
k
,
v
in
cls
.
_service_class_dict
.
iteritems
(
))
for
k
,
v
in
six
.
iteritems
(
cls
.
_service_class_dict
))
security
.
declarePrivate
(
'getListItemUrl'
)
def
getListItemUrl
(
self
,
*
args
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_invoicing/DocumentTemplateItem/portal_components/document.erp5.TradeModelSimulationRule.py
View file @
a12f1c00
...
...
@@ -37,6 +37,7 @@ from erp5.component.mixin.MovementCollectionUpdaterMixin import \
from
erp5.component.interface.IRule
import
IRule
from
erp5.component.interface.IDivergenceController
import
IDivergenceController
from
erp5.component.interface.IMovementCollectionUpdater
import
IMovementCollectionUpdater
import
six
@
zope
.
interface
.
implementer
(
IRule
,
IDivergenceController
,
...
...
@@ -100,7 +101,7 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
# FIXME: Is it the right way to have source/destination and other
# non-Amount properties set on the generated movement ?
movement
=
input_movement
.
asContext
(
**
{
k
:
v
for
k
,
v
in
amount
.
__dict__
.
iteritems
(
)
for
k
,
v
in
six
.
iteritems
(
amount
.
__dict__
)
if
k
[
0
]
!=
'_'
and
k
!=
'categories'
})
base_category_set
=
set
(
amount
.
getBaseCategoryList
())
base_category_set
.
remove
(
'price_currency'
)
# XXX
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_invoicing/ModuleComponentTemplateItem/portal_components/module.erp5.TestInvoiceMixin.py
View file @
a12f1c00
...
...
@@ -34,6 +34,7 @@ from Acquisition import aq_parent
from
zLOG
import
LOG
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
erp5.component.test.testPackingList
import
TestPackingListMixin
import
six
class
TestInvoiceMixin
(
TestPackingListMixin
):
"""Test methods for invoices
...
...
@@ -1046,7 +1047,7 @@ class TestInvoiceMixin(TestPackingListMixin):
"""
rule_type
=
rule
.
getSpecialiseValue
().
getPortalType
()
rule_def
=
rule_dict
.
get
(
rule_type
,
{})
for
k
,
v
in
rule_def
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
rule_def
):
if
k
==
'movement_type_list'
:
for
movement
in
rule
.
objectValues
():
if
movement
.
getDeliveryValue
()
is
not
None
:
...
...
@@ -1067,7 +1068,7 @@ class TestInvoiceMixin(TestPackingListMixin):
# for each movement, we want to make sure that each rule is not
# instanciated more than once
if
len
(
found_rule_dict
):
self
.
assertEqual
(
set
(
found_rule_dict
.
itervalues
(
)),
{
1
})
self
.
assertEqual
(
set
(
six
.
itervalues
(
found_rule_dict
)),
{
1
})
elif
k
==
'parent_movement_type_list'
:
if
rule
.
getParentValue
().
getDeliveryValue
()
is
not
None
:
parent_type
=
rule
.
getParentValue
().
getDeliveryValue
().
getPortalType
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_mrp/DocumentTemplateItem/portal_components/document.erp5.TransformationSimulationRule.py
View file @
a12f1c00
...
...
@@ -34,6 +34,7 @@ from erp5.component.mixin.RuleMixin import RuleMixin
from
erp5.component.mixin.MovementGeneratorMixin
import
MovementGeneratorMixin
from
erp5.component.mixin.MovementCollectionUpdaterMixin
import
\
MovementCollectionUpdaterMixin
import
six
class
TransformationSimulationRule
(
RuleMixin
,
MovementCollectionUpdaterMixin
):
"""
...
...
@@ -138,7 +139,7 @@ class TransformationRuleMovementGenerator(MovementGeneratorMixin):
# FIXME: Is it the right way to have source/destination and other
# non-Amount properties set on the generated movement ?
movement
=
newMovement
(
amount
.
getCausality
(),
dict
((
k
,
v
)
for
k
,
v
in
amount
.
__dict__
.
iteritems
(
)
for
k
,
v
in
six
.
iteritems
(
amount
.
__dict__
)
if
k
[
0
]
!=
'_'
and
k
!=
'categories'
))
base_category_set
=
set
(
amount
.
getBaseCategoryList
())
base_category_set
.
remove
(
'price_currency'
)
# XXX
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_mrp/TestTemplateItem/portal_components/test.erp5.testMRP.py
View file @
a12f1c00
...
...
@@ -30,6 +30,7 @@ import unittest
from
DateTime
import
DateTime
from
erp5.component.test.testBPMCore
import
TestBPMMixin
from
six.moves
import
range
import
six
class
TestMRPMixin
(
TestBPMMixin
):
...
...
@@ -279,7 +280,7 @@ class TestMRPMixin(TestBPMMixin):
group_by_variation
=
1
):
self
.
assertEqual
(
expected_dict
.
pop
((
r
.
node_uid
,
r
.
variation_text
),
0
),
r
.
inventory
)
self
.
assertFalse
(
any
(
expected_dict
.
itervalues
(
)),
expected_dict
)
self
.
assertFalse
(
any
(
six
.
itervalues
(
expected_dict
)),
expected_dict
)
class
TestMRPImplementation
(
TestMRPMixin
):
"""the test for implementation"""
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
View file @
a12f1c00
...
...
@@ -5,6 +5,7 @@ If `portal_type` is provided, only return worklists that apply for this portal t
This script has proxy role, as only manager can access workflow configuration.
"""
from
Products.ERP5Type.Message
import
translateString
import
six
portal
=
context
.
getPortalObject
()
query_dict
=
{}
...
...
@@ -20,7 +21,7 @@ for worklist in workflow.getWorklistValueList():
continue
query_list
=
[]
for
key
,
value
in
identity_criterion_dict
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
identity_criterion_dict
):
if
key
==
workflow_state_var
:
# instead of having {'validation_state': 'draft'}, we want to have
# {'translated_validation_state_title': 'Brouillon'}
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payline/SkinTemplateItem/portal_skins/erp5_payline/PaylineSOAPConnector_archiveExchange.py
View file @
a12f1c00
...
...
@@ -15,7 +15,7 @@ def getdoc(document, identifier):
document
.
getPath
(),
)
)
return
document
.
values
(
)[
0
]
return
list
(
document
.
values
()
)[
0
]
return
getattr
(
document
,
identifier
)
exchange
=
portal
.
system_event_module
.
newContent
(
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getEditableObjectLineList.py
View file @
a12f1c00
...
...
@@ -113,7 +113,7 @@ for model_line in model_line_list:
if
batch_mode
:
object_dict_list
=
[
x
.
values
(
)[
0
]
for
x
in
object_dict_list
]
object_dict_list
=
[
list
(
x
.
values
()
)[
0
]
for
x
in
object_dict_list
]
return
object_dict_list
# sort results
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEndOfContractReport_makeReport.py
View file @
a12f1c00
from
erp5.component.module.DateUtils
import
getNumberOfDayInMonth
import
six
def
getLastDateOfMonth
(
date
):
return
DateTime
(
date
.
year
(),
date
.
month
(),
getNumberOfDayInMonth
(
date
))
...
...
@@ -80,10 +81,10 @@ for remuneration_block in paysheet_data_dict['remuneration']:
continue
dsn_file
.
append
(
remuneration_block
)
for
bonus_category
in
paysheet_data_dict
[
'other_bonus'
].
itervalues
(
):
for
bonus_category
in
six
.
itervalues
(
paysheet_data_dict
[
'other_bonus'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.52'
,
target
=
bonus_category
))
for
bonus_category
in
paysheet_data_dict
[
'other_income'
].
itervalues
(
):
for
bonus_category
in
six
.
itervalues
(
paysheet_data_dict
[
'other_income'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.54'
,
target
=
bonus_category
))
# Print DSN Record
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
View file @
a12f1c00
from
erp5.component.module.DateUtils
import
addToDate
,
getIntervalBetweenDates
,
getNumberOfDayInMonth
import
six
portal
=
context
.
getPortalObject
()
portal_categories
=
context
.
portal_categories
...
...
@@ -43,7 +44,7 @@ if block_id in ('S21.G00.31', 'S21.G00.41', 'S21.G00.72'):
change_block
=
kw
[
'change_block'
]
change_date
=
kw
[
'change_date'
]
rubric_value_dict
[
block_id
+
".001"
]
=
change_date
for
rubric
,
value
in
change_block
.
iteritems
(
):
for
rubric
,
value
in
six
.
iteritems
(
change_block
):
rubric_value_dict
[
rubric
]
=
value
# Envoi
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
View file @
a12f1c00
from
erp5.component.module.DateUtils
import
getNumberOfDayInMonth
import
six
portal
=
context
.
getPortalObject
()
portal_categories
=
context
.
portal_categories
...
...
@@ -30,7 +31,7 @@ if block_id in ('S21.G00.31', 'S21.G00.41', 'S21.G00.72'):
change_bloc
=
kw
[
'change_bloc'
]
change_date
=
kw
[
'change_date'
]
rubric_value_dict
[
block_id
+
".001"
]
=
change_date
for
rubric
,
value
in
change_bloc
.
iteritems
(
):
for
rubric
,
value
in
six
.
iteritems
(
change_bloc
):
rubric_value_dict
[
rubric
]
=
value
# Envoi
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
View file @
a12f1c00
from
erp5.component.module.DateUtils
import
addToDate
,
getNumberOfDayInMonth
import
six
if
context
.
getSourceAdministration
()
is
None
\
or
context
.
getEffectiveDate
()
is
None
\
...
...
@@ -223,12 +224,12 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
contract_change_block_list
=
[]
if
employee
in
change_block_dict
:
for
rubric_root
,
change_date_block
in
change_block_dict
[
employee
].
iteritems
(
):
for
rubric_root
,
change_date_block
in
six
.
iteritems
(
change_block_dict
[
employee
]
):
if
rubric_root
==
'S21.G00.31'
:
for
date
,
change_block
in
change_date_block
.
iteritems
(
):
for
date
,
change_block
in
six
.
iteritems
(
change_date_block
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
rubric_root
,
change_block
=
change_block
,
change_date
=
date
))
elif
rubric_root
==
'S21.G00.41'
:
for
date
,
change_block
in
change_date_block
.
iteritems
(
):
for
date
,
change_block
in
six
.
iteritems
(
change_date_block
):
contract_change_block_list
.
append
(
getDSNBlockDict
(
block_id
=
rubric_root
,
change_block
=
change_block
,
change_date
=
date
))
employee_data_dict
[
'contract'
][
'S21.G00.40.019'
]
=
establishment_registration_code
...
...
@@ -279,13 +280,13 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
for
remuneration_block
in
paysheet_data_dict
[
'remuneration'
]:
dsn_file
.
append
(
remuneration_block
)
for
bonus_category
in
paysheet_data_dict
[
'other_bonus'
].
itervalues
(
):
for
bonus_category
in
six
.
itervalues
(
paysheet_data_dict
[
'other_bonus'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.52'
,
target
=
bonus_category
))
for
bonus_category
in
paysheet_data_dict
[
'other_income'
].
itervalues
(
):
for
bonus_category
in
six
.
itervalues
(
paysheet_data_dict
[
'other_income'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.54'
,
target
=
bonus_category
))
for
taxable_base_category
in
paysheet_data_dict
[
'taxable_base'
].
itervalues
(
):
for
taxable_base_category
in
six
.
itervalues
(
paysheet_data_dict
[
'taxable_base'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.78'
,
target
=
taxable_base_category
))
if
taxable_base_category
[
'code'
]
==
'02'
:
# Assiette Brute plafonnee
if
(
'063'
,
''
)
in
paysheet_data_dict
[
'individual_contribution'
]:
...
...
@@ -319,13 +320,13 @@ for employee_data_dict, paysheet_data_dict in employee_result_list:
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.81'
,
target
=
paysheet_data_dict
[
'individual_contribution'
][(
'059'
,
taxable_base_category
[
'contract_id'
])]))
del
paysheet_data_dict
[
'individual_contribution'
][(
'059'
,
taxable_base_category
[
'contract_id'
])]
for
taxable_base_component_category
in
paysheet_data_dict
[
'taxable_base_component'
].
itervalues
(
):
for
taxable_base_component_category
in
six
.
itervalues
(
paysheet_data_dict
[
'taxable_base_component'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.79'
,
target
=
taxable_base_component_category
))
if
(
'03'
,
''
)
in
taxable_base_component_category
:
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.81'
,
target
=
paysheet_data_dict
[
'individual_contribution'
][(
'064'
,
''
)]))
del
paysheet_data_dict
[
'individual_contribution'
][(
'064'
,
''
)]
for
individual_contribution_category
in
paysheet_data_dict
[
'individual_contribution'
].
itervalues
(
):
for
individual_contribution_category
in
six
.
itervalues
(
paysheet_data_dict
[
'individual_contribution'
]
):
dsn_file
.
append
(
getDSNBlockDict
(
block_id
=
'S21.G00.81'
,
target
=
individual_contribution_category
))
dsn_file
.
append
(
employee_data_dict
[
'seniority'
])
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getPayslipData.py
View file @
a12f1c00
from
DateTime
import
DateTime
import
six
line_dict_list
=
context
.
PaySheetTransaction_getLineListAsDict
()
non_subject_amount
=
'base_amount/payroll/report_section/l10n/fr/amount_non_subject_to_contribution'
...
...
@@ -58,7 +59,7 @@ def groupSameReportSectionLine(line_to_group_list):
tmp_base_dict
[
base
][
'employee_price'
]
=
tmp_base_dict
[
base
][
'employee_price'
]
+
(
line_dict
[
'employee_price'
]
or
0
)
tmp_base_dict
[
base
][
'employee_total_price'
]
=
tmp_base_dict
[
base
][
'employee_total_price'
]
+
(
line_dict
[
'employee_total_price'
]
or
0
)
# Check if can group by same rate
for
_
,
value
in
tmp_base_dict
.
iteritems
(
):
for
_
,
value
in
six
.
iteritems
(
tmp_base_dict
):
new_key
=
(
value
[
'employer_price'
],
value
[
'employee_price'
])
if
new_key
not
in
tmp2_base_dict
:
tmp2_base_dict
[
new_key
]
=
value
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payroll_l10n_fr/TestTemplateItem/portal_components/test.erp5.testSimplifiedPayslipReport.py
View file @
a12f1c00
...
...
@@ -32,6 +32,7 @@ from io import BytesIO
import
math
import
os.path
from
Products.Localizer.itools.i18n.accept
import
AcceptLanguage
import
six
class
TestSimplifiedPayslipReport
(
ERP5TypeTestCase
):
...
...
@@ -107,7 +108,7 @@ class TestSimplifiedPayslipReport(ERP5TypeTestCase):
"total_contribution_relief"
:
468.88
}
payslip_content
=
test_pay_sheet_transaction
.
PaySheetTransaction_getPayslipData
()
for
key
,
value
in
expected_payslip_content
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
expected_payslip_content
):
self
.
assertAlmostEqual
(
value
,
payslip_content
[
key
])
expected_non_contribution_dict_list
=
[
...
...
@@ -124,7 +125,7 @@ class TestSimplifiedPayslipReport(ERP5TypeTestCase):
for
index
in
range
(
len
(
expected_non_contribution_dict_list
)):
expected_value_dict
=
expected_non_contribution_dict_list
[
index
]
value_dict
=
non_contribution_dict_list
[
index
]
for
key
,
value
in
expected_value_dict
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
expected_value_dict
):
self
.
assertEqual
(
value_dict
[
key
],
value
)
expected_contribution_dict_list
=
[
...
...
@@ -163,7 +164,7 @@ class TestSimplifiedPayslipReport(ERP5TypeTestCase):
for
index
in
range
(
len
(
expected_contribution_dict_list
)):
expected_value_dict
=
expected_contribution_dict_list
[
index
]
value_dict
=
contribution_dict_list
[
index
]
for
key
,
value
in
expected_value_dict
.
iteritems
(
):
for
key
,
value
in
six
.
iteritems
(
expected_value_dict
):
self
.
assertAlmostEqual
(
value_dict
[
key
],
value
)
test_pay_sheet_transaction
.
setStartDate
(
DateTime
(
"2020/01/01"
))
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
View file @
a12f1c00
...
...
@@ -8,9 +8,9 @@ import base64
import
datetime
import
os
import
time
import
six
import
requests
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
import
six
present
=
False
tz
=
None
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
View file @
a12f1c00
...
...
@@ -28,6 +28,7 @@
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
DateTime
import
DateTime
import
six
class
TestRealTimeInventoryAccountingMixin
:
def
assertIterableLen
(
self
,
iterable
,
expected_len
):
...
...
@@ -163,7 +164,7 @@ class TestRealTimeInventoryAccountingMixin:
delivery_property_dict
=
None
,
movement_property_dict_tuple
=
()):
if
delivery_property_dict
is
not
None
:
for
property_id
,
property_value
in
delivery_property_dict
.
iteritems
(
):
for
property_id
,
property_value
in
six
.
iteritems
(
delivery_property_dict
):
self
.
assertEqual
(
delivery
.
getProperty
(
property_id
),
property_value
)
if
not
movement_property_dict_tuple
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testBPMCore.py
View file @
a12f1c00
...
...
@@ -35,6 +35,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
reindex
from
Products.ERP5Type.tests.utils
import
todo_erp5
import
six
class
TestBPMMixin
(
ERP5TypeTestCase
):
"""Skeletons for tests which depend on BPM"""
...
...
@@ -172,7 +173,7 @@ class TestBPMMixin(ERP5TypeTestCase):
portal_type
=
self
.
trade_model_path_portal_type
,
**
kw
)
if
criterion_property_dict
:
trade_model_path
.
_setCriterionPropertyList
(
tuple
(
criterion_property_dict
))
for
property_
,
identity
in
criterion_property_dict
.
iteritems
(
):
for
property_
,
identity
in
six
.
iteritems
(
criterion_property_dict
):
trade_model_path
.
setCriterion
(
property_
,
identity
)
reference
=
kw
.
get
(
'reference'
,
None
)
if
reference
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simplified_invoicing/TestTemplateItem/portal_components/test.erp5.testTradeModelLine.py
View file @
a12f1c00
...
...
@@ -39,6 +39,7 @@ from Products.ERP5Type.Utils import simple_decorator
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5OOo.tests.utils
import
Validator
import
six
def
save_result_as
(
name
):
...
...
@@ -223,14 +224,14 @@ class TestTradeModelLineMixin(TestBPMMixin, UserDict):
if
not
partial_check
:
raise
else
:
for
k
,
v
in
expected_amount
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
expected_amount
):
if
k
==
'causality_value_list'
:
self
.
assertEqual
(
v
,
amount
.
getValueList
(
'causality'
))
else
:
self
.
assertEqual
(
v
,
amount
.
getProperty
(
k
))
amount_dict
[
reference
]
=
amount
if
partial_check
:
for
value
in
expected_amount_dict
.
itervalues
(
):
for
value
in
six
.
itervalues
(
expected_amount_dict
):
self
.
assertEqual
(
None
,
value
)
else
:
self
.
assertEqual
({},
expected_amount_dict
)
...
...
@@ -316,7 +317,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
def
copyExpectedAmountDict
(
self
,
delivery
,
ratio
=
1
):
self
[
delivery
.
getPath
()]
=
expected_amount_dict
=
{}
causality
=
delivery
.
getCausalityValue
()
for
base_amount
,
amount_dict
in
s
elf
[
causality
.
getPath
()].
iteritems
(
):
for
base_amount
,
amount_dict
in
s
ix
.
iteritems
(
self
[
causality
.
getPath
()]
):
expected_amount_dict
[
base_amount
]
=
new_amount_dict
=
{}
for
line
in
delivery
.
getMovementList
():
line_id
=
line
.
getCausalityId
()
...
...
@@ -388,7 +389,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self
.
assertSameSet
(
composed
.
getSpecialiseValueList
(),
specialise_value_list
)
count
=
0
for
portal_type
,
n
in
type_count_dict
.
iteritems
(
):
for
portal_type
,
n
in
six
.
iteritems
(
type_count_dict
):
count
+=
n
self
.
assertEqual
(
n
,
len
(
composed
.
objectValues
(
portal_type
=
portal_type
)))
self
.
assertTrue
(
count
,
len
(
composed
.
objectValues
()))
...
...
@@ -397,7 +398,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
expected_result_dict
=
self
[
order
.
getPath
()]
def
check
(
movement
,
movement_id
):
kw
=
{}
for
reference
,
result
in
expected_result_dict
.
iteritems
(
):
for
reference
,
result
in
six
.
iteritems
(
expected_result_dict
):
total_price
=
result
.
get
(
movement_id
)
or
0.0
if
True
:
model_line
=
self
[
'trade_model_line/'
+
reference
]
...
...
@@ -819,7 +820,7 @@ return getBaseAmountQuantity""")
for
x
,
y
in
zip
(
range_list
,
index
):
x
.
add
(
y
)
line
.
setCellRange
(
*
range_list
)
for
index
,
price
in
matrix
.
iteritems
(
):
for
index
,
price
in
six
.
iteritems
(
matrix
):
line
.
newCell
(
mapped_value_property
=
'price'
,
price
=
price
,
base_application_list
=
[
index
[
i
]
for
i
in
base_application
],
base_contribution_list
=
[
index
[
i
]
for
i
in
base_contribution
],
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.AcceptSolver.py
View file @
a12f1c00
...
...
@@ -31,6 +31,7 @@
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
erp5.component.mixin.ConfigurablePropertySolverMixin
import
ConfigurablePropertySolverMixin
import
six
class
AcceptSolver
(
ConfigurablePropertySolverMixin
):
"""Target solver that accepts the values from the decision on the prevision.
...
...
@@ -84,7 +85,7 @@ class AcceptSolver(ConfigurablePropertySolverMixin):
# like recording the same values in other simulation movements
def
_updateSimulationMovement
(
self
,
simulation_movement
,
value_dict
,
activate_kw
):
for
property_id
,
value
in
value_dict
.
iteritems
(
):
for
property_id
,
value
in
six
.
iteritems
(
value_dict
):
if
not
simulation_movement
.
isPropertyRecorded
(
property_id
):
simulation_movement
.
recordProperty
(
property_id
)
simulation_movement
.
setProperty
(
property_id
,
value
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.AdoptSolver.py
View file @
a12f1c00
...
...
@@ -30,6 +30,7 @@
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
erp5.component.mixin.ConfigurablePropertySolverMixin
import
ConfigurablePropertySolverMixin
import
six
class
AdoptSolver
(
ConfigurablePropertySolverMixin
):
"""Target solver that adopts the values from the prevision on the decision.
...
...
@@ -50,7 +51,7 @@ class AdoptSolver(ConfigurablePropertySolverMixin):
for
simulation_movement
in
self
.
getDeliveryValueList
():
delivery_dict
.
setdefault
(
simulation_movement
.
getDeliveryValue
(),
[]).
append
(
simulation_movement
)
for
movement
,
simulation_movement_list
in
delivery_dict
.
iteritems
(
):
for
movement
,
simulation_movement_list
in
six
.
iteritems
(
delivery_dict
):
if
activate_kw
is
not
None
:
movement
.
setDefaultActivateParameterDict
(
activate_kw
)
for
solved_property
in
solved_property_list
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.ItemListSplitSolver.py
View file @
a12f1c00
...
...
@@ -37,6 +37,7 @@ from erp5.component.mixin.ConfigurableMixin import ConfigurableMixin
from
erp5.component.module.MovementCollectionDiff
import
_getPropertyAndCategoryList
from
erp5.component.interface.ISolver
import
ISolver
from
erp5.component.interface.IConfigurable
import
IConfigurable
import
six
@
zope
.
interface
.
implementer
(
ISolver
,
IConfigurable
,)
...
...
@@ -77,7 +78,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
delivery_dict
.
setdefault
(
simulation_movement
.
getDeliveryValue
(),
[]).
append
(
simulation_movement
)
for
movement
,
simulation_movement_list
in
delivery_dict
.
iteritems
(
):
for
movement
,
simulation_movement_list
in
six
.
iteritems
(
delivery_dict
):
decision_aggregate_set
=
set
(
movement
.
getAggregateList
())
split_list
=
[]
for
simulation_movement
in
simulation_movement_list
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.MovementSplitSolver.py
View file @
a12f1c00
...
...
@@ -36,6 +36,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from
Products.ERP5Type.Message
import
translateString
from
erp5.component.interface.ISolver
import
ISolver
from
erp5.component.interface.IConfigurable
import
IConfigurable
import
six
@
zope
.
interface
.
implementer
(
ISolver
,
IConfigurable
,)
...
...
@@ -71,7 +72,7 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
delivery_dict
.
setdefault
(
delivery
,
[]).
append
(
simulation_movement
)
for
delivery
,
split_simulation_movement_list
\
in
delivery_dict
.
iteritems
(
):
in
six
.
iteritems
(
delivery_dict
):
# First, duplicate the whole delivery document including its
# sub objects.
old_delivery_url
=
delivery
.
getRelativeUrl
()
...
...
@@ -166,7 +167,7 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
delivery_error
=
total_quantity
*
delivery_ratio
-
quantity
simulation_movement
.
edit
(
delivery_ratio
=
delivery_ratio
,
delivery_error
=
delivery_error
)
for
movement
,
quantity
in
quantity_dict
.
iteritems
(
):
for
movement
,
quantity
in
six
.
iteritems
(
quantity_dict
):
movement
.
setQuantity
(
quantity
)
assert
delivery
.
getMovementList
()
and
new_delivery
.
getMovementList
()
...
...
@@ -206,7 +207,7 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
if
getattr
(
parent
,
'setVariationCategoryList'
,
None
)
is
not
None
:
line_dict
.
setdefault
(
parent
,
[]).
extend
(
movement
.
getVariationCategoryList
())
for
line
,
category_list
in
line_dict
.
iteritems
(
):
for
line
,
category_list
in
six
.
iteritems
(
line_dict
):
line
.
setVariationCategoryList
(
sorted
(
set
(
category_list
)))
_updateVariationCategoryList
(
delivery
)
_updateVariationCategoryList
(
new_delivery
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.QuantitySplitSolver.py
View file @
a12f1c00
...
...
@@ -38,6 +38,7 @@ from erp5.component.mixin.ConfigurableMixin import ConfigurableMixin
from
erp5.component.module.MovementCollectionDiff
import
_getPropertyAndCategoryList
from
erp5.component.interface.ISolver
import
ISolver
from
erp5.component.interface.IConfigurable
import
IConfigurable
import
six
@
zope
.
interface
.
implementer
(
ISolver
,
IConfigurable
,)
...
...
@@ -83,7 +84,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
for
simulation_movement
in
self
.
getDeliveryValueList
():
delivery_dict
.
setdefault
(
simulation_movement
.
getDeliveryValue
(),
[]).
append
(
simulation_movement
)
for
movement
,
simulation_movement_list
in
delivery_dict
.
iteritems
(
):
for
movement
,
simulation_movement_list
in
six
.
iteritems
(
delivery_dict
):
decision_quantity
=
movement
.
getQuantity
()
delivery_solver
=
self
.
getParentValue
().
newContent
(
portal_type
=
configuration_dict
[
'delivery_solver'
],
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.SolverProcess.py
View file @
a12f1c00
...
...
@@ -37,6 +37,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from
erp5.component.interface.IMovement
import
IMovement
from
erp5.component.interface.ISolver
import
ISolver
from
erp5.component.interface.IConfigurable
import
IConfigurable
import
six
@
zope
.
interface
.
implementer
(
ISolver
,
IConfigurable
,)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.TradeModelSolver.py
View file @
a12f1c00
...
...
@@ -31,6 +31,7 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.AcceptSolver
import
AcceptSolver
from
erp5.component.interface.ISolver
import
ISolver
import
six
@
zope
.
interface
.
implementer
(
ISolver
,)
class
TradeModelSolver
(
AcceptSolver
):
...
...
@@ -96,7 +97,7 @@ class TradeModelSolver(AcceptSolver):
with
self
.
defaultActivateParameterDict
(
activate_kw
,
True
):
# Second, apply changes on invoice lines to simulation movements,
# then expand.
for
movement
,
simulation_movement_list
in
delivery_dict
.
iteritems
(
):
for
movement
,
simulation_movement_list
in
six
.
iteritems
(
delivery_dict
):
if
movement
in
trade_model_related_movement_dict
:
continue
for
simulation_movement
in
simulation_movement_list
:
...
...
@@ -106,7 +107,7 @@ class TradeModelSolver(AcceptSolver):
if
solved_property
==
'quantity'
:
new_value
*=
simulation_movement
.
getDeliveryRatio
()
value_dict
[
solved_property
]
=
new_value
for
property_id
,
value
in
value_dict
.
iteritems
(
):
for
property_id
,
value
in
six
.
iteritems
(
value_dict
):
if
not
simulation_movement
.
isPropertyRecorded
(
property_id
):
simulation_movement
.
recordProperty
(
property_id
)
simulation_movement
.
setProperty
(
property_id
,
value
)
...
...
@@ -115,7 +116,7 @@ class TradeModelSolver(AcceptSolver):
# Third, adopt changes on trade model related lines.
# XXX non-linear case is not yet supported.
for
movement
,
simulation_movement_list
in
\
trade_model_related_movement_dict
.
iteritems
(
):
six
.
iteritems
(
trade_model_related_movement_dict
):
for
solved_property
in
solved_property_list
:
if
solved_property
==
'quantity'
:
total_quantity
=
sum
(
x
.
getQuantity
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_simulation/DocumentTemplateItem/portal_components/document.erp5.UnifySolver.py
View file @
a12f1c00
...
...
@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.AcceptSolver
import
AcceptSolver
from
erp5.component.interface.ISolver
import
ISolver
import
six
@
zope
.
interface
.
implementer
(
ISolver
,)
class
UnifySolver
(
AcceptSolver
):
...
...
@@ -105,7 +106,7 @@ class UnifySolver(AcceptSolver):
for
simulation_movement
in
self
.
getDeliveryValueList
():
delivery_dict
.
setdefault
(
simulation_movement
.
getDeliveryValue
(),
set
()).
add
(
simulation_movement
)
for
movement
,
simulation_movement_set
in
delivery_dict
.
iteritems
(
):
for
movement
,
simulation_movement_set
in
six
.
iteritems
(
delivery_dict
):
# get the movement that actually has the property to update
movement
=
self
.
_getActualTargetMovement
(
movement
,
solved_property
)
# and all other simulation movements we should also update
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5Conduit.py
View file @
a12f1c00
...
...
@@ -42,6 +42,7 @@ from xml.sax.saxutils import unescape
import
re
from
lxml
import
etree
from
lxml.etree
import
Element
import
six
parser
=
etree
.
XMLParser
(
remove_blank_text
=
True
)
from
xml_marshaller.xml_marshaller
import
Unmarshaller
from
xupdate_processor
import
xuproc
...
...
@@ -230,7 +231,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# /erp5/object[@gid='
313730
']/../workflow_action[@id=SHA(TIME + ACTOR)]
wf_action_id = EXTRACT_ID_FROM_XPATH.findall(xpath_expression)[-1][-1]
def deleteWorkflowNode():
for wf_id, wf_history_tuple in
object.workflow_history.iteritems(
):
for wf_id, wf_history_tuple in
six.iteritems(object.workflow_history
):
for wf_history_index, wf_history in enumerate(wf_history_tuple):
if sha1(wf_id + str(wf_history['
time
']) +
wf_history['
actor
']).hexdigest() == wf_action_id:
...
...
@@ -831,7 +832,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
xupdate_builded = True
# Find the prefix used by marshaller.
for prefix, namespace_uri in s
ubnode.nsmap.iteritems(
):
for prefix, namespace_uri in s
ix.iteritems(subnode.nsmap
):
if namespace_uri == MARSHALLER_NAMESPACE_URI:
break
# TODO add support of etree objects for xuproc to avoid
...
...
@@ -889,7 +890,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
previous_xml=previous_xml, **kw)
# Now apply collected xupdated_node
for update_dict in
xpath_expression_update_dict.itervalues(
):
for update_dict in
six.itervalues(xpath_expression_update_dict
):
update_dict.update(kw)
conflict_list += self.updateNode(previous_xml=previous_xml,
**update_dict)
...
...
@@ -914,7 +915,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if time <= action.get('time'):
# action in the past are not appended
addable = WORKFLOW_ACTION_INSERTABLE
key_list =
action.keys(
)
key_list =
list(action.keys()
)
key_list.remove("time")
for key in key_list:
if status[key] != action[key]:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5DocumentConduit.py
View file @
a12f1c00
...
...
@@ -75,7 +75,7 @@ class ERP5DocumentConduit(ERP5Conduit):
# if time <= action.get('time'):
# # action in the past are not appended
# addable = WORKFLOW_ACTION_INSERTABLE
key_list
=
action
.
keys
(
)
key_list
=
list
(
action
.
keys
()
)
# key_list.remove("time")
# XXX-AUREL For document it seems that checking time != is required
# I don't know why ?
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
View file @
a12f1c00
...
...
@@ -169,7 +169,7 @@ class WebServiceRequest(XMLObject, ZopePageTemplate):
new_kw
=
kw
.
copy
()
args
=
[]
if
self
.
getDestination
():
for
k
,
v
in
kw
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
kw
):
new_key
=
site
.
getMappingFromProperty
(
self
.
getDestinationValue
(),
k
)
new_kw
.
pop
(
k
)
if
new_key
is
None
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_core/ExtensionTemplateItem/portal_components/extension.erp5.TioSafeBrain.py
View file @
a12f1c00
...
...
@@ -20,6 +20,7 @@ from lxml import etree
from
zLOG
import
LOG
,
ERROR
from
DateTime
import
DateTime
from
Products.ERP5Type.Cache
import
CachingMethod
import
six
# Global variables
SEPARATOR
=
'
\
n
'
...
...
@@ -39,7 +40,7 @@ class TioSafeBrain(Explicit):
self
.
object_type
=
object_type
self
.
context
=
context
# save properties as attributes
for
k
,
v
in
kw
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
kw
):
# FIXME: '0000-00-00 00:00:00' is an error find in the Prestashop sync
if
v
is
not
None
and
v
!=
'0000-00-00 00:00:00'
:
setattr
(
self
,
k
.
lower
(),
v
)
...
...
@@ -49,7 +50,7 @@ class TioSafeBrain(Explicit):
Update self properties with the one from
another brain
"""
for
k
,
v
in
brain
.
__dict__
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
brain
.
__dict__
):
setattr
(
self
,
k
,
v
)
def
_asXML
(
self
):
...
...
@@ -462,7 +463,7 @@ class Resource(TioSafeBrain):
category
=
etree
.
SubElement
(
element
,
'category'
)
category
.
text
=
category_value
mapping
.
pop
(
'category_list'
)
for
k
,
v
in
mapping
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
mapping
):
prop
=
etree
.
SubElement
(
element
,
k
)
prop
.
text
=
v
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_core/SkinTemplateItem/portal_skins/erp5_integration/IntegrationSite_updateCategoryMappingLineList.py
View file @
a12f1c00
...
...
@@ -40,7 +40,7 @@ request= context.REQUEST
integration_site
=
context
if
len
(
bad_destination_list
)
>
0
:
status_message
=
"Impossible to update because of redundancy of %s."
%
repr
(
{}.
fromkeys
(
bad_destination_list
).
keys
(
))
status_message
=
"Impossible to update because of redundancy of %s."
%
repr
(
list
({}.
fromkeys
(
bad_destination_list
).
keys
()
))
request
.
set
(
'portal_status_message'
,
status_message
)
return
getattr
(
context
,
request
.
form
[
'dialog_id'
])(
listbox
=
listbox
,
kw
=
kw
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
View file @
a12f1c00
from
Products.PythonScripts.standard
import
Object
from
json
import
loads
import
six
portal
=
context
.
getPortalObject
()
...
...
@@ -11,20 +12,20 @@ active_process_path = request.get('active_process')
def
_addDict
(
global_dict
,
local_dict
,
only_amount
=
False
):
if
report_group_by
==
"both"
and
not
only_amount
:
# we have client -> product -> period -> amount
for
local_title
,
local_product_dict
in
local_dict
.
iteritems
(
):
for
local_title
,
local_product_dict
in
six
.
iteritems
(
local_dict
):
product_dict
=
global_dict
.
setdefault
(
local_title
,
{})
for
local_product
,
local_period_dict
in
local_product_dict
.
iteritems
(
):
for
local_product
,
local_period_dict
in
six
.
iteritems
(
local_product_dict
):
period_dict
=
product_dict
.
setdefault
(
local_product
,
{})
for
period
,
local_amount_dict
in
local_period_dict
.
iteritems
(
):
for
period
,
local_amount_dict
in
six
.
iteritems
(
local_period_dict
):
amount_dict
=
period_dict
.
setdefault
(
period
,
{
'amount'
:
0
,
'quantity'
:
0
,
'quantity_unit'
:
''
})
amount_dict
[
'amount'
]
=
amount_dict
[
'amount'
]
+
local_amount_dict
[
'amount'
]
amount_dict
[
'quantity'
]
=
amount_dict
[
'quantity'
]
+
local_amount_dict
[
'quantity'
]
amount_dict
[
'quantity_unit'
]
=
local_amount_dict
[
'quantity_unit'
]
else
:
# We have client or product -> period -> amount
for
local_title
,
local_period_dict
in
local_dict
.
iteritems
(
):
for
local_title
,
local_period_dict
in
six
.
iteritems
(
local_dict
):
period_dict
=
global_dict
.
setdefault
(
local_title
,
{})
for
period
,
local_amount_dict
in
local_period_dict
.
iteritems
(
):
for
period
,
local_amount_dict
in
six
.
iteritems
(
local_period_dict
):
amount_dict
=
period_dict
.
setdefault
(
period
,
{
'amount'
:
0
,
'quantity'
:
0
,
'quantity_unit'
:
''
})
amount_dict
[
'amount'
]
=
amount_dict
[
'amount'
]
+
local_amount_dict
[
'amount'
]
if
not
only_amount
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testOrderBuilder.py
View file @
a12f1c00
...
...
@@ -32,6 +32,7 @@ from DateTime import DateTime
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
erp5.component.test.testOrder
import
TestOrderMixin
from
Products.ERP5.tests.testInventoryAPI
import
InventoryAPITestCase
import
six
class
TestOrderBuilderMixin
(
TestOrderMixin
,
InventoryAPITestCase
):
...
...
@@ -156,7 +157,7 @@ class TestOrderBuilderMixin(TestOrderMixin, InventoryAPITestCase):
order_line
,
=
order
.
contentValues
(
portal_type
=
self
.
order_line_portal_type
)
self
.
assertEqual
(
order_line
.
getResourceValue
(),
resource
)
self
.
assertEqual
(
order_line
.
getTotalQuantity
(),
sum
(
s
elf
.
wanted_quantity_matrix
.
itervalues
(
)))
sum
(
s
ix
.
itervalues
(
self
.
wanted_quantity_matrix
)))
quantity_matrix
=
{}
for
cell
in
order_line
.
contentValues
(
portal_type
=
self
.
order_cell_portal_type
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
View file @
a12f1c00
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from
Products.ERP5Type.tests.utils
import
reindex
from
AccessControl.SecurityManagement
import
newSecurityManager
from
DateTime
import
DateTime
import
six
class
TestTradeReports
(
ERP5ReportTestCase
):
"""Test Trade reports
...
...
@@ -275,7 +276,7 @@ class TestTradeReports(ERP5ReportTestCase):
if
resource_dict
is
None
:
resource_dict
=
{}
sale_order
=
self
.
sale_order_module
.
newContent
(
portal_type
=
"Sale Order"
,
**
kw
)
for
product
,
values
in
resource_dict
.
iteritems
(
):
for
product
,
values
in
six
.
iteritems
(
resource_dict
):
sale_order
.
newContent
(
portal_type
=
"Sale Order Line"
,
resource
=
product
,
quantity
=
values
[
"quantity"
],
...
...
@@ -296,7 +297,7 @@ class TestTradeReports(ERP5ReportTestCase):
if
resource_dict
is
None
:
resource_dict
=
{}
sale_packing_list
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
"Sale Packing List"
,
**
kw
)
for
product
,
values
in
resource_dict
.
iteritems
(
):
for
product
,
values
in
six
.
iteritems
(
resource_dict
):
sale_packing_list
.
newContent
(
portal_type
=
"Sale Packing List Line"
,
resource
=
product
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/ExpenseRecord_updateRelatedTicket.py
View file @
a12f1c00
import
base64
import
json
import
six
portal
=
context
.
getPortalObject
()
record
=
context
def
byteify
(
string
):
if
isinstance
(
string
,
dict
):
tmp
=
{}
for
key
,
value
in
s
tring
.
iteritems
(
):
for
key
,
value
in
s
ix
.
iteritems
(
string
):
tmp
[
byteify
(
key
)]
=
byteify
(
value
)
return
tmp
elif
isinstance
(
string
,
list
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_record/TravelRequestRecord_updateRelatedTicket.py
View file @
a12f1c00
import
json
import
six
portal
=
context
.
getPortalObject
()
record
=
context
...
...
@@ -6,7 +7,7 @@ record = context
def
byteify
(
string
):
if
isinstance
(
string
,
dict
):
tmp
=
{}
for
key
,
value
in
s
tring
.
iteritems
(
):
for
key
,
value
in
s
ix
.
iteritems
(
string
):
tmp
[
byteify
(
key
)]
=
byteify
(
value
)
return
tmp
elif
isinstance
(
string
,
list
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Base_getConstraintTypeListPerPortalType.py
View file @
a12f1c00
import
six
portal
=
context
.
getPortalObject
()
constraint_type_list
=
portal
.
getPortalConstraintTypeList
()
...
...
@@ -35,7 +36,7 @@ for property_sheet in portal.portal_property_sheets.objectValues():
constraint_type_per_id
.
setdefault
(
property_sheet_id
,
[]).
extend
(
type_list
)
constraint_type_per_type
=
{}
for
property_sheet_id
,
category_list
in
constraint_type_per_id
.
iteritems
(
):
for
property_sheet_id
,
category_list
in
six
.
iteritems
(
constraint_type_per_id
):
for
portal_type
in
property_sheet_by_type_dict
.
get
(
property_sheet_id
,
[]):
constraint_type_per_type
.
setdefault
(
portal_type
,
set
()).
update
(
category_list
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_checkUpgraderConsistency.py
View file @
a12f1c00
import
six
constraint_type_per_type
,
_
=
context
.
Base_getConstraintTypeListPerPortalType
()
constraint_type
=
filter_dict
.
get
(
"constraint_type"
)
if
not
constraint_type
:
...
...
@@ -12,7 +13,7 @@ if filter_dict is None:
portal_type_list
=
[]
append
=
portal_type_list
.
append
for
portal_type
,
constraint_type_list
in
constraint_type_per_type
.
iteritems
(
):
for
portal_type
,
constraint_type_list
in
six
.
iteritems
(
constraint_type_per_type
):
if
constraint_type
in
constraint_type_list
:
append
(
portal_type
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkWorkflowChainConsistency.py
View file @
a12f1c00
import
re
import
six
template_tool
=
context
bt5_per_title_dict
=
{}
...
...
@@ -12,7 +13,7 @@ for bt5 in installed_bt5_list:
continue
bt5_per_title_dict
[
bt5_title
]
=
bt5
resolved_list
=
template_tool
.
resolveBusinessTemplateListDependency
(
bt5_per_title_dict
.
iterkeys
(
))
resolved_list
=
template_tool
.
resolveBusinessTemplateListDependency
(
six
.
iterkeys
(
bt5_per_title_dict
))
pattern
=
re
.
compile
(
r"(?P<portal_type>.*)[| ]\
|[| ](?P<wo
rkflow_id>.*)"
)
portal_type_dict
=
{}
...
...
@@ -38,7 +39,7 @@ for _, bt5_id in resolved_list:
workflow_id_list
.
append
(
workflow_id
)
error_list
=
[]
for
portal_type
,
workflow_chain
in
portal_type_dict
.
iteritems
(
):
for
portal_type
,
workflow_chain
in
six
.
iteritems
(
portal_type_dict
):
portal_type_document
=
context
.
portal_types
.
getTypeInfo
(
portal_type
)
workflow_chain_list
=
portal_type_document
.
getTypeWorkflowList
()
expected_workflow_chain
=
sorted
(
workflow_chain
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testERP5Web.py
View file @
a12f1c00
...
...
@@ -61,7 +61,7 @@ class WebTraversalHookTestMixin(object):
"""
self
.
assertEqual
(
1
,
len
(
self
.
web_section
.
__before_traverse__
))
self
.
assertIsInstance
(
self
.
web_section
.
__before_traverse__
.
values
(
)[
0
],
list
(
self
.
web_section
.
__before_traverse__
.
values
()
)[
0
],
self
.
traversal_hook_class
)
def
test_TraversalHook_on_clone
(
self
):
...
...
@@ -521,7 +521,7 @@ Hé Hé Hé!""", page.asText().strip())
'15'
:
dict
(
language
=
'pt'
,
version
=
"2"
,
reference
=
"F"
),
'16'
:
dict
(
language
=
''
,
version
=
"1"
,
reference
=
"A"
),
}
sequence_one
=
property_dict
.
keys
(
)
sequence_one
=
list
(
property_dict
.
keys
()
)
sequence_two
=
[
'01'
,
'13'
,
'12'
,
'09'
,
'06'
,
'15'
,
'04'
,
'11'
,
'02'
,
'05'
,
'03'
,
'07'
,
'10'
,
'08'
,
'14'
,
'16'
]
sequence_three
=
[
'05'
,
'12'
,
'13'
,
'14'
,
'06'
,
'09'
,
'10'
,
'07'
,
...
...
This diff is collapsed.
Click to expand it.
erp5/util/benchmark/report.py
View file @
a12f1c00
...
...
@@ -574,7 +574,7 @@ def generateReport():
DIAGRAM_PER_PAGE
],
only_average
=
argument_namespace
.
only_average
)
for
suite_name
,
use_case_dict
in
use_case_dict
.
viewitems
(
):
for
suite_name
,
use_case_dict
in
six
.
viewitems
(
use_case_dict
):
drawUseCasePerNumberOfUserPlot
(
pdf
,
"Scalability for %s with %d users"
%
(
suite_name
,
nb_users
),
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.MovementGroup.py
View file @
a12f1c00
...
...
@@ -431,7 +431,7 @@ class FakeMovement:
"""
price_dict
=
self
.
_getPriceDict
()
if
len
(
price_dict
)
==
1
:
return
price_dict
.
keys
(
)[
0
]
return
list
(
price_dict
.
keys
()
)[
0
]
total_quantity
=
sum
(
price_dict
.
values
())
return
(
total_quantity
and
sum
(
price
*
quantity
for
price
,
quantity
in
price_dict
.
items
())
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testSpellChecking.py
View file @
a12f1c00
...
...
@@ -133,8 +133,8 @@ class TestSpellChecking(ERP5TypeTestCase):
# check some suggestion are given for a small mistake
self
.
assertNotEqual
(
self
.
validate_spell
(
'canceled'
),
{})
self
.
assertIn
(
'is misspelled'
,
\
self
.
validate_spell
(
'canceled'
).
values
(
)[
0
])
self
.
assertIn
(
'is misspelled'
,
list
(
self
.
validate_spell
(
'canceled'
).
values
()
)[
0
])
def
test_business_template_list_with_workflow_template_item
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Form/Tool/SelectionTool.py
View file @
a12f1c00
...
...
@@ -1539,7 +1539,7 @@ class SelectionTool( BaseTool, SimpleItem ):
def
_getSelectionNameListFromContainer
(
self
):
user_id
=
self
.
_getUserId
()
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
self
.
getTemporarySelectionDict
().
keys
(
)))
list
(
self
.
getTemporarySelectionDict
().
keys
()
)))
def
isAnonymous
(
self
):
return
self
.
_getUserId
()
==
'Anonymous User'
...
...
This diff is collapsed.
Click to expand it.
product/ERP5Type/patches/WorkflowTool.py
View file @
a12f1c00
...
...
@@ -161,8 +161,64 @@ if WITH_LEGACY_WORKFLOW:
def
canDoActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
guard_kw
=
{}):
""" Check we can perform the given workflow action on 'ob'.
"""
if
wf_id
is
None
:
workflow_list
=
self
.
getWorkflowValueListFor
(
ob
)
or
()
chain_dict
=
{}
for
portal_type
,
wf_id_list
in
six
.
iteritems
(
self
.
_chains_by_type
):
for
wf_id
in
wf_id_list
:
chain_dict
.
setdefault
(
wf_id
,
[]).
append
(
portal_type
)
return
chain_dict
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getChainDict'
)
WorkflowTool
.
getChainDict
=
WorkflowTool_getChainDict
# Backward compatibility, as WorkflowMethod has been removed in CMFCore 2.2
from
MethodObject
import
Method
class
WorkflowMethod
(
Method
):
""" Wrap a method to workflow-enable it.
"""
_need__name__
=
1
def
__init__
(
self
,
method
,
id
=
None
,
reindex
=
1
):
self
.
_m
=
method
if
id
is
None
:
id
=
method
.
__name__
self
.
_id
=
id
# reindex ignored since workflows now perform the reindexing.
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
""" Invoke the wrapped method, and deal with the results.
"""
wf
=
getToolByName
(
instance
,
'portal_workflow'
,
None
)
if
wf
is
None
or
not
hasattr
(
wf
,
'wrapWorkflowMethod'
):
# No workflow tool found.
try
:
res
=
self
.
_m
(
instance
,
*
args
,
**
kw
)
except
ObjectDeleted
as
ex
:
res
=
ex
.
getResult
()
else
:
if
hasattr
(
aq_base
(
instance
),
'reindexObject'
):
instance
.
reindexObject
()
else
:
res
=
wf
.
wrapWorkflowMethod
(
instance
,
self
.
_id
,
self
.
_m
,
(
instance
,)
+
args
,
kw
)
from
Products.CMFCore
import
WorkflowCore
# BBB: WorkflowMethod has been removed from CMFCore 2
WorkflowCore
.
WorkflowAction
=
WorkflowMethod
# XXX: Kept here instead of ERP5Type.Tool.WorkflowTool because not used in
# erp5.git: is it used in projects?
security
.
declarePublic
(
'canDoActionFor'
)
def
canDoActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
guard_kw
=
{}):
""" Check we can perform the given workflow action on 'ob'.
"""
if
wf_id
is
None
:
workflow_list
=
self
.
getWorkflowValueListFor
(
ob
)
or
()
else
:
workflow
=
self
.
_getOb
(
wf_id
,
None
)
if
workflow
:
workflow_list
=
(
workflow
,)
else
:
workflow
=
self
.
_getOb
(
wf_id
,
None
)
if
workflow
:
...
...
This diff is collapsed.
Click to expand it.
product/Formulator/Field.py
View file @
a12f1c00
...
...
@@ -460,8 +460,8 @@ class Field:
return
obj
.
encode
(
'utf-8'
)
return
str
(
obj
)
return
' '
.
join
(
map
(
getSearchSource
,
(
self
.
values
.
values
()
+
self
.
tales
.
values
(
)
+
self
.
overrides
.
values
(
))))
(
list
(
self
.
values
.
values
())
+
list
(
self
.
tales
.
values
()
)
+
list
(
self
.
overrides
.
values
()
))))
InitializeClass
(
Field
)
...
...
This diff is collapsed.
Click to expand it.
product/ZSQLCatalog/Query/ComplexQuery.py
View file @
a12f1c00
...
...
@@ -57,7 +57,7 @@ class ComplexQuery(Query):
self
.
logical_operator
=
kw
.
pop
(
'logical_operator'
,
'and'
).
lower
()
assert
self
.
logical_operator
in
(
'and'
,
'or'
,
'not'
),
self
.
logical_operator
if
kw
:
raise
TypeError
(
'Unknown named arguments: %r'
%
(
kw
.
keys
(
),
))
raise
TypeError
(
'Unknown named arguments: %r'
%
(
list
(
kw
.
keys
()
),
))
query_list
=
[]
append
=
query_list
.
append
extend
=
query_list
.
extend
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment