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
aaeff4af
Commit
aaeff4af
authored
Jun 07, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: fixup the packing list start_date
parent
bcdbc917
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
...t.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
+7
-7
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/OpenSaleOrderCell_createDiscountSalePackingList.py
...equest/OpenSaleOrderCell_createDiscountSalePackingList.py
+8
-4
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
View file @
aaeff4af
...
@@ -72,7 +72,7 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
...
@@ -72,7 +72,7 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# compute_node
# compute_node
self
.
logout
()
self
.
logout
()
with
PinnedDateTime
(
self
,
DateTime
(
'202
4/01
/29'
)):
with
PinnedDateTime
(
self
,
DateTime
(
'202
3/12
/29'
)):
public_reference
=
'public-%s'
%
self
.
generateNewId
()
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/01'
)):
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/01'
)):
...
@@ -95,7 +95,7 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
...
@@ -95,7 +95,7 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
self
.
login
(
person_user_id
)
self
.
login
(
person_user_id
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/0
2
/10'
)):
with
PinnedDateTime
(
self
,
DateTime
(
'2024/0
1
/10'
)):
self
.
personRequestInstanceNotReady
(
self
.
personRequestInstanceNotReady
(
software_release
=
software_release
,
software_release
=
software_release
,
software_type
=
software_type
,
software_type
=
software_type
,
...
@@ -150,8 +150,8 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
...
@@ -150,8 +150,8 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
}
}
inventory_list
=
self
.
portal
.
portal_simulation
.
getCurrentInventoryList
(
**
inventory_list_kw
)
inventory_list
=
self
.
portal
.
portal_simulation
.
getCurrentInventoryList
(
**
inventory_list_kw
)
self
.
assertEquals
(
1
,
len
(
inventory_list
))
self
.
assertEquals
(
1
,
len
(
inventory_list
))
#
1
- 0.42 (13 days of 31) - 0.1 (3 days of 31) + 1 - 0.83 (24 days of 29)
#
2
- 0.42 (13 days of 31) - 0.1 (3 days of 31) + 1 - 0.83 (24 days of 29)
self
.
assertAlmostEquals
(
-
0
.65
,
inventory_list
[
0
].
total_quantity
)
self
.
assertAlmostEquals
(
-
1
.65
,
inventory_list
[
0
].
total_quantity
)
inventory_list_kw
=
{
inventory_list_kw
=
{
'group_by_section'
:
False
,
'group_by_section'
:
False
,
...
@@ -172,14 +172,14 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
...
@@ -172,14 +172,14 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# 1 instance tree
# 1 instance tree
# 7 open sale order
# 7 open sale order
# 4 assignment
# 4 assignment
#
3
simulation movement
#
4
simulation movement
#
6
sale packing list / line
#
7
sale packing list / line
# 2 sale trade condition ( a 3rd trade condition is not linked to the project)
# 2 sale trade condition ( a 3rd trade condition is not linked to the project)
# 1 software instance
# 1 software instance
# 1 software product
# 1 software product
# 1 subscription change request
# 1 subscription change request
# 2 subscription request
# 2 subscription request
self
.
assertRelatedObjectCount
(
project
,
3
0
)
self
.
assertRelatedObjectCount
(
project
,
3
2
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
self
.
checkERP5StateBeforeExit
()
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/OpenSaleOrderCell_createDiscountSalePackingList.py
View file @
aaeff4af
...
@@ -12,9 +12,13 @@ if open_sale_order_cell.getPortalType() == 'Open Sale Order Cell':
...
@@ -12,9 +12,13 @@ if open_sale_order_cell.getPortalType() == 'Open Sale Order Cell':
start_date
=
open_sale_order
.
getStartDate
()
start_date
=
open_sale_order
.
getStartDate
()
next_period_date
=
hosting_subscription
.
getNextPeriodicalDate
(
current_date
)
next_period_date
=
hosting_subscription
.
getNextPeriodicalDate
(
current_date
)
# Calculate the start_date of the monthly packing list
previous_period_date
=
start_date
while
hosting_subscription
.
getNextPeriodicalDate
(
previous_period_date
)
<
next_period_date
:
previous_period_date
=
hosting_subscription
.
getNextPeriodicalDate
(
previous_period_date
)
if
open_sale_order
.
getValidationState
()
==
'validated'
:
if
open_sale_order
.
getValidationState
()
==
'validated'
:
unused_day_count
=
current_date
-
start
_date
unused_day_count
=
current_date
-
previous_period
_date
elif
open_sale_order
.
getValidationState
()
==
'archived'
:
elif
open_sale_order
.
getValidationState
()
==
'archived'
:
unused_day_count
=
next_period_date
-
current_date
unused_day_count
=
next_period_date
-
current_date
else
:
else
:
...
@@ -22,7 +26,7 @@ else:
...
@@ -22,7 +26,7 @@ else:
sale_packing_list_edit_kw
=
dict
(
sale_packing_list_edit_kw
=
dict
(
title
=
title
,
title
=
title
,
start_date
=
start
_date
,
start_date
=
previous_period
_date
,
# It should match the first open order invoice
# It should match the first open order invoice
stop_date
=
next_period_date
,
stop_date
=
next_period_date
,
specialise_value
=
open_sale_order
.
getSpecialiseValue
(),
specialise_value
=
open_sale_order
.
getSpecialiseValue
(),
...
@@ -49,7 +53,7 @@ if (0 < unused_day_count):
...
@@ -49,7 +53,7 @@ if (0 < unused_day_count):
sale_packing_list
=
portal
.
sale_packing_list_module
.
newContent
(
sale_packing_list
=
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
"Sale Packing List"
,
portal_type
=
"Sale Packing List"
,
comment
=
"%s unused days of %s"
%
(
unused_day_count
,
next_period_date
-
start
_date
),
comment
=
"%s unused days of %s"
%
(
unused_day_count
,
next_period_date
-
previous_period
_date
),
**
sale_packing_list_edit_kw
**
sale_packing_list_edit_kw
)
)
...
@@ -82,7 +86,7 @@ if (0 < unused_day_count):
...
@@ -82,7 +86,7 @@ if (0 < unused_day_count):
else
:
else
:
sale_packing_list_cell
=
sale_packing_list_line
sale_packing_list_cell
=
sale_packing_list_line
quantity
=
open_sale_order_cell
.
getQuantity
()
*
(
unused_day_count
/
(
next_period_date
-
start
_date
))
quantity
=
open_sale_order_cell
.
getQuantity
()
*
(
unused_day_count
/
(
next_period_date
-
previous_period
_date
))
# precision = context.getQuantityPrecisionFromResource(open_sale_order_cell.getResourceValue())
# precision = context.getQuantityPrecisionFromResource(open_sale_order_cell.getResourceValue())
# XXX Stock does not seem to use quantity unit precision...
# XXX Stock does not seem to use quantity unit precision...
precision
=
2
precision
=
2
...
...
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