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
Titouan Soulard
erp5
Commits
3912504f
Commit
3912504f
authored
Nov 11, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! accounting: fix validation of accounting transactions with too precise amounts
there was also another script for internal
parent
56c827ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
8 deletions
+64
-8
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_statInternalTransactionLineList.py
...rnalInvoiceTransaction_statInternalTransactionLineList.py
+18
-8
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
...emplateItem/portal_components/test.erp5.testAccounting.py
+46
-0
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/InternalInvoiceTransaction_statInternalTransactionLineList.py
View file @
3912504f
...
...
@@ -8,21 +8,31 @@ total_source_asset_credit = 0
total_destination_asset_debit
=
0
total_destination_asset_credit
=
0
currency_precision
=
context
.
getQuantityPrecisionFromResource
(
context
.
getResource
())
source_section_precision
=
2
source_section
=
context
.
getSourceSectionValue
(
portal_type
=
'Organisation'
)
if
source_section
is
not
None
:
source_section_precision
=
context
.
getQuantityPrecisionFromResource
(
source_section
.
getPriceCurrency
())
destination_section_precision
=
2
destination_section
=
context
.
getDestinationSectionValue
(
portal_type
=
'Organisation'
)
if
destination_section
is
not
None
:
destination_section_precision
=
context
.
getQuantityPrecisionFromResource
(
destination_section
.
getPriceCurrency
())
source_section
=
context
.
getSourceSection
()
destination_section
=
context
.
getDestinationSection
()
for
line
in
context
.
objectValues
(
portal_type
=
context
.
getPortalAccountingMovementTypeList
())
:
if
line
.
getSource
()
and
line
.
getSourceSection
()
==
source_section
:
total_source_debit
+=
line
.
getSourceDebit
(
)
total_source_asset_debit
+=
line
.
getSourceInventoriatedTotalAssetDebit
(
)
total_source_credit
+=
line
.
getSourceCredit
(
)
total_source_asset_credit
+=
line
.
getSourceInventoriatedTotalAssetCredit
(
)
total_source_debit
+=
round
(
line
.
getSourceDebit
(),
currency_precision
)
total_source_asset_debit
+=
round
(
line
.
getSourceInventoriatedTotalAssetDebit
(),
source_section_precision
)
total_source_credit
+=
round
(
line
.
getSourceCredit
(),
currency_precision
)
total_source_asset_credit
+=
round
(
line
.
getSourceInventoriatedTotalAssetCredit
(),
source_section_precision
)
if
line
.
getDestination
()
\
and
line
.
getDestinationSection
()
==
destination_section
:
total_destination_debit
+=
line
.
getDestinationDebit
(
)
total_destination_asset_debit
+=
line
.
getDestinationInventoriatedTotalAssetDebit
(
)
total_destination_credit
+=
line
.
getDestinationCredit
(
)
total_destination_asset_credit
+=
line
.
getDestinationInventoriatedTotalAssetCredit
(
)
total_destination_debit
+=
round
(
line
.
getDestinationDebit
(),
currency_precision
)
total_destination_asset_debit
+=
round
(
line
.
getDestinationInventoriatedTotalAssetDebit
(),
destination_section_precision
)
total_destination_credit
+=
round
(
line
.
getDestinationCredit
(),
currency_precision
)
total_destination_asset_credit
+=
round
(
line
.
getDestinationInventoriatedTotalAssetCredit
(),
destination_section_precision
)
return
[
Object
(
source_debit
=
total_source_debit
,
...
...
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
View file @
3912504f
...
...
@@ -5984,6 +5984,52 @@ class TestInternalInvoiceTransaction(AccountingTestCase):
for
line
in
payment
.
getMovementList
(
portal_type
=
'Internal Invoice Transaction Line'
)])
def
test_InternalInvoiceTransaction_statInternalTransactionLineList
(
self
):
internal_invoice
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Internal Invoice Transaction'
,
source_section_value
=
self
.
section
,
destination_section_value
=
self
.
main_section
,
start_date
=
DateTime
(
2015
,
1
,
1
),
created_by_builder
=
True
,
)
# line1 counts for both source and destination
internal_invoice
.
newContent
(
source_value
=
self
.
portal
.
account_module
.
receivable
,
destination_value
=
self
.
portal
.
account_module
.
receivable
,
source_debit
=
1
,
# destination_credit=1
source_asset_debit
=
0.1111111
,
destination_asset_credit
=
0.222222
,
)
# line2 does not count for source, it's another section
internal_invoice
.
newContent
(
source_section_value
=
self
.
portal
.
organisation_module
.
client_1
,
source_value
=
self
.
portal
.
account_module
.
receivable
,
destination_value
=
self
.
portal
.
account_module
.
receivable
,
destination_debit
=
3
,
destination_asset_debit
=
0.44444
,
source_asset_debit
=
10000
,
)
# line3 does not count for destination, it's another section
internal_invoice
.
newContent
(
source_value
=
self
.
portal
.
account_module
.
receivable
,
destination_value
=
self
.
portal
.
account_module
.
receivable
,
destination_section_value
=
self
.
portal
.
organisation_module
.
client_1
,
source_credit
=
5
,
source_asset_credit
=
0.555555
,
destination_asset_debit
=
1000
,
)
stat_internal_transaction
,
=
internal_invoice
.
InternalInvoiceTransaction_statInternalTransactionLineList
()
self
.
assertEqual
(
stat_internal_transaction
.
source_debit
,
1
)
# line1
self
.
assertEqual
(
stat_internal_transaction
.
source_asset_debit
,
0.11
)
# line1
self
.
assertEqual
(
stat_internal_transaction
.
source_credit
,
5
)
# line3
self
.
assertEqual
(
stat_internal_transaction
.
source_asset_credit
,
0.56
)
# line3
self
.
assertEqual
(
stat_internal_transaction
.
destination_debit
,
3
)
# line2
self
.
assertEqual
(
stat_internal_transaction
.
destination_asset_debit
,
0.44
)
# line2
self
.
assertEqual
(
stat_internal_transaction
.
destination_credit
,
1
)
# line1
self
.
assertEqual
(
stat_internal_transaction
.
destination_asset_credit
,
0.22
)
# line1
class
TestAccountingAlarms
(
AccountingTestCase
):
def
test_check_payable_receivable_account_grouped
(
self
):
...
...
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