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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
b0e4c683
Commit
b0e4c683
authored
Jun 09, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounting: stop using portal_catalog.getObject
parent
4386435e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
63 additions
and
65 deletions
+63
-65
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
...accounting/AccountModule_getAccountListForTrialBalance.py
+14
-12
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.py
...unting/AccountModule_getGeneralLedgerReportSectionList.py
+4
-6
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.py
...gTransactionModule_createRelatedPaymentTransactionList.py
+1
-2
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createReversalTransactionList.py
...ountingTransactionModule_createReversalTransactionList.py
+1
-2
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingLineReportLineList.py
...ntingTransactionModule_getAccountingLineReportLineList.py
+1
-2
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getDetailedAgedBalanceLineList.py
...untingTransactionModule_getDetailedAgedBalanceLineList.py
+5
-3
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getGroupingReferenceFastInputTotalSelectedAmount.py
...odule_getGroupingReferenceFastInputTotalSelectedAmount.py
+8
-9
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
...nting/AccountingTransactionModule_setGroupingReference.py
+7
-6
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.py
...ng/Base_getAccountingPeriodStartDateForSectionCategory.py
+1
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSectionCategory.py
...ins/erp5_accounting/Base_getCurrencyForSectionCategory.py
+1
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getMirrorSectionTitle.py
...rtal_skins/erp5_accounting/Brain_getMirrorSectionTitle.py
+3
-3
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getPaymentTitle.py
...tem/portal_skins/erp5_accounting/Brain_getPaymentTitle.py
+3
-3
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getProjectTitle.py
...tem/portal_skins/erp5_accounting/Brain_getProjectTitle.py
+4
-4
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Movement_getPaymentTitle.py
.../portal_skins/erp5_accounting/Movement_getPaymentTitle.py
+3
-2
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.py
...kins/erp5_accounting/Node_getAccountingTransactionList.py
+6
-8
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.py
...ortal_skins/erp5_accounting/Node_statAccountingBalance.py
+1
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
View file @
b0e4c683
...
...
@@ -8,7 +8,6 @@ request = portal.REQUEST
getInventoryList_
=
portal
.
portal_simulation
.
getInventoryList
traverse
=
portal
.
restrictedTraverse
portal_catalog
=
portal
.
portal_catalog
getObject
=
portal_catalog
.
getObject
Base_translateString
=
portal
.
Base_translateString
selected_gap
=
gap_root
traverseCategory
=
portal
.
portal_categories
.
restrictedTraverse
...
...
@@ -551,6 +550,8 @@ if node_uid_of_strict_account_type_to_group_by_payment:
if
src__
:
return
src_list
TRANSLATED_NONE
=
Base_translateString
(
'None'
)
node_title_and_id_cache
=
{}
def
getNodeTitleAndId
(
node_relative_url
):
try
:
...
...
@@ -575,11 +576,10 @@ def getSectionPriceCurrencyFromSectionUid(uid):
try
:
return
section_price_currency_dict
[
uid
]
except
KeyError
:
section
=
getObject
(
uid
)
if
section
is
None
:
price_currency
=
''
else
:
price_currency
=
section
.
getProperty
(
'price_currency_reference'
)
price_currency
=
''
brain_list
=
portal
.
portal_catalog
(
uid
=
uid
)
if
brain_list
:
price_currency
=
brain_list
[
0
].
getObject
().
getProperty
(
'price_currency_reference'
)
section_price_currency_dict
[
uid
]
=
price_currency
return
price_currency
...
...
@@ -590,15 +590,17 @@ def getAnalyticTitleFromUid(uid):
try
:
return
analytic_title_dict
[
uid
]
except
KeyError
:
node
=
getObject
(
uid
)
title
=
node
.
getTranslatedTitle
()
reference
=
node
.
getReference
()
if
reference
:
title
=
'%s - %s'
%
(
reference
,
title
)
title
=
TRANSLATED_NONE
brain_list
=
portal
.
portal_catalog
(
uid
=
uid
)
if
brain_list
:
node
=
brain_list
[
0
].
getObject
()
title
=
node
.
getTranslatedTitle
()
reference
=
node
.
getReference
()
if
reference
:
title
=
'%s - %s'
%
(
reference
,
title
)
analytic_title_dict
[
uid
]
=
title
return
title
TRANSLATED_NONE
=
Base_translateString
(
'None'
)
line_list
=
[]
for
key
,
data
in
line_per_account
.
iteritems
():
node_relative_url
=
key
[
0
]
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.py
View file @
b0e4c683
...
...
@@ -142,18 +142,16 @@ def getAccountName(account_relative_url):
account_name_cache
[
account_relative_url
]
=
name
return
name
getObject
=
portal
.
portal_catalog
.
getObject
title_for_uid_cache
=
{}
title_for_uid_cache
=
{
None
:
''
}
def
getTitleForUid
(
uid
):
try
:
return
title_for_uid_cache
[
uid
]
except
KeyError
:
name
=
''
if
uid
:
document
=
getObject
(
uid
)
if
document
is
not
None
:
name
=
document
.
getTitle
()
brain_list
=
portal
.
portal_catalog
(
uid
=
uid
)
if
brain_list
:
name
=
brain_list
[
0
].
getObject
().
getTitle
()
title_for_uid_cache
[
uid
]
=
name
return
name
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.py
View file @
b0e4c683
...
...
@@ -5,7 +5,6 @@ except:
Redirect
=
'Redirect'
portal
=
context
.
getPortalObject
()
stool
=
portal
.
portal_selections
getObject
=
portal
.
portal_catalog
.
getObject
countMessage
=
portal
.
portal_activities
.
countMessage
invoice_type_list
=
portal
.
getPortalInvoiceTypeList
()
...
...
@@ -13,7 +12,7 @@ stool.updateSelectionCheckedUidList(selection_name, listbox_uid, uids)
selection_uid_list
=
context
.
portal_selections
.
getSelectionCheckedUidsFor
(
selection_name
)
if
selection_uid_list
:
object_list
=
[
getObject
(
uid
)
for
uid
in
selection_uid_list
]
object_list
=
[
brain
.
getObject
()
for
brain
in
portal
.
portal_catalog
(
uid
=
selection_uid_list
)
]
else
:
object_list
=
stool
.
callSelectionFor
(
selection_name
)
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createReversalTransactionList.py
View file @
b0e4c683
...
...
@@ -5,14 +5,13 @@ except:
Redirect
=
'Redirect'
portal
=
context
.
getPortalObject
()
stool
=
portal
.
portal_selections
getObject
=
portal
.
portal_catalog
.
getObject
countMessage
=
portal
.
portal_activities
.
countMessage
stool
.
updateSelectionCheckedUidList
(
selection_name
,
listbox_uid
,
uids
)
selection_uid_list
=
context
.
portal_selections
.
getSelectionCheckedUidsFor
(
selection_name
)
if
selection_uid_list
:
object_list
=
[
getObject
(
uid
)
for
uid
in
selection_uid_list
]
object_list
=
[
brain
.
getObject
()
for
brain
in
portal
.
portal_catalog
(
uid
=
selection_uid_list
)
]
else
:
object_list
=
stool
.
callSelectionFor
(
selection_name
)
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingLineReportLineList.py
View file @
b0e4c683
...
...
@@ -42,8 +42,7 @@ if section_category:
checked_uid_list
=
\
portal_selections
.
getSelectionCheckedUidsFor
(
selection_name
)
if
checked_uid_list
:
getObject
=
portal
.
portal_catalog
.
getObject
delivery_list
=
[
getObject
(
uid
)
for
uid
in
checked_uid_list
]
delivery_list
=
[
brain
.
getObject
()
for
brain
in
portal
.
portal_catalog
(
uid
=
checked_uid_list
)]
else
:
params
=
portal_selections
.
getSelectionParamsFor
(
selection_name
)
params
[
'limit'
]
=
None
# XXX potentially very big report
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getDetailedAgedBalanceLineList.py
View file @
b0e4c683
...
...
@@ -26,13 +26,15 @@ def getAccountNumber(account_url):
portal
.
restrictedTraverse
(
account_url
).
Account_getGapId
()
return
account_number_memo
[
account_url
]
section_title_memo
=
{}
section_title_memo
=
{
None
:
''
}
def
getSectionTitle
(
uid
):
try
:
return
section_title_memo
[
uid
]
except
KeyError
:
section_title_memo
[
uid
]
=
\
portal
.
portal_catalog
.
getObject
(
uid
).
getTranslatedTitle
()
section_title
=
''
brain_list
=
portal
.
portal_catalog
(
uid
=
uid
)
if
brain_list
:
section_title_memo
[
uid
]
=
brain_list
[
0
].
getObject
().
getTranslatedTitle
()
return
section_title_memo
[
uid
]
last_period_id
=
'period_%s'
%
len
(
period_list
)
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getGroupingReferenceFastInputTotalSelectedAmount.py
View file @
b0e4c683
...
...
@@ -7,15 +7,14 @@ portal = context.getPortalObject()
selection_name
=
\
context
.
AccountingTransactionModule_viewGroupingFastInputDialog
.
listbox
.
get_value
(
'selection_name'
)
getobject
=
portal
.
portal_catalog
.
getobject
selected_uid_list
=
portal
.
portal_selections
.
getSelectionCheckedUidsFor
(
selection_name
)
total_selected_amount
=
0
# calculate total selected amount
for
uid
in
selected_uid_list
or
[]:
line
=
getobject
(
uid
)
if
line
.
AccountingTransaction_isSourceView
():
total_selected_amount
+=
(
line
.
getSourceInventoriatedTotalAssetPrice
()
or
0
)
else
:
total_selected_amount
+=
(
line
.
getDestinationInventoriatedTotalAssetPrice
()
or
0
)
selected_uid_list
=
portal
.
portal_selections
.
getSelectionCheckedUidsFor
(
selection_name
)
if
selected_uid_list
:
for
line
in
portal
.
portal_catalog
(
uid
=
selected_uid_list
):
line
=
line
.
getObject
()
if
line
.
AccountingTransaction_isSourceView
():
total_selected_amount
+=
(
line
.
getSourceInventoriatedTotalAssetPrice
()
or
0
)
else
:
total_selected_amount
+=
(
line
.
getDestinationInventoriatedTotalAssetPrice
()
or
0
)
return
total_selected_amount
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
View file @
b0e4c683
...
...
@@ -4,7 +4,6 @@ Used as a fast input dialog action.
from
ZTUtils
import
make_query
from
ZODB.POSException
import
ConflictError
portal
=
context
.
getPortalObject
()
getobject
=
portal
.
portal_catalog
.
getobject
stool
=
portal
.
portal_selections
Base_translateString
=
portal
.
Base_translateString
psm
=
Base_translateString
(
'Nothing matches.'
)
...
...
@@ -37,8 +36,8 @@ portal.portal_selections.setSelectionParamsFor(
# calculate total selected amount
total_selected_amount
=
0
if
uids
:
for
uid
in
uids
:
line
=
getobject
(
uid
)
for
line
in
portal
.
portal_catalog
(
uid
=
uids
)
:
line
=
line
.
getObject
(
)
if
line
.
AccountingTransaction_isSourceView
():
# XXX not optimal !
total_selected_amount
+=
(
line
.
getSourceInventoriatedTotalAssetPrice
()
or
0
)
else
:
...
...
@@ -113,13 +112,15 @@ if grouping == 'grouping':
else
:
assert
grouping
==
'ungrouping'
# XXX is uids multi page safe here ?
line_list
=
[
getobject
(
line_uid
)
for
line_uid
in
uids
]
ungrouped_line_list
=
[]
line_list
=
[]
if
uids
:
line_list
=
[
brain
.
getObject
()
for
brain
in
portal
.
portal_catalog
(
uid
=
uids
)]
ungrouped_line_list
=
[]
for
line
in
line_list
:
if
line
.
getGroupingReference
():
ungrouped_line_list
.
extend
(
line
.
AccountingTransactionLine_resetGroupingReference
())
psm
=
Base_translateString
(
'${ungrouped_line_count} lines ungrouped.'
,
mapping
=
dict
(
ungrouped_line_count
=
len
(
ungrouped_line_list
)))
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.py
View file @
b0e4c683
...
...
@@ -12,7 +12,7 @@ def getAccountingPeriodStartDateForSectionCategory(section_category, date):
period_start_date
=
None
for
uid
in
section_uid
:
if
uid
==
-
1
:
continue
# Base_getSectionUidListForSectionCategory returns [-1] if no section_uid exists
section
=
portal
.
portal_catalog
.
getObject
(
uid
)
section
=
portal
.
portal_catalog
(
uid
=
uid
)[
0
].
getObject
(
)
for
ap
in
section
.
contentValues
(
portal_type
=
'Accounting Period'
,
checked_permission
=
'Access contents information'
):
if
ap
.
getSimulationState
()
not
in
(
'planned'
,
'confirmed'
,
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSectionCategory.py
View file @
b0e4c683
...
...
@@ -10,7 +10,7 @@ def getCurrencyForSectionCategory(section_category, section_category_strict):
for
section_uid
in
portal
.
Base_getSectionUidListForSectionCategory
(
section_category
,
section_category_strict
):
if
section_uid
!=
-
1
:
section
=
portal
.
portal_catalog
.
getObject
(
section_uid
)
section
=
portal
.
portal_catalog
(
uid
=
section_uid
)[
0
].
getObject
(
)
currency
=
section
.
getPriceCurrency
()
if
currency
:
currency_set
.
add
(
currency
)
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getMirrorSectionTitle.py
View file @
b0e4c683
...
...
@@ -4,9 +4,9 @@ try:
return
request
.
other
[
context
.
mirror_section_uid
]
except
KeyError
:
if
context
.
mirror_section_uid
:
mirror_section
=
context
.
getPortalObject
().
portal_catalog
.
getobject
(
context
.
mirror_section_uid
)
if
mirror_section
is
not
None
:
mirror_section_title
=
mirror_section
.
getTitle
()
brain_list
=
context
.
getPortalObject
().
portal_catalog
(
uid
=
context
.
mirror_section_uid
)
if
brain_list
:
mirror_section_title
=
brain_list
[
0
].
getObject
()
.
getTitle
()
request
.
other
[
context
.
mirror_section_uid
]
=
mirror_section_title
return
mirror_section_title
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getPaymentTitle.py
View file @
b0e4c683
...
...
@@ -4,9 +4,9 @@ try:
return
request
.
other
[
context
.
payment_uid
]
except
KeyError
:
if
context
.
payment_uid
:
payment
=
context
.
getPortalObject
().
portal_catalog
.
getobject
(
context
.
payment_uid
)
if
payment
is
not
None
:
payment_title
=
payment
.
getTitle
()
brain_list
=
context
.
getPortalObject
().
portal_catalog
(
uid
=
context
.
payment_uid
)
if
brain_list
:
payment_title
=
brain_list
[
0
].
getObject
()
.
getTitle
()
request
.
other
[
context
.
payment_uid
]
=
payment_title
return
payment_title
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Brain_getProjectTitle.py
View file @
b0e4c683
...
...
@@ -4,9 +4,9 @@ try:
return
request
.
other
[
context
.
project_uid
]
except
KeyError
:
if
context
.
project_uid
:
project
=
context
.
getPortalObject
().
portal_catalog
.
getobject
(
context
.
project_uid
)
if
project
is
not
None
:
project_title
=
project
.
getTitle
()
brain_list
=
context
.
getPortalObject
().
portal_catalog
(
uid
=
context
.
project_uid
)
if
brain_list
:
project_title
=
brain_list
[
0
].
getObject
()
.
getTitle
()
request
.
other
[
context
.
project_uid
]
=
project_title
return
project_title
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Movement_getPaymentTitle.py
View file @
b0e4c683
if
brain
.
payment_uid
:
bank_account
=
context
.
getPortalObject
().
portal_catalog
.
getObject
(
brain
.
payment_uid
)
if
bank_account
is
not
None
:
result_list
=
context
.
getPortalObject
().
portal_catalog
(
uid
=
brain
.
payment_uid
)
if
result_list
:
bank_account
=
result_list
[
0
].
getObject
()
# XXX use preference ?
if
bank_account
.
getReference
():
return
'%s - %s'
%
(
bank_account
.
getReference
(),
bank_account
.
getTitle
())
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.py
View file @
b0e4c683
...
...
@@ -72,14 +72,12 @@ net_balance = 0.0
# accounts from PL have a balance calculated differently
is_pl_account
=
False
if
params
.
get
(
'node_uid'
):
if
context
.
getUid
()
==
params
[
'node_uid'
]:
if
context
.
getUid
()
==
params
[
'node_uid'
]:
# shortcut
node
=
context
is_pl_account
=
context
.
isMemberOf
(
'account_type/expense'
)
\
or
context
.
isMemberOf
(
'account_type/income'
)
else
:
node
=
portal
.
portal_catalog
.
getObject
(
params
[
'node_uid'
]
)
is_pl_account
=
node
.
isMemberOf
(
'account_type/expense'
)
\
or
node
.
isMemberOf
(
'account_type/income'
)
node
=
portal
_catalog
(
uid
=
params
[
'node_uid'
])[
0
].
getObject
(
)
is_pl_account
=
node
.
isMemberOf
(
'account_type/expense'
)
\
or
node
.
isMemberOf
(
'account_type/income'
)
# remove unknown catalog keys from params
params
.
pop
(
'detailed_from_date_summary'
,
None
)
...
...
@@ -197,11 +195,11 @@ if from_date or is_pl_account:
node_translated_title
=
node
.
getTranslatedTitle
()
)
if
params
.
get
(
'mirror_section_uid'
):
mirror_section
=
portal
.
portal_catalog
.
getObject
(
params
[
'mirror_section_uid'
]
)
mirror_section
=
portal
.
portal_catalog
(
uid
=
params
[
'mirror_section_uid'
])[
0
].
getObject
(
)
previous_balance
.
edit
(
mirror_section_title
=
mirror_section
.
getTitle
()
)
section
=
portal
.
portal_catalog
.
getObject
(
section_uid
)
section
=
portal
.
portal_catalog
(
uid
=
section_uid
)[
0
].
getObject
(
)
previous_balance
.
edit
(
Movement_getSectionPriceCurrency
=
section
.
getPriceCurrencyReference
(),
resource_reference
=
section
.
getPriceCurrencyReference
(),
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.py
View file @
b0e4c683
...
...
@@ -74,7 +74,7 @@ if period_start_date and params.get('node_uid'):
if
context
.
getUid
()
==
params
[
'node_uid'
]:
# I bet it's context
node
=
context
else
:
node
=
portal
.
portal_catalog
.
getObject
(
params
[
'node_uid'
]
)
node
=
portal
.
portal_catalog
(
uid
=
params
[
'node_uid'
])[
0
].
getObject
(
)
if
node
.
isMemberOf
(
'account_type/expense'
)
or
\
node
.
isMemberOf
(
'account_type/income'
):
# For expense or income accounts, we only take into account transactions
...
...
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