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
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
Xavier Thompson
slapos.core
Commits
884a4698
Commit
884a4698
authored
Apr 15, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Only reset if Payment Mode for supported modes
This avoids edit already modified instances.
parent
2e934779
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_resetPaymentMode.py
...pos_accounting/SaleInvoiceTransaction_resetPaymentMode.py
+2
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+24
-0
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_resetPaymentMode.py
View file @
884a4698
...
...
@@ -6,4 +6,5 @@ assert "Sale Invoice Transaction" == context.getPortalType()
assert
"stopped"
==
context
.
getSimulationState
()
# Edit as Manager to workarround security when cancel Sale Invoice Transaction
context
.
edit
(
payment_mode
=
None
)
if
context
.
getPaymentMode
()
in
[
"payzen"
,
"wechat"
]:
context
.
edit
(
payment_mode
=
None
)
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
884a4698
...
...
@@ -225,3 +225,27 @@ return context.getParentValue()""")
self
.
assertTrue
(
redirect
.
endswith
(
'%s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported.'
%
sale_invoice_transaction
.
getRelativeUrl
()),
"%s doesn't end with %s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported."
%
(
redirect
,
sale_invoice_transaction
.
getRelativeUrl
()))
def
test_SaleInvoiceTransaction_resetPaymentMode
(
self
):
sale_invoice_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
"Sale Invoice Transaction"
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"unknown"
,
start_date
=
DateTime
(),
stop_date
=
DateTime
())
sale_invoice_transaction
.
confirm
()
sale_invoice_transaction
.
start
(
)
sale_invoice_transaction
.
stop
()
sale_invoice_transaction
.
SaleInvoiceTransaction_resetPaymentMode
()
self
.
assertEqual
(
sale_invoice_transaction
.
getPaymentMode
(),
"unknown"
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"payzen"
)
sale_invoice_transaction
.
SaleInvoiceTransaction_resetPaymentMode
()
self
.
assertEqual
(
sale_invoice_transaction
.
getPaymentMode
(),
None
)
sale_invoice_transaction
.
edit
(
payment_mode
=
"wechat"
)
sale_invoice_transaction
.
SaleInvoiceTransaction_resetPaymentMode
()
self
.
assertEqual
(
sale_invoice_transaction
.
getPaymentMode
(),
None
)
self
.
assertRaises
(
Unauthorized
,
sale_invoice_transaction
.
SaleInvoiceTransaction_resetPaymentMode
,
REQUEST
=
{})
\ No newline at end of file
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