Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
9954e8c8
Commit
9954e8c8
authored
Sep 13, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Create and close accounting period for create Balance Transaction
parent
50dc2fc4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
8 deletions
+47
-8
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5ManualAccountingScenario.py
...nents/test.erp5.testSlapOSERP5ManualAccountingScenario.py
+47
-8
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5ManualAccountingScenario.py
View file @
9954e8c8
...
@@ -11,7 +11,6 @@ from DateTime import DateTime
...
@@ -11,7 +11,6 @@ from DateTime import DateTime
class
TestSlapOSManualAccountingScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
class
TestSlapOSManualAccountingScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
def
bootstrapManualAccountingTest
(
self
):
def
bootstrapManualAccountingTest
(
self
):
currency
,
_
,
_
,
sale_person
=
self
.
bootstrapVirtualMasterTest
()
currency
,
_
,
_
,
sale_person
=
self
.
bootstrapVirtualMasterTest
()
self
.
tic
()
self
.
tic
()
...
@@ -69,6 +68,40 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -69,6 +68,40 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
return
accountant_person
,
accountant_organisation
,
\
return
accountant_person
,
accountant_organisation
,
\
bank_account
,
currency
bank_account
,
currency
def
createBalanceForOrganisation
(
self
,
accountant
,
organisation
,
transaction_list
):
# Group is required and should be unique, else the Balance will
# generate/cover way too much.
self
.
login
()
group
=
self
.
portal
.
portal_categories
.
group
.
newContent
(
id
=
'test_group_%s'
%
self
.
generateNewId
(),
title
=
"Group for %s"
%
organisation
.
getTitle
()
)
self
.
logout
()
self
.
login
(
accountant
.
getUserId
())
organisation
.
setGroup
(
group
.
getId
())
# Create Accounting Period and start
year
=
DateTime
().
strftime
(
"%Y"
)
accounting_period
=
organisation
.
newContent
(
portal_type
=
"Accounting Period"
,
title
=
year
,
start_date
=
DateTime
(
"%s/01/01"
%
year
),
stop_date
=
DateTime
(
"%s/12/31"
%
year
)
)
self
.
portal
.
portal_workflow
.
doActionFor
(
accounting_period
,
"start_action"
)
self
.
tic
()
# Close all transactions before close the period.
for
transaction
in
transaction_list
:
self
.
portal
.
portal_workflow
.
doActionFor
(
transaction
,
"deliver_action"
)
self
.
tic
()
self
.
portal
.
portal_workflow
.
doActionFor
(
accounting_period
,
"stop_action"
,
profit_and_loss_account
=
"account_module/profit_loss"
)
self
.
tic
()
def
groupAndAssertLineList
(
self
,
entity
,
line_list
):
def
groupAndAssertLineList
(
self
,
entity
,
line_list
):
# Emulate the Grouping fast input
# Emulate the Grouping fast input
grouped_line_list
=
entity
.
AccountingTransaction_guessGroupedLines
(
grouped_line_list
=
entity
.
AccountingTransaction_guessGroupedLines
(
...
@@ -94,7 +127,6 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -94,7 +127,6 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
transaction
.
getSimulationState
(),
'stopped'
)
self
.
assertEqual
(
transaction
.
getSimulationState
(),
'stopped'
)
def
test_purchase_invoice_transaction
(
self
,
provider_as_organisation
=
False
):
def
test_purchase_invoice_transaction
(
self
,
provider_as_organisation
=
False
):
"""
"""
Accountant creates a Purchase Invoice Transaction and group it with a
Accountant creates a Purchase Invoice Transaction and group it with a
...
@@ -202,12 +234,12 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -202,12 +234,12 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
groupAndAssertLineList
(
self
.
groupAndAssertLineList
(
provider
,
[
payable_line
,
purchase_payable_line
])
provider
,
[
payable_line
,
purchase_payable_line
])
self
.
createBalanceForOrganisation
(
accountant_person
,
accountant_organisation
,
[
payment
,
transaction
])
def
test_purchase_invoice_transaction_organisation
(
self
):
def
test_purchase_invoice_transaction_organisation
(
self
):
self
.
test_purchase_invoice_transaction
(
provider_as_organisation
=
False
)
self
.
test_purchase_invoice_transaction
(
provider_as_organisation
=
False
)
# def test_balance_transaction(self):
# Do fake balance for 2023 ?
def
test_accounting_transaction
(
self
,
customer_as_organisation
=
False
):
def
test_accounting_transaction
(
self
,
customer_as_organisation
=
False
):
""" Basic scenario for accountant create an Accounting transaction
""" Basic scenario for accountant create an Accounting transaction
to rembourse a customer (person by default)
to rembourse a customer (person by default)
...
@@ -306,6 +338,9 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -306,6 +338,9 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
groupAndAssertLineList
(
self
.
groupAndAssertLineList
(
customer
,
[
payable_line
,
accounting_payable_line
])
customer
,
[
payable_line
,
accounting_payable_line
])
self
.
createBalanceForOrganisation
(
accountant_person
,
accountant_organisation
,
[
payment
,
transaction
])
def
test_accounting_transaction_organisation
(
self
):
def
test_accounting_transaction_organisation
(
self
):
""" Basic scenario for accountant create an Accounting transaction
""" Basic scenario for accountant create an Accounting transaction
to rembourse a customer (organisation)
to rembourse a customer (organisation)
...
@@ -326,11 +361,12 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -326,11 +361,12 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
'Sale Trade Condition'
,
portal_type
=
'Sale Trade Condition'
,
trade_condition_type
=
'default'
,
trade_condition_type
=
'default'
,
reference
=
'manual_accounting_for_%s'
%
accountant_
organisati
on
.
getReference
(),
reference
=
'manual_accounting_for_%s'
%
accountant_
pers
on
.
getReference
(),
specialise_value
=
business_process_module
.
slapos_manual_accounting_business_process
specialise_value
=
business_process_module
.
slapos_manual_accounting_business_process
)
)
self
.
portal
.
portal_workflow
.
doActionFor
(
trade_condition
,
'validate_action'
)
self
.
assertEqual
(
trade_condition
.
checkConsistency
(),
[])
self
.
assertEqual
(
trade_condition
.
checkConsistency
(),
[])
self
.
tic
()
self
.
login
(
accountant_person
.
getUserId
())
self
.
login
(
accountant_person
.
getUserId
())
...
@@ -427,6 +463,9 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -427,6 +463,9 @@ class TestSlapOSManualAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
groupAndAssertLineList
(
self
.
groupAndAssertLineList
(
customer
,
[
receivable_line
,
transaction
.
receivable
])
customer
,
[
receivable_line
,
transaction
.
receivable
])
self
.
createBalanceForOrganisation
(
accountant_person
,
accountant_organisation
,
[
payment
,
transaction
])
def
test_sale_invoice_transaction_organisation
(
self
):
def
test_sale_invoice_transaction_organisation
(
self
):
""" Basic scenario for accountant create an Sale invoice transaction
""" Basic scenario for accountant create an Sale invoice transaction
to sell services for a customer (Organisation)
to sell services for a customer (Organisation)
...
...
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