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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
aeaee08d
Commit
aeaee08d
authored
Mar 31, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open_trade: fix pylint messages and enable coding style test
parent
1fc37201
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
166 additions
and
128 deletions
+166
-128
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderCell.py
...lateItem/portal_components/document.erp5.OpenOrderCell.py
+31
-31
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderCell.xml
...ateItem/portal_components/document.erp5.OpenOrderCell.xml
+25
-15
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderLine.py
...lateItem/portal_components/document.erp5.OpenOrderLine.py
+44
-44
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderLine.xml
...ateItem/portal_components/document.erp5.OpenOrderLine.xml
+25
-22
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.SubscriptionItem.py
...eItem/portal_components/document.erp5.SubscriptionItem.py
+11
-3
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.SubscriptionItem.xml
...Item/portal_components/document.erp5.SubscriptionItem.xml
+25
-7
bt5/erp5_open_trade/SkinTemplateItem/portal_skins/erp5_open_trade/OpenOrderLine_asCellRange.py
...portal_skins/erp5_open_trade/OpenOrderLine_asCellRange.py
+2
-2
bt5/erp5_open_trade/SkinTemplateItem/portal_skins/erp5_open_trade/OpenOrder_updateSimulation.py
...ortal_skins/erp5_open_trade/OpenOrder_updateSimulation.py
+3
-3
bt5/erp5_open_trade/bt/skip_coding_style_test
bt5/erp5_open_trade/bt/skip_coding_style_test
+0
-1
No files found.
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderCell.py
View file @
aeaee08d
...
...
@@ -31,38 +31,38 @@ from Products.ERP5Type import Permissions, PropertySheet
from
erp5.component.document.SupplyCell
import
SupplyCell
class
OpenOrderCell
(
SupplyCell
):
"""
An Open Order Cell allows to define specific properties
for each variation of a resource in an Open Order Line.
"""
meta_type
=
'ERP5 Open Order Cell'
portal_type
=
'Open Order Cell'
add_permission
=
Permissions
.
AddPortalContent
"""
An Open Order Cell allows to define specific properties
for each variation of a resource in an Open Order Line.
"""
meta_type
=
'ERP5 Open Order Cell'
portal_type
=
'Open Order Cell'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
Discount
,
PropertySheet
.
Path
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
Reference
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
Discount
,
PropertySheet
.
Path
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
Reference
)
def
getTotalPrice
(
self
):
"""Returns the total price for this open order cell.
Unlike Amount, we do not calculate a price implicitly if not defined.
Actually, I (jerome) think amount behaviour itself if wrong.
"""
return
(
self
.
getQuantity
()
or
0
)
*
(
self
.
getPrice
()
or
0
)
def
getTotalPrice
(
self
):
"""Returns the total price for this open order cell.
Unlike Amount, we do not calculate a price implicitly if not defined.
Actually, I (jerome) think amount behaviour itself if wrong.
"""
return
(
self
.
getQuantity
()
or
0
)
*
(
self
.
getPrice
()
or
0
)
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderCell.xml
View file @
aeaee08d
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
OpenOrderCell
</string>
</value>
...
...
@@ -43,18 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 34, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 38, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 39, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 43, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 44, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 47, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 62, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -64,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -83,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -92,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderLine.py
View file @
aeaee08d
...
...
@@ -32,54 +32,54 @@ from Products.ERP5Type import Permissions, PropertySheet
from
erp5.component.document.SupplyLine
import
SupplyLine
class
OpenOrderLine
(
SupplyLine
):
"""
An Open Order Line is a Supply Line with additional
properties to define repeatability
"""
An Open Order Line is a Supply Line with additional
properties to define repeatability
"""
meta_type
=
'ERP5 Open Order Line'
portal_type
=
'Open Order Line'
add_permission
=
Permissions
.
AddPortalContent
"""
meta_type
=
'ERP5 Open Order Line'
portal_type
=
'Open Order Line'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
VariationRange
,
PropertySheet
.
Path
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
Predicate
,
PropertySheet
.
Comment
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
VariationRange
,
PropertySheet
.
Path
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
Predicate
,
PropertySheet
.
Comment
)
def
getTotalQuantity
(
self
,
default
=
0
):
"""Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are
returned.
"""
if
self
.
hasCellContent
(
base_id
=
'path'
):
return
sum
([
cell
.
getQuantity
()
for
cell
in
self
.
getCellValueList
(
base_id
=
'path'
)])
return
self
.
getQuantity
(
default
)
def
getTotalQuantity
(
self
,
default
=
0
):
"""Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are
returned.
"""
if
self
.
hasCellContent
(
base_id
=
'path'
):
return
sum
([
cell
.
getQuantity
()
for
cell
in
self
.
getCellValueList
(
base_id
=
'path'
)])
return
self
.
getQuantity
(
default
)
def
getTotalPrice
(
self
):
"""Returns the total price for this open order line.
If the order line contains cells, the total price of cells are
returned.
"""
if
self
.
hasCellContent
(
base_id
=
'path'
):
return
sum
([
cell
.
getTotalPrice
()
for
cell
in
self
.
getCellValueList
(
base_id
=
'path'
)])
return
SupplyLine
.
getTotalPrice
(
self
)
def
getTotalPrice
(
self
):
"""Returns the total price for this open order line.
If the order line contains cells, the total price of cells are
returned.
"""
if
self
.
hasCellContent
(
base_id
=
'path'
):
return
sum
([
cell
.
getTotalPrice
()
for
cell
in
self
.
getCellValueList
(
base_id
=
'path'
)])
return
SupplyLine
.
getTotalPrice
(
self
)
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.OpenOrderLine.xml
View file @
aeaee08d
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
OpenOrderLine
</string>
</value>
...
...
@@ -43,25 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 35, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 42, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 45, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 46, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 49, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 66, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 70, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 73, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 75, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 76, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 81, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 83, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -71,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -90,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -99,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.SubscriptionItem.py
View file @
aeaee08d
...
...
@@ -226,7 +226,7 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return
None
return
open_order_line
.
getQuantityUnit
(
checked_permission
=
checked_permission
)
def
getPrice
(
self
):
def
getPrice
(
self
,
context
=
None
):
open_order_line
=
self
.
getAggregateRelatedValue
(
portal_type
=
'Open Sale Order Line'
)
if
open_order_line
is
None
:
return
None
...
...
@@ -262,8 +262,16 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin,
return
[]
return
open_order_line
.
getSpecialiseValueList
()
def
_getCategoryMembershipList
(
self
,
category
,
spec
=
(),
filter
=
None
,
portal_type
=
(),
base
=
0
,
keep_default
=
1
,
checked_permission
=
None
,
**
kw
):
def
_getCategoryMembershipList
(
self
,
category
,
spec
=
(),
filter
=
None
,
# pylint:disable=redefined-builtin
portal_type
=
(),
base
=
0
,
keep_default
=
1
,
checked_permission
=
None
,
**
kw
):
if
category
==
'specialise'
:
open_order_line
=
self
.
getAggregateRelatedValue
(
portal_type
=
'Open Sale Order Line'
)
return
open_order_line
.
_getCategoryMembershipList
(
category
,
spec
=
spec
,
filter
=
filter
,
...
...
bt5/erp5_open_trade/DocumentTemplateItem/portal_components/document.erp5.SubscriptionItem.xml
View file @
aeaee08d
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SubscriptionItem
</string>
</value>
...
...
@@ -43,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:229, 2: Arguments number differs from overridden \'getPrice\' method (arguments-differ)
</string>
<string>
W:265, 58: Redefining built-in \'filter\' (redefined-builtin)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -56,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -75,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_open_trade/SkinTemplateItem/portal_skins/erp5_open_trade/OpenOrderLine_asCellRange.py
View file @
aeaee08d
...
...
@@ -6,10 +6,10 @@ if resource is not None:
for
base_category
in
base_category_list
:
if
matrixbox
:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range
.
append
(
map
(
lambda
x
:
(
x
[
1
],
x
[
0
]),
context
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,),
display_id
=
'translated_title'
)
)
)
cell_range
.
append
(
[(
x
[
1
],
x
[
0
])
for
x
in
context
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,),
display_id
=
'translated_title'
)]
)
else
:
cell_range
.
append
(
context
.
getVariationCategoryList
(
base_category_list
=
(
base_category
,)
)
)
cell_range
=
filter
(
lambda
x
:
x
!=
[],
cell_range
)
cell_range
=
[
x
for
x
in
cell_range
if
x
!=
[]]
return
cell_range
bt5/erp5_open_trade/SkinTemplateItem/portal_skins/erp5_open_trade/OpenOrder_updateSimulation.py
View file @
aeaee08d
...
...
@@ -3,7 +3,7 @@ subscription_item_set = set()
for
open_order_line
in
context
.
objectValues
():
for
ob
in
[
open_order_line
]
+
open_order_line
.
getCellValueList
():
for
item
in
ob
.
getAggregateValueList
():
if
getattr
(
item
.
aq_explicit
,
'updateSimulation'
,
None
)
is
not
None
and
\
if
getattr
(
item
.
aq_explicit
,
'updateSimulation'
,
None
)
is
not
None
and
\
item
not
in
subscription_item_set
:
subscription_item_set
.
add
(
item
)
item
.
updateSimulation
(
expand_root
=
1
)
subscription_item_set
.
add
(
item
)
item
.
updateSimulation
(
expand_root
=
1
)
bt5/erp5_open_trade/bt/skip_coding_style_test
deleted
100644 → 0
View file @
1fc37201
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