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
8038182f
Commit
8038182f
authored
Feb 14, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: do not check payment_mode when creating reversal invoice
parent
5086e749
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
22 deletions
+9
-22
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.py
...nvoiceTransaction_createReversalSaleInvoiceTransaction.py
+8
-21
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.xml
...voiceTransaction_createReversalSaleInvoiceTransaction.xml
+1
-1
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.py
View file @
8038182f
""" Create a reversal transaction from current transaction. """
portal
=
context
.
getPortalObject
()
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
not
batch_mode
and
context
.
getPaymentMode
()
not
in
[
"payzen"
,
"wechat"
]:
message
=
context
.
Base_translateString
(
"The payment mode is unsupported."
)
return
context
.
Base_redirect
(
keep_items
=
{
'portal_status_message'
:
message
})
portal
=
context
.
getPortalObject
()
# Check that we are in state that we are waiting for user manual payment
assert
context
.
getPortalType
()
==
'Sale Invoice Transaction'
assert
context
.
getPaymentMode
()
in
(
'payzen'
,
'wechat'
)
assert
context
.
getSimulationState
()
==
'stopped'
assert
context
.
getSimulationState
()
in
(
'stopped'
,
'delivered'
)
assert
context
.
getTotalPrice
()
!=
0
assert
context
.
getLedger
()
==
'automated'
assert
context
.
getSpecialise
(
None
)
is
not
None
# Dont create if the invoice is already pai
e
d
# Dont create if the invoice is already paid
assert
not
context
.
SaleInvoiceTransaction_isLettered
()
payment
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Payment Transaction"
,
simulation_state
=
"started"
,
default_causality_uid
=
context
.
getUid
(),
default_payment_mode_uid
=
[
portal
.
portal_categories
.
payment_mode
.
payzen
.
getUid
(),
portal
.
portal_categories
.
payment_mode
.
wechat
.
getUid
()],
default_causality_uid
=
context
.
getUid
()
)
if
payment
is
not
None
:
payment_mode
=
payment
.
getPaymentMode
()
if
payment_mode
==
'payzen'
and
payment
.
PaymentTransaction_getPayzenId
()[
1
]
is
not
None
:
# The payment transaction will be cancelled by a proper alarm.
raise
ValueError
(
"Payment Transaction is waiting for External Payzen confirmation!"
)
elif
payment_mode
==
'wechat'
and
payment
.
PaymentTransaction_getWechatId
()[
1
]
is
not
None
:
# The payment transaction will be cancelled by a proper alarm.
raise
ValueError
(
"Payment Transaction is waiting for External Wechat confirmation!"
)
raise
ValueError
(
"Payment Transaction is waiting for confirmation!"
)
# Should be safe now to fix everything
context
.
SaleInvoiceTransaction_resetPaymentMode
()
reversal_transaction
=
context
.
Base_createCloneDocument
(
batch_mode
=
1
)
reversal_transaction
.
edit
(
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_createReversalSaleInvoiceTransaction.xml
View file @
8038182f
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
batch_mode=False, **kw
</string>
</value>
<value>
<string>
batch_mode=False,
REQUEST=None,
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
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