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
Lisa Casino
slapos.core
Commits
d5db6e2c
Commit
d5db6e2c
authored
Jul 22, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Update source when while clone Open Sale Order
parent
49c5a91a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
28 deletions
+58
-28
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
...ins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
+6
-2
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
.../portal_components/test.erp5.testSlapOSAccountingAlarm.py
+42
-16
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.xml
...portal_components/test.erp5.testSlapOSAccountingAlarm.xml
+10
-10
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
View file @
d5db6e2c
...
...
@@ -11,13 +11,16 @@ if portal.portal_activities.countMessageWithTag(tag) > 0:
return
def
newOpenOrder
(
open_sale_order
):
open_sale_order_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderTemplate
())
open_order_edit_kw
=
{
'effective_date'
:
DateTime
(),
'activate_kw'
:
activate_kw
,
'source'
:
open_sale_order_template
.
getSource
(),
'source_section'
:
open_sale_order_template
.
getSourceSection
()
}
if
open_sale_order
is
None
:
open_sale_order_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderTemplate
())
new_open_sale_order
=
open_sale_order_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order_edit_kw
.
update
({
'destination'
:
person
.
getRelativeUrl
(),
...
...
@@ -201,6 +204,7 @@ if (delete_line_list):
open_order_explanation
+=
"Removed %s."
%
str
(
delete_line_list
)
storeWorkflowComment
(
new_open_sale_order
,
open_order_explanation
)
open_sale_order
=
new_open_sale_order
if
open_sale_order
is
not
None
:
if
not
len
(
open_sale_order
.
contentValues
(
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
View file @
d5db6e2c
...
...
@@ -296,19 +296,23 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
if
q
.
getValidationState
()
==
'validated'
]
archived_open_sale_order_list
=
[
q
for
q
in
open_sale_order_list
if
q
.
getValidationState
()
==
'archived'
]
self
.
assertEqual
(
1
,
len
(
validated_open_sale_order_list
))
self
.
assertEqual
(
1
,
len
(
archived_open_sale_order_list
))
validated_open_sale_order
=
validated_open_sale_order_list
[
0
].
getObject
()
self
.
assertEqual
(
0
,
len
(
validated_open_sale_order_list
))
self
.
assertEqual
(
2
,
len
(
archived_open_sale_order_list
))
archived_open_sale_order_list
.
sort
(
key
=
lambda
x
:
x
.
getCreationDate
())
last_open_sale_order
=
archived_open_sale_order_list
[
-
1
].
getObject
()
archived_open_sale_order
=
archived_open_sale_order_list
[
0
]
\
.
getObject
()
self
.
assertEqual
(
open_sale_order
.
getRelativeUrl
(),
archived_open_sale_order
.
getRelativeUrl
())
validated_line_list
=
validated
_open_sale_order
.
contentValues
(
last_line_list
=
last
_open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
)
archived_line_list
=
archived_open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
)
self
.
assertEqual
(
0
,
len
(
validated
_line_list
))
self
.
assertEqual
(
0
,
len
(
last
_line_list
))
self
.
assertEqual
(
1
,
len
(
archived_line_list
))
archived_line
=
archived_line_list
[
0
].
getObject
()
...
...
@@ -373,8 +377,13 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
)
self
.
assertEqual
(
2
,
len
(
open_sale_order_list
))
open_sale_order
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
][
0
].
getObject
()
archived_open_sale_order_list
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
and
\
len
(
x
.
objectValues
())
>
0
]
self
.
assertEqual
(
1
,
len
(
archived_open_sale_order_list
))
open_sale_order
=
archived_open_sale_order_list
[
0
].
getObject
()
self
.
assertEqual
(
'archived'
,
open_sale_order
.
getValidationState
())
open_sale_order_line_list
=
open_sale_order
.
contentValues
(
...
...
@@ -398,9 +407,18 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self
.
assertEqual
(
DateTime
(
'2012/02/02'
),
line
.
getStopDate
())
new_open_sale_order
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
==
'validated'
][
0
].
getObject
()
self
.
assertEqual
(
'validated'
,
new_open_sale_order
.
getValidationState
())
new_validated_open_sale_order_list
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
==
'validated'
]
self
.
assertEqual
(
0
,
len
(
new_validated_open_sale_order_list
))
archived_open_sale_order_list
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
]
archived_open_sale_order_list
.
sort
(
key
=
lambda
x
:
x
.
getCreationDate
(),
reverse
=
True
)
new_open_sale_order
=
archived_open_sale_order_list
[
0
]
# The OSO is archived as soon it has no lines anymore.
self
.
assertEqual
(
'archived'
,
new_open_sale_order
.
getValidationState
())
open_sale_order_line_list
=
new_open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
)
self
.
assertEqual
(
0
,
len
(
open_sale_order_line_list
))
...
...
@@ -650,8 +668,12 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
)
self
.
assertEqual
(
2
,
len
(
open_sale_order_list
))
open_sale_order
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
][
0
].
getObject
()
archived_open_sale_order_list
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
]
archived_open_sale_order_list
.
sort
(
key
=
lambda
x
:
x
.
getCreationDate
())
open_sale_order
=
archived_open_sale_order_list
[
0
].
getObject
()
self
.
assertEqual
(
'archived'
,
open_sale_order
.
getValidationState
())
open_sale_order_line_list
=
open_sale_order
.
contentValues
(
...
...
@@ -676,9 +698,13 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self
.
assertEqual
(
addToDate
(
line
.
getStartDate
(),
to_add
=
{
'day'
:
1
}),
line
.
getStopDate
())
new_open_sale_order
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
==
'validated'
][
0
].
getObject
()
self
.
assertEqual
(
'validated'
,
new_open_sale_order
.
getValidationState
())
archived_open_sale_order_list
=
[
x
for
x
in
open_sale_order_list
\
if
x
.
getValidationState
()
!=
'validated'
]
archived_open_sale_order_list
.
sort
(
key
=
lambda
x
:
x
.
getCreationDate
())
new_open_sale_order
=
archived_open_sale_order_list
[
-
1
].
getObject
()
self
.
assertEqual
(
'archived'
,
new_open_sale_order
.
getValidationState
())
new_effective_date
=
new_open_sale_order
.
getEffectiveDate
()
open_sale_order_line_list
=
new_open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
)
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.xml
View file @
d5db6e2c
...
...
@@ -47,16 +47,16 @@
<value>
<tuple>
<string>
W: 31, 10: Use of eval (eval-used)
</string>
<string>
W:7
59
, 20: Use of eval (eval-used)
</string>
<string>
W:7
60
, 23: Use of eval (eval-used)
</string>
<string>
W:
781
, 20: Use of eval (eval-used)
</string>
<string>
W:
782
, 23: Use of eval (eval-used)
</string>
<string>
W:8
47
, 20: Use of eval (eval-used)
</string>
<string>
W:8
48
, 23: Use of eval (eval-used)
</string>
<string>
W:8
57
, 20: Use of eval (eval-used)
</string>
<string>
W:8
58
, 23: Use of eval (eval-used)
</string>
<string>
W:9
21
, 35: Use of eval (eval-used)
</string>
<string>
W:9
22
, 31: Use of eval (eval-used)
</string>
<string>
W:7
85
, 20: Use of eval (eval-used)
</string>
<string>
W:7
86
, 23: Use of eval (eval-used)
</string>
<string>
W:
807
, 20: Use of eval (eval-used)
</string>
<string>
W:
808
, 23: Use of eval (eval-used)
</string>
<string>
W:8
73
, 20: Use of eval (eval-used)
</string>
<string>
W:8
74
, 23: Use of eval (eval-used)
</string>
<string>
W:8
83
, 20: Use of eval (eval-used)
</string>
<string>
W:8
84
, 23: Use of eval (eval-used)
</string>
<string>
W:9
47
, 35: Use of eval (eval-used)
</string>
<string>
W:9
48
, 31: Use of eval (eval-used)
</string>
</tuple>
</value>
</item>
...
...
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