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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
7199efe4
Commit
7199efe4
authored
Jan 30, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: set source/destination_project and ledger on created payment
parent
1bd7a349
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
48 deletions
+29
-48
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_createPaymentTransaction.py
...kins/slapos_accounting/Entity_createPaymentTransaction.py
+4
-0
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment.py
...tal_components/test.erp5.testSlapOSEntityCreatePayment.py
+25
-48
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Entity_createPaymentTransaction.py
View file @
7199efe4
...
...
@@ -31,11 +31,15 @@ current_payment = portal.accounting_module.newContent(
portal_type
=
"Payment Transaction"
,
causality
=
current_invoice
.
getRelativeUrl
(),
source_section
=
current_invoice
.
getSourceSection
(),
source_project
=
current_invoice
.
getSourceProject
(),
destination_section
=
current_invoice
.
getDestinationSection
(),
destination_project
=
current_invoice
.
getDestinationProject
(),
resource
=
current_invoice
.
getResource
(),
price_currency
=
current_invoice
.
getResource
(),
specialise
=
current_invoice
.
getSpecialise
(),
destination_section
=
current_invoice
.
getDestinationSection
(),
payment_mode
=
current_invoice
.
getPaymentMode
(),
ledger
=
current_invoice
.
getLedger
(),
start_date
=
current_invoice
.
getStartDate
(),
stop_date
=
current_invoice
.
getStopDate
(),
source_payment
=
'%s/bank_account'
%
current_invoice
.
getSourceSection
(),
# the other place defnied: business process
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSEntityCreatePayment.py
View file @
7199efe4
...
...
@@ -22,7 +22,20 @@
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
class
TestSlapOSEntityCreatePaymentMixin
(
SlapOSTestCaseMixin
):
def
makeSaleInvoiceTransaction
(
self
,
person
=
None
):
project
=
self
.
addProject
()
if
person
is
None
:
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section_value
=
person
,
destination_project_value
=
project
,
ledger
=
'automated'
,
payment_mode
=
self
.
payment_mode
)
return
person
,
invoice
def
sumReceivable
(
self
,
payment_transaction
):
quantity
=
.
0
default_source_uid
=
self
.
portal
.
restrictedTraverse
(
...
...
@@ -44,11 +57,14 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
expected_set
=
[
'causality/%s'
%
invoice
.
getRelativeUrl
(),
'destination_section/%s'
%
invoice
.
getDestinationSection
(),
'destination_project/%s'
%
invoice
.
getDestinationProject
(),
'price_currency/%s'
%
invoice
.
getPriceCurrency
(),
'resource/%s'
%
invoice
.
getResource
(),
'source_payment/organisation_module/slapos/bank_account'
,
'payment_mode/%s'
%
self
.
payment_mode
,
'source_section/%s'
%
invoice
.
getSourceSection
(),
#'source_project/%s' % invoice.getSourceProject(),
'ledger/%s'
%
invoice
.
getLedger
(),
]
self
.
assertSameSet
(
expected_set
,
payment
.
getCategoryList
())
self
.
assertEqual
(
invoice
.
getStartDate
(),
payment
.
getStartDate
())
...
...
@@ -87,12 +103,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
invoice
.
REQUEST
.
set
(
payment_tag
,
None
)
def
_test
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
invoice
.
confirm
()
invoice
.
stop
()
self
.
tic
()
...
...
@@ -101,12 +112,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
invoice
.
confirm
()
invoice
.
stop
()
self
.
tic
()
...
...
@@ -120,12 +126,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice_transaction
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
invoice
.
confirm
()
invoice
.
stop
()
self
.
tic
()
...
...
@@ -135,12 +136,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
assertPayment
(
payment
,
invoice
)
def
_test_twice_indexation
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
invoice
.
confirm
()
invoice
.
stop
()
self
.
tic
()
...
...
@@ -155,15 +151,9 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
tic
()
self
.
assertPayment
(
payment
,
invoice
)
self
.
assertPayment
(
payment2
,
invoice
)
def
_test_cancelled_payment
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
invoice
.
confirm
()
invoice
.
stop
()
self
.
tic
()
...
...
@@ -177,18 +167,10 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
assertPayment
(
payment
,
invoice
)
def
_test_two_invoices
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice_1
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice_1
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice_1
=
self
.
makeSaleInvoiceTransaction
()
invoice_1
.
confirm
()
invoice_1
.
stop
()
invoice_2
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice_2
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
_
,
invoice_2
=
self
.
makeSaleInvoiceTransaction
(
person
=
person
)
invoice_2
.
confirm
()
invoice_2
.
stop
()
self
.
tic
()
...
...
@@ -210,12 +192,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
self
.
assertPayment
(
payment_2
,
invoice_2
)
def
_test_two_lines
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
=
self
.
portal
.
accounting_module
.
template_sale_invoice_transaction
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
payment_mode
=
self
.
payment_mode
)
person
,
invoice
=
self
.
makeSaleInvoiceTransaction
()
self
.
tic
()
default_source_uid
=
self
.
portal
.
restrictedTraverse
(
'account_module/receivable'
).
getUid
()
...
...
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