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
75caeccd
Commit
75caeccd
authored
Nov 09, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: configure Sale Supply predicate
parent
6ee74e48
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
13 deletions
+85
-13
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyCell_asPredicate.py
...tal_skins/slapos_accounting/SaleSupplyCell_asPredicate.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyCell_asPredicate.xml
...al_skins/slapos_accounting/SaleSupplyCell_asPredicate.xml
+62
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyLine_asPredicate.py
...tal_skins/slapos_accounting/SaleSupplyLine_asPredicate.py
+19
-10
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyLine_asPredicate.xml
...al_skins/slapos_accounting/SaleSupplyLine_asPredicate.xml
+1
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSSaleSupply.py
...eItem/portal_components/test.erp5.testSlapOSSaleSupply.py
+2
-2
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyCell_asPredicate.py
0 → 100644
View file @
75caeccd
return
context
.
SaleSupplyLine_asPredicate
(
*
args
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleSupplyCell_asPredicate.xml
0 → 100644
View file @
75caeccd
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SaleSupplyCell_asPredicate
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SupplyLine_asPredicate.py
→
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/S
aleS
upplyLine_asPredicate.py
View file @
75caeccd
parent
=
context
.
getParentValue
()
if
(
parent
.
getPortalType
()
!=
'Sale Supply'
)
or
(
parent
.
getValidationState
()
!=
'validated'
):
supply
=
context
.
getParentValue
()
if
context
.
getPortalType
()
==
'Sale Supply Line'
:
# If resource has variation, do not use the Line as a predicate
if
context
.
getVariationRangeBaseCategoryList
():
return
None
base_category_tuple
=
[
'resource'
,
'price_currency'
]
if
context
.
getPortalType
()
==
'Sale Supply Cell'
:
base_category_tuple
.
extend
(
supply
.
getVariationRangeBaseCategoryList
())
supply
=
supply
.
getParentValue
()
if
(
supply
.
getPortalType
()
!=
'Sale Supply'
)
or
(
supply
.
getValidationState
()
!=
'validated'
):
# If this supply line is not in a validated Sale Supply, it does not apply.
return
None
base_category_tuple
=
(
'resource'
,
'price_currency'
)
if
context
.
getSourceSection
():
base_category_tuple
+=
(
'source_section'
,
)
base_category_tuple
.
append
(
'source_section'
)
if
context
.
getDestinationSection
():
base_category_tuple
+=
(
'destination_section'
,
)
base_category_tuple
.
append
(
'destination_section'
)
if
context
.
getSource
():
base_category_tuple
+=
(
'source'
,
)
base_category_tuple
.
append
(
'source'
)
if
context
.
getDestination
():
base_category_tuple
+=
(
'destination'
,
)
base_category_tuple
.
append
(
'destination'
)
if
context
.
getSourceProject
():
base_category_tuple
+=
(
'source_project'
,
)
base_category_tuple
.
append
(
'source_project'
)
if
context
.
getDestinationProject
():
base_category_tuple
+=
(
'destination_project'
,
)
base_category_tuple
.
append
(
'destination_project'
)
#backwards compatibility
mapped_value_property_list
=
context
.
getMappedValuePropertyList
()
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SupplyLine_asPredicate.xml
→
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/S
aleS
upplyLine_asPredicate.xml
View file @
75caeccd
...
...
@@ -54,7 +54,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SupplyLine_asPredicate
</string>
</value>
<value>
<string>
S
aleS
upplyLine_asPredicate
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSSaleSupply.py
View file @
75caeccd
...
...
@@ -138,7 +138,7 @@ class TestSlapOSSaleSupply(SlapOSTestCaseMixin):
(
destination
==
sale_supply_cell
.
getParentValue
().
getParentValue
().
getDestinationValue
()))
and
(
start_date
==
sale_supply_cell
.
getParentValue
().
getParentValue
().
getStartDateRangeMin
())
)
assert
sale_supply_cell
.
test
(
tmp_context
)
==
expected_test_result
,
"""Expected: %s %i
assert
sale_supply_cell
.
test
(
tmp_context
)
==
expected_test_result
,
"""Expected: %s %i
%s
Product: %s %s
Type: %s %s
Release: %s %s
...
...
@@ -146,7 +146,7 @@ Project: %s %s
Destination: %s %s
Date: %s %s
"""
%
(
expected_test_result
,
i
,
expected_test_result
,
i
,
sale_supply_cell
.
getRelativeUrl
(),
software_product
.
getRelativeUrl
(),
sale_supply_cell
.
getResource
(),
software_type
.
getRelativeUrl
(),
sale_supply_cell
.
getSoftwareType
(),
software_release
.
getRelativeUrl
(),
sale_supply_cell
.
getSoftwareRelease
(),
...
...
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