Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
erp5
Commits
2178cbed
Commit
2178cbed
authored
Mar 09, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdm: fix pylint messages and enable coding style test
parent
22cb0a5c
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
66 additions
and
275 deletions
+66
-275
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Amount_hashVariationCategoryItemList.py
...al_skins/erp5_pdm/Amount_hashVariationCategoryItemList.py
+5
-4
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Amount_hashVariationCategoryItemList.xml
...l_skins/erp5_pdm/Amount_hashVariationCategoryItemList.xml
+1
-1
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/AssortedResource_asCellRange.py
...tem/portal_skins/erp5_pdm/AssortedResource_asCellRange.py
+10
-180
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/ResourceModule_getSelection.py
...Item/portal_skins/erp5_pdm/ResourceModule_getSelection.py
+1
-10
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
...skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
+0
-2
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getScaledInventoryList.py
.../portal_skins/erp5_pdm/Resource_getScaledInventoryList.py
+11
-13
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asCellRange.py
...plateItem/portal_skins/erp5_pdm/SupplyLine_asCellRange.py
+2
-2
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.py
..._skins/erp5_pdm/Transformation_getAggregatedAmountList.py
+7
-7
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getReportSectionList.py
...tal_skins/erp5_pdm/Transformation_getReportSectionList.py
+2
-17
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getReportSectionList.xml
...al_skins/erp5_pdm/Transformation_getReportSectionList.xml
+1
-1
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getTotalDuration.py
.../portal_skins/erp5_pdm/Transformation_getTotalDuration.py
+7
-12
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getTotalPrice.py
...tem/portal_skins/erp5_pdm/Transformation_getTotalPrice.py
+8
-10
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_asCellRange.py
.../portal_skins/erp5_pdm/TransformedResource_asCellRange.py
+5
-7
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_completeQuantityMatrix.py
...ns/erp5_pdm/TransformedResource_completeQuantityMatrix.py
+0
-1
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_completeVariationMatrix.py
...s/erp5_pdm/TransformedResource_completeVariationMatrix.py
+0
-2
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_hashVariationCategoryItemList.py
..._pdm/TransformedResource_hashVariationCategoryItemList.py
+5
-4
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_hashVariationCategoryItemList.xml
...pdm/TransformedResource_hashVariationCategoryItemList.xml
+1
-1
bt5/erp5_pdm/bt/skip_coding_style_test
bt5/erp5_pdm/bt/skip_coding_style_test
+0
-1
No files found.
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Amount_hashVariationCategoryItemList.py
View file @
2178cbed
# Remove empty items
if
default_sub_field_property_dict
is
None
:
item_list
=
filter
(
lambda
x
:
x
not
in
[(
''
,
''
),
[
''
,
''
]],
default_sub_field_property_dict
=
{}
item_list
)
sub_field_dict
=
{}
sub_field_dict
=
{}
split_depth
=
1
split_depth
=
1
for
item
in
item_list
:
for
item
in
item_list
:
# Remove empty items
if
item
in
((
''
,
''
),
[
''
,
''
]):
continue
# Get value of the item
# Get value of the item
item_value
=
item
[
int
(
not
is_right_display
)]
item_value
=
item
[
int
(
not
is_right_display
)]
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Amount_hashVariationCategoryItemList.xml
View file @
2178cbed
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
{}
, is_right_display=0
</string>
</value>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
None
, is_right_display=0
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/AssortedResource_asCellRange.py
View file @
2178cbed
# from Products.ERP5Type.Utils import cartesianProduct
from
Products.ERP5Type.Utils
import
cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def
cartesianProduct
(
list_of_list
):
if
len
(
list_of_list
)
==
0
:
return
[[]]
result
=
[]
head
=
list_of_list
[
0
]
tail
=
list_of_list
[
1
:]
product
=
cartesianProduct
(
tail
)
for
v
in
head
:
for
p
in
product
:
result
+=
[[
v
]
+
p
]
return
result
line
=
[]
line
=
[]
column
=
[]
column
=
[]
tab
=
[]
tab
=
[]
transformation
=
context
.
getParentValue
()
transformation
=
context
.
getParentValue
()
# security.declareProtected(Permissions.AccessContentsInformation, 'getQLineItemList')
# def getQLineItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# """
# line_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[0]
# #LOG('getQLineItemList', 0, "%s" % str(line_category))
# if line_category is None:
# result = [(None,'')]
# else:
# result = self.getVariationRangeCategoryItemList(base_category_list = [line_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# #LOG('getQLineItemList', 10, "%s" % str(result))
# return result
# security.declareProtected(Permissions.AccessContentsInformation, 'getQColumnItemList')
# def getQColumnItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# """
# column_category = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[1]
# #LOG('getQColumnItemList', 0, "%s" % str(column_category))
# if column_category is None:
# result = [(None,'')]
# else:
# result = self.getVariationRangeCategoryItemList(base_category_list = [column_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# #LOG('getQColumnItemList', 0, "%s" % str(result))
# return result
# security.declareProtected(Permissions.AccessContentsInformation, 'getQTabItemList')
# def getQTabItemList(self, display_id='getTitle', base=1, current_category=None):
# """
# Returns a list of items which can be used as index for
# each tab of a matrix or to define a cell range.
# """
# tab_category_list = self._getSortedBaseCategoryList(self.getQVariationBaseCategoryList())[2:]
# tab_category_item_list_list = []
# for tab_category in tab_category_list:
# tab_category_item_list = self.getVariationRangeCategoryItemList(base_category_list = [tab_category],
# display_id=display_id,
# base=base,
# current_category=current_category)
# tab_category_item_list_list.append(tab_category_item_list)
# transformation = self.getParentValue()
# transformation_category_item_list = transformation.getVariationCategoryItemList(
# display_id=display_id,
# base=base,
# current_category=current_category)
# tab_category_item_list_list.append(transformation_category_item_list)
# if len(tab_category_item_list_list) > 0:
# product_list = cartesianProduct(tab_category_item_list_list)
# result = []
# for item_list in product_list:
# value_list = []
# label_list = []
# for item in item_list:
# value_list.append(item[0])
# label_list.append(item[1])
# result.append((value_list, label_list))
# else:
# result = [(None,'')]
# return result
# base_cell_id possible value: 'quantity', 'variation'
# base_cell_id possible value: 'quantity', 'variation'
base_cell_id
=
'quantity'
base_cell_id
=
'quantity'
...
@@ -160,43 +13,20 @@ get_variation_base_category_method_dict = {
...
@@ -160,43 +13,20 @@ get_variation_base_category_method_dict = {
'variation'
:
'getVVariationBaseCategoryList'
'variation'
:
'getVVariationBaseCategoryList'
}
}
# from Products.ERP5Type.Utils import cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def
cartesianProduct
(
list_of_list
):
if
len
(
list_of_list
)
==
0
:
return
[[]]
result
=
[]
head
=
list_of_list
[
0
]
tail
=
list_of_list
[
1
:]
product
=
cartesianProduct
(
tail
)
for
v
in
head
:
for
p
in
product
:
result
+=
[[
v
]
+
p
]
return
result
line
=
[]
column
=
[]
tab
=
[]
transformation
=
context
.
getParentValue
()
# Those value are define on property sheet of portal type
# Those value are define on property sheet of portal type
line_base_category
=
transformation
.
getVariationBaseCategoryLine
()
line_base_category
=
transformation
.
getVariationBaseCategoryLine
()
column_base_category
=
transformation
.
getVariationBaseCategoryColumn
()
column_base_category
=
transformation
.
getVariationBaseCategoryColumn
()
# Calculate line and column
# Calculate line and column
for
axe
,
axe_base_category
in
[(
line
,
line_base_category
),(
column
,
column_base_category
)]:
for
axe
,
axe_base_category
in
[(
line
,
line_base_category
),
(
column
,
column_base_category
)]:
clist
=
[]
clist
=
[]
#if axe_base_category in context.getVVariationBaseCategoryList():
#if axe_base_category in context.getVVariationBaseCategoryList():
if
axe_base_category
in
getattr
(
context
,
get_variation_base_category_method_dict
[
base_cell_id
])():
if
axe_base_category
in
getattr
(
context
,
get_variation_base_category_method_dict
[
base_cell_id
])():
if
matrixbox
:
if
matrixbox
==
1
:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
axe
+=
map
(
lambda
x
:
(
x
[
1
],
x
[
0
]),
transformation
.
getVariationCategoryItemList
(
base_category_list
=
(
axe_base_category
,)
)
)
axe
.
extend
([(
x
[
1
],
x
[
0
])
for
x
in
transformation
.
getVariationCategoryItemList
(
base_category_list
=
(
axe_base_category
,)
)]
)
else
:
else
:
axe
+=
transformation
.
getVariationCategoryList
(
base_category_list
=
(
axe_base_category
,)
)
axe
.
extend
(
transformation
.
getVariationCategoryList
(
base_category_list
=
(
axe_base_category
,)
)
)
# Calculate tab
# Calculate tab
# We can only display 3 dimension, so, we use a cartesian product to decrease matrix dimension
# We can only display 3 dimension, so, we use a cartesian product to decrease matrix dimension
...
@@ -207,11 +37,11 @@ for c in base_category_list:
...
@@ -207,11 +37,11 @@ for c in base_category_list:
if
not
c
in
(
line_base_category
,
column_base_category
):
if
not
c
in
(
line_base_category
,
column_base_category
):
#if c in context.getVVariationBaseCategoryList():
#if c in context.getVVariationBaseCategoryList():
if
c
in
getattr
(
context
,
get_variation_base_category_method_dict
[
base_cell_id
])():
if
c
in
getattr
(
context
,
get_variation_base_category_method_dict
[
base_cell_id
])():
if
matrixbox
==
1
:
if
matrixbox
:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
base_category
+=
[
map
(
lambda
x
:
(
x
[
1
],
x
[
0
]),
transformation
.
getVariationCategoryItemList
(
base_category_list
=
(
c
,)
))
]
base_category
.
extend
([(
x
[
1
],
x
[
0
])
for
x
in
transformation
.
getVariationCategoryItemList
(
base_category_list
=
(
c
,))
])
else
:
else
:
base_category
+=
[
transformation
.
getVariationCategoryList
(
base_category_list
=
(
c
,)
)
]
base_category
.
extend
(
transformation
.
getVariationCategoryList
(
base_category_list
=
(
c
,)))
if
len
(
base_category
)
>
0
:
if
len
(
base_category
)
>
0
:
# Then make a cartesian product
# Then make a cartesian product
...
@@ -222,12 +52,12 @@ if len(base_category) > 0:
...
@@ -222,12 +52,12 @@ if len(base_category) > 0:
for
c
in
clist
:
for
c
in
clist
:
if
matrixbox
==
1
:
if
matrixbox
==
1
:
# XXX matrixbox is right display
# XXX matrixbox is right display
tab
.
append
(
(
repr
(
map
(
lambda
x
:
x
[
0
],
c
))
,
repr
(
map
(
lambda
x
:
x
[
1
],
c
))
)
)
tab
.
append
(
(
repr
([
x
[
0
]
for
x
in
c
]),
repr
([
x
[
1
]
for
x
in
c
]))
)
else
:
else
:
tab
.
append
(
repr
(
c
)
)
tab
.
append
(
repr
(
c
)
)
# Try fill line first, then column, and after tab
# Try fill line first, then column, and after tab
for
i
in
range
(
2
):
for
_
in
range
(
2
):
if
line
==
[]:
if
line
==
[]:
tmp
=
line
tmp
=
line
line
=
column
line
=
column
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/ResourceModule_getSelection.py
View file @
2178cbed
...
@@ -11,15 +11,6 @@ def getPreferredCategoryDisplayMethodId():
...
@@ -11,15 +11,6 @@ def getPreferredCategoryDisplayMethodId():
return
method
==
'getTranslatedCompactTitle'
and
'getCompactTranslatedTitle'
\
return
method
==
'getTranslatedCompactTitle'
and
'getCompactTranslatedTitle'
\
or
method
or
method
# Zope: waiting for __builtin__.set
set
=
lambda
seq
:
dict
((
k
,
None
)
for
k
in
seq
).
iterkeys
()
# Zope: waiting for __builtin__.sorted
def
sorted
(
seq
):
l
=
list
(
seq
)
l
.
sort
()
return
l
class
ResourceSelection
:
class
ResourceSelection
:
"""
"""
Helper class to handle a selection of resources.
Helper class to handle a selection of resources.
...
@@ -67,7 +58,7 @@ class ResourceSelection:
...
@@ -67,7 +58,7 @@ class ResourceSelection:
return
common_quantity_unit_item_list
return
common_quantity_unit_item_list
def
getCommonTransformedResourceItemList
(
self
):
def
getCommonTransformedResourceItemList
(
self
):
return
[(
r
.
title
,
r
.
relative_url
)
for
r
in
\
return
[(
r
.
title
,
r
.
relative_url
)
for
r
in
\
context
.
Resource_zGetTransformedResourceList
(
resource_uid
=
self
.
getUidList
())]
context
.
Resource_zGetTransformedResourceList
(
resource_uid
=
self
.
getUidList
())]
self
=
ResourceSelection
()
self
=
ResourceSelection
()
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
View file @
2178cbed
from
math
import
log
result
=
context
.
getPriceParameterDict
(
context
=
movement
,
**
kw
)
result
=
context
.
getPriceParameterDict
(
context
=
movement
,
**
kw
)
# Calculate
# Calculate
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getScaledInventoryList.py
View file @
2178cbed
...
@@ -11,11 +11,9 @@ sampling_amount inventory lines, sorted by date.
...
@@ -11,11 +11,9 @@ sampling_amount inventory lines, sorted by date.
# XXX: Might be set in preferences
# XXX: Might be set in preferences
sampling_amount
=
kwargs
.
get
(
'sampling_amount'
,
20
)
sampling_amount
=
kwargs
.
get
(
'sampling_amount'
,
20
)
from
Products.ERP5Type.Document
import
newTempDocument
from
DateTime
import
DateTime
from
DateTime
import
DateTime
resource
=
context
resource
=
context
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
node
=
portal
.
restrictedTraverse
(
kwargs
.
get
(
'node'
))
node
=
portal
.
restrictedTraverse
(
kwargs
.
get
(
'node'
))
...
@@ -47,7 +45,6 @@ inventory_tuple_list = []
...
@@ -47,7 +45,6 @@ inventory_tuple_list = []
precise_time_format
=
'%Y/%m/%d %H:%M.%S'
precise_time_format
=
'%Y/%m/%d %H:%M.%S'
base_time_format
=
precise_time_format
base_time_format
=
precise_time_format
rough_time_form
=
'%Y/%m/%d'
# XXX: Below performance issues:
# XXX: Below performance issues:
# * sampling made in dumb way - it shall use SQL
# * sampling made in dumb way - it shall use SQL
# * inventory is invoked 3 times for each sample
# * inventory is invoked 3 times for each sample
...
@@ -72,15 +69,16 @@ for i in range(0,sampling_amount):
...
@@ -72,15 +69,16 @@ for i in range(0,sampling_amount):
inventory_tuple_list
.
append
(
internal_tuple
)
inventory_tuple_list
.
append
(
internal_tuple
)
return_list
=
[]
return_list
=
[]
for
a
in
range
(
0
,
len
(
inventory_tuple_list
)):
for
a
in
range
(
0
,
len
(
inventory_tuple_list
)):
d
=
newTempDocument
(
portal
,
str
(
a
)
)
data
=
inventory_tuple_list
[
a
]
data
=
inventory_tuple_list
[
a
]
d
.
edit
(
return_list
.
append
(
title
=
'title %s'
%
(
a
,),
portal
.
newContent
(
date
=
data
[
0
],
portal_type
=
'Base'
,
current
=
data
[
1
],
temp_object
=
True
,
available
=
data
[
2
],
id
=
str
(
a
),
future
=
data
[
3
],
title
=
'title %s'
%
(
a
,),
)
date
=
data
[
0
],
return_list
.
append
(
d
)
current
=
data
[
1
],
available
=
data
[
2
],
future
=
data
[
3
],))
return
return_list
return
return_list
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asCellRange.py
View file @
2178cbed
...
@@ -42,11 +42,11 @@ for base_category_list in base_category_list_list:
...
@@ -42,11 +42,11 @@ for base_category_list in base_category_list_list:
if
matrixbox
:
if
matrixbox
:
# XXX matrixbox is right_display (not as listfield)
# XXX matrixbox is right_display (not as listfield)
# => invert display and value in item
# => invert display and value in item
cell_range
.
append
(
map
(
lambda
x
:
(
x
[
1
],
x
[
0
]),
cell_range
.
append
(
[(
x
[
1
],
x
[
0
])
for
x
in
context
.
getVariationRangeCategoryItemList
(
context
.
getVariationRangeCategoryItemList
(
base_category_list
=
base_category_list
,
base_category_list
=
base_category_list
,
display_base_category
=
display_base_category
,
display_base_category
=
display_base_category
,
sort_id
=
'id'
)
)
)
sort_id
=
'id'
)
]
)
else
:
else
:
cell_range
.
append
(
cell_range
.
append
(
context
.
getVariationRangeCategoryList
(
context
.
getVariationRangeCategoryList
(
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.py
View file @
2178cbed
from
Products.ERP5Type.Document
import
newTempAmount
tmp_context
=
context
.
newContent
(
tmp_context
=
newTempAmount
(
context
,
"temp_context"
,
id
=
"temp_context"
,
quantity
=
1.0
,
portal_type
=
"Amount"
,
variation_category_list
=
reference_variation_category_list
,
temp_object
=
True
,
resource
=
context
.
getRelativeUrl
())
quantity
=
1.0
,
variation_category_list
=
reference_variation_category_list
,
resource
=
context
.
getRelativeUrl
())
price_currency
=
kw
.
get
(
'price_currency'
,
None
)
price_currency
=
kw
.
get
(
'price_currency'
,
None
)
result
=
context
.
getAggregatedAmountList
(
tmp_context
)
result
=
context
.
getAggregatedAmountList
(
tmp_context
)
final_result
=
[]
for
line
in
result
:
for
line
in
result
:
resource
=
line
.
getResourceValue
()
resource
=
line
.
getResourceValue
()
sender_value
=
None
if
resource
is
not
None
:
if
resource
is
not
None
:
sender
=
line
.
getResourceValue
().
getPurchaseSupplyLineSource
()
sender
=
line
.
getResourceValue
().
getPurchaseSupplyLineSource
()
line
.
setCategoryMembership
(
'source'
,
sender
)
line
.
setCategoryMembership
(
'source'
,
sender
)
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getReportSectionList.py
View file @
2178cbed
from
Products.ERP5Type.Utils
import
cartesianProduct
from
Products.ERP5Form.Report
import
ReportSection
from
Products.ERP5Form.Report
import
ReportSection
REQUEST
=
context
.
REQUEST
REQUEST
=
context
.
REQUEST
...
@@ -9,20 +10,6 @@ elif reference_variation_category_list == []:
...
@@ -9,20 +10,6 @@ elif reference_variation_category_list == []:
result
=
[]
result
=
[]
# from Products.ERP5Type.Utils import cartesianProduct
# XXX unable to import cartesianProduct, so, I copied the code (Romain)
def
cartesianProduct
(
list_of_list
):
if
len
(
list_of_list
)
==
0
:
return
[[]]
result
=
[]
head
=
list_of_list
[
0
]
tail
=
list_of_list
[
1
:]
product
=
cartesianProduct
(
tail
)
for
v
in
head
:
for
p
in
product
:
result
+=
[[
v
]
+
p
]
return
result
# Separate reference_variation_category_list by base category
# Separate reference_variation_category_list by base category
variation_category_dict
=
{}
variation_category_dict
=
{}
for
variation_category
in
reference_variation_category_list
:
for
variation_category
in
reference_variation_category_list
:
...
@@ -33,9 +20,7 @@ for variation_category in reference_variation_category_list:
...
@@ -33,9 +20,7 @@ for variation_category in reference_variation_category_list:
variation_category_dict
[
base_category
]
=
[
variation_category
]
variation_category_dict
[
base_category
]
=
[
variation_category
]
variation_key_list
=
cartesianProduct
(
variation_category_dict
.
values
()
)
variation_key_list
=
cartesianProduct
(
variation_category_dict
.
values
()
)
portal
=
context
.
portal_url
.
getPortalObject
()
for
variation_key
in
variation_key_list
:
for
variation_key
in
variation_key_list
:
params
=
{
params
=
{
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getReportSectionList.xml
View file @
2178cbed
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
reference_variation_category_list=
[]
</string>
</value>
<value>
<string>
reference_variation_category_list=
()
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getTotalDuration.py
View file @
2178cbed
if
selection_name
is
not
None
:
if
selection_name
is
not
None
:
reference_variation_category_list
=
context
.
portal_selections
.
getSelectionParamsFor
(
selection_name
)[
'reference_variation_category_list'
]
reference_variation_category_list
=
context
.
portal_selections
.
getSelectionParamsFor
(
selection_name
)[
'reference_variation_category_list'
]
from
Products.ERP5Type.Document
import
newTempAmount
tmp_context
=
context
.
newContent
(
tmp_context
=
newTempAmount
(
context
,
"temp_context"
,
id
=
"temp_context"
,
quantity
=
1.0
,
portal_type
=
"Amount"
,
variation_category_list
=
reference_variation_category_list
,
temp_object
=
True
,
resource
=
context
.
getRelativeUrl
())
quantity
=
1.0
,
variation_category_list
=
reference_variation_category_list
,
resource
=
context
.
getRelativeUrl
())
aal
=
context
.
getAggregatedAmountList
(
tmp_context
)
aal
=
context
.
getAggregatedAmountList
(
tmp_context
)
result
=
aal
.
getTotalDuration
()
result
=
aal
.
getTotalDuration
()
return
result
return
result
else
:
return
None
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getTotalPrice.py
View file @
2178cbed
if
selection_name
is
not
None
:
if
selection_name
is
not
None
:
reference_variation_category_list
=
context
.
portal_selections
.
getSelectionParamsFor
(
selection_name
)[
'reference_variation_category_list'
]
reference_variation_category_list
=
context
.
portal_selections
.
getSelectionParamsFor
(
selection_name
)[
'reference_variation_category_list'
]
from
Products.ERP5Type.Document
import
newTempAmount
tmp_context
=
context
.
newContent
(
tmp_context
=
newTempAmount
(
context
,
"temp_context"
,
id
=
"temp_context"
,
quantity
=
1.0
,
portal_type
=
"Amount"
,
variation_category_list
=
reference_variation_category_list
,
temp_object
=
True
,
resource
=
context
.
getRelativeUrl
())
quantity
=
1.0
,
variation_category_list
=
reference_variation_category_list
,
resource
=
context
.
getRelativeUrl
())
price_currency
=
context
.
REQUEST
.
get
(
'price_currency'
,
None
)
price_currency
=
context
.
REQUEST
.
get
(
'price_currency'
,
None
)
aal
=
context
.
getAggregatedAmountList
(
tmp_context
)
aal
=
context
.
getAggregatedAmountList
(
tmp_context
)
for
line
in
aal
:
for
line
in
aal
:
resource
=
line
.
getResourceValue
()
resource
=
line
.
getResourceValue
()
sender_value
=
None
if
resource
is
not
None
:
if
resource
is
not
None
:
sender
=
line
.
getResourceValue
().
getPurchaseSupplyLineSource
()
sender
=
line
.
getResourceValue
().
getPurchaseSupplyLineSource
()
line
.
setCategoryMembership
(
'source'
,
sender
)
line
.
setCategoryMembership
(
'source'
,
sender
)
...
@@ -19,7 +21,3 @@ if selection_name is not None:
...
@@ -19,7 +21,3 @@ if selection_name is not None:
result
=
aal
.
getTotalPrice
()
result
=
aal
.
getTotalPrice
()
return
result
return
result
else
:
return
None
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_asCellRange.py
View file @
2178cbed
...
@@ -13,25 +13,23 @@ line_base_category = transformation.getVariationBaseCategoryLine()
...
@@ -13,25 +13,23 @@ line_base_category = transformation.getVariationBaseCategoryLine()
column_base_category
=
transformation
.
getVariationBaseCategoryColumn
()
column_base_category
=
transformation
.
getVariationBaseCategoryColumn
()
base_category_list
=
transformation
.
getVariationBaseCategoryList
()
base_category_list
=
transformation
.
getVariationBaseCategoryList
()
tab_base_category_list
=
filter
(
lambda
x
:
x
not
in
[
line_base_category
,
tab_base_category_list
=
[
x
for
x
in
base_category_list
if
x
not
in
(
line_base_category
,
column_base_category
)]
column_base_category
],
base_category_list
)
for
c
in
([
line_base_category
,
column_base_category
]
+
tab_base_category_list
):
for
c
in
([
line_base_category
,
column_base_category
]
+
tab_base_category_list
):
# try to display line first, then column, and finally others
# try to display line first, then column, and finally others
if
c
in
getattr
(
context
,
if
c
in
getattr
(
context
,
get_variation_base_category_method_dict
[
base_id
])():
get_variation_base_category_method_dict
[
base_id
])():
# base category was selected by user
# base category was selected by user
if
matrixbox
==
1
:
if
matrixbox
:
# XXX matrixbox is right_display (not as listfield)
# XXX matrixbox is right_display (not as listfield)
# => invert display and value in item
# => invert display and value in item
cell_range
.
append
(
map
(
lambda
x
:
(
x
[
1
],
x
[
0
]),
cell_range
.
append
(
transformation
.
getVariationCategoryItemList
[(
x
[
1
],
x
[
0
])
for
x
in
transformation
.
getVariationCategoryItemList
(
base_category_list
=
(
c
,))])
(
base_category_list
=
(
c
,))))
else
:
else
:
cell_range
.
append
(
transformation
.
getVariationCategoryList
(
cell_range
.
append
(
transformation
.
getVariationCategoryList
(
base_category_list
=
(
c
,)))
base_category_list
=
(
c
,)))
# Remove empty range
# Remove empty range
cell_range
=
filter
(
lambda
x
:
x
!=
[],
cell_range
)
cell_range
=
[
x
for
x
in
cell_range
if
x
!=
[]]
return
cell_range
return
cell_range
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_completeQuantityMatrix.py
View file @
2178cbed
request
=
context
.
REQUEST
consumption_list
=
context
.
getSpecialiseValueList
()
consumption_list
=
context
.
getSpecialiseValueList
()
# convert string to float
# convert string to float
reference_quantity
=
float
(
reference_quantity
)
reference_quantity
=
float
(
reference_quantity
)
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_completeVariationMatrix.py
View file @
2178cbed
request
=
context
.
REQUEST
cell_key_list
=
context
.
getCellKeyList
(
base_id
=
'variation'
)
cell_key_list
=
context
.
getCellKeyList
(
base_id
=
'variation'
)
for
cell_key
in
cell_key_list
:
for
cell_key
in
cell_key_list
:
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_hashVariationCategoryItemList.py
View file @
2178cbed
# Remove empty items
if
default_sub_field_property_dict
is
None
:
item_list
=
filter
(
lambda
x
:
x
not
in
[(
''
,
''
),
[
''
,
''
]],
default_sub_field_property_dict
=
{}
item_list
)
sub_field_dict
=
{}
sub_field_dict
=
{}
split_depth
=
1
split_depth
=
1
for
item
in
item_list
:
for
item
in
item_list
:
# Remove empty items
if
item
in
((
''
,
''
),
[
''
,
''
]):
continue
# Get value of the item
# Get value of the item
item_value
=
item
[
int
(
not
is_right_display
)]
item_value
=
item
[
int
(
not
is_right_display
)]
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/TransformedResource_hashVariationCategoryItemList.xml
View file @
2178cbed
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
{}
, is_right_display=0
</string>
</value>
<value>
<string>
item_list, value_list, default_sub_field_property_dict=
None
, is_right_display=0
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_pdm/bt/skip_coding_style_test
deleted
100644 → 0
View file @
22cb0a5c
1
\ No newline at end of file
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