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
Carlos Ramos Carreño
slapos.core
Commits
e5f71ee2
Commit
e5f71ee2
authored
Jan 27, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Set proper start/stop date on Transactions generated from the builders
parent
381b1614
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.py
...ns/slapos_accounting/PaymentTransaction_postOrderBuild.py
+4
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
...simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
+34
-6
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.py
View file @
e5f71ee2
from
Products.ERP5Type.Message
import
translateString
payment_transaction
=
context
invoice
=
context
.
getCausalityValue
()
context
.
setStartDate
(
invoice
.
getStartDate
())
context
.
setStopDate
(
invoice
.
getStopDate
())
comment
=
translateString
(
"Initialised by Order Builder."
)
payment_transaction
.
confirm
(
comment
=
comment
)
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
View file @
e5f71ee2
...
...
@@ -10,16 +10,13 @@ invoice = context
price_currency
=
invoice
.
getPriceCurrency
()
if
invoice
.
getResource
()
!=
price_currency
:
invoice
.
setResource
(
price_currency
)
if
invoice
.
getPaymentMode
(
""
)
==
""
:
invoice
.
setPaymentModeValue
(
invoice
.
getPortalObject
().
portal_categories
.
payment_mode
.
payzen
)
comment
=
translateString
(
'Initialised by Delivery Builder.'
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'plan'
):
invoice
.
plan
(
comment
=
comment
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'confirm'
):
invoice
.
confirm
(
comment
=
comment
)
causality_list
=
[]
min_start_date
=
None
max_stop_date
=
None
for
line
in
invoice
.
objectValues
():
related_delivery
=
line
.
getDeliveryRelatedValue
()
if
related_delivery
is
not
None
:
...
...
@@ -29,6 +26,37 @@ for line in invoice.objectValues():
if
causality
is
not
None
and
causality
not
in
causality_list
:
causality_list
.
append
(
causality
)
if
min_start_date
is
None
:
min_start_date
=
line
.
getStartDate
()
elif
line
.
getStartDate
()
<
min_start_date
:
min_start_date
=
line
.
getStartDate
()
if
max_stop_date
is
None
:
max_stop_date
=
line
.
getStopDate
()
elif
line
.
getStopDate
()
>
max_stop_date
:
max_stop_date
=
line
.
getStopDate
()
if
context
.
getStartDate
()
is
None
:
if
min_start_date
is
None
:
min_start_date
=
DateTime
().
earliestTime
()
context
.
setStartDate
(
min_start_date
)
if
max_stop_date
is
None
:
if
min_start_date
is
not
None
:
max_stop_date
=
min_start_date
else
:
max_stop_date
=
DateTime
().
earliestTime
()
context
.
setStopDate
(
max_stop_date
)
if
context
.
getCausalityState
()
==
'draft'
:
context
.
startBuilding
()
comment
=
translateString
(
'Initialised by Delivery Builder.'
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'plan'
):
invoice
.
plan
(
comment
=
comment
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'confirm'
):
invoice
.
confirm
(
comment
=
comment
)
invoice
.
setCausalityList
(
causality_list
)
invoice
.
startBuilding
(
comment
=
comment
)
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