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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
f86be183
Commit
f86be183
authored
Mar 09, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trade: fix pylint messages and enable coding style test
parent
7fa83bf4
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
202 additions
and
177 deletions
+202
-177
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.py
...teItem/portal_components/document.erp5.BusinessProcess.py
+5
-5
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.xml
...eItem/portal_components/document.erp5.BusinessProcess.xml
+25
-10
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.py
..._components/document.erp5.DuplicateInventoryConstraint.py
+0
-1
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.xml
...components/document.erp5.DuplicateInventoryConstraint.xml
+62
-46
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.TradeModelPath.py
...ateItem/portal_components/document.erp5.TradeModelPath.py
+11
-3
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.TradeModelPath.xml
...teItem/portal_components/document.erp5.TradeModelPath.xml
+25
-6
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
...teItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
+7
-7
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getPreferredTradeBaseAmountItemList.py
...ns/erp5_trade/Base_getPreferredTradeBaseAmountItemList.py
+0
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/ContainerLine_asCellRange.py
...Item/portal_skins/erp5_trade/ContainerLine_asCellRange.py
+3
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_asCellRange.py
...eItem/portal_skins/erp5_trade/DeliveryLine_asCellRange.py
+3
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_hashVariationCategoryItemList.py
.../erp5_trade/DeliveryLine_hashVariationCategoryItemList.py
+5
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_hashVariationCategoryItemList.xml
...erp5_trade/DeliveryLine_hashVariationCategoryItemList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
...al_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
+0
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
...tal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
+3
-7
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.py
.../portal_skins/erp5_trade/Delivery_getFastInputLineList.py
+22
-23
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.py
...m/portal_skins/erp5_trade/Delivery_getResourceItemList.py
+0
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.py
.../portal_skins/erp5_trade/Delivery_setFastInputLineList.py
+0
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_updateFastInputLineList.xml
...tal_skins/erp5_trade/Delivery_updateFastInputLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryLine_asCellRange.py
...Item/portal_skins/erp5_trade/InventoryLine_asCellRange.py
+2
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_getAggregatedItemList.py
...ortal_skins/erp5_trade/Inventory_getAggregatedItemList.py
+0
-6
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_setInventoryLineList.xml
...ortal_skins/erp5_trade/Inventory_setInventoryLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_updateInventoryLineList.xml
...al_skins/erp5_trade/Inventory_updateInventoryLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_getUseItemList.py
...teItem/portal_skins/erp5_trade/Movement_getUseItemList.py
+0
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_asCellRange.py
...lateItem/portal_skins/erp5_trade/OrderLine_asCellRange.py
+3
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_statOrderStatList.py
.../portal_skins/erp5_trade/OrderModule_statOrderStatList.py
+0
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_generateReference.py
...teItem/portal_skins/erp5_trade/Order_generateReference.py
+2
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_getODTDataDict.py
...plateItem/portal_skins/erp5_trade/Order_getODTDataDict.py
+2
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_printAsODSSummary.py
...teItem/portal_skins/erp5_trade/Order_printAsODSSummary.py
+3
-3
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_printAsODT.py
...nTemplateItem/portal_skins/erp5_trade/Order_printAsODT.py
+2
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PackingList_getODTDataDict.py
...tem/portal_skins/erp5_trade/PackingList_getODTDataDict.py
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PackingList_printAsODT.py
...ateItem/portal_skins/erp5_trade/PackingList_printAsODT.py
+2
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrderLine_getQuantityUnitItemList.py
...skins/erp5_trade/SaleOrderLine_getQuantityUnitItemList.py
+3
-12
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_setSaleOrderLineList.xml
...ortal_skins/erp5_trade/SaleOrder_setSaleOrderLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_updateSaleOrderLineList.xml
...al_skins/erp5_trade/SaleOrder_updateSaleOrderLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.py
...Item/portal_skins/erp5_trade/SalePackingList_fastInput.py
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.xml
...tem/portal_skins/erp5_trade/SalePackingList_fastInput.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_setSalePackingListLineList.xml
...erp5_trade/SalePackingList_setSalePackingListLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_updateSalePackingListLineList.xml
...5_trade/SalePackingList_updateSalePackingListLineList.xml
+1
-1
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.py
...orkflow/inventory_workflow/scripts/validateConsistency.py
+1
-7
bt5/erp5_trade/bt/skip_coding_style_test
bt5/erp5_trade/bt/skip_coding_style_test
+0
-1
No files found.
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.py
View file @
f86be183
...
...
@@ -454,7 +454,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return
filter
(
lambda
x
:
self
.
isTradeStateCompleted
(
explanation
,
x
),
self
.
getTradeStateList
())
return
[
x
for
x
in
self
.
getTradeStateList
()
if
self
.
isTradeStateCompleted
(
explanation
,
x
)]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPartiallyCompletedTradeStateList'
)
def
getPartiallyCompletedTradeStateList
(
self
,
explanation
):
...
...
@@ -464,7 +464,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return
filter
(
lambda
x
:
self
.
isTradeStatePartiallyCompleted
(
explanation
,
x
),
self
.
getTradeStateList
())
return
[
x
for
x
in
self
.
getTradeStateList
()
if
self
.
isTradeStatePartiallyCompleted
(
explanation
,
x
)]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getLatestCompletedTradeStateList'
)
def
getLatestCompletedTradeStateList
(
self
,
explanation
):
...
...
@@ -548,7 +548,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return
filter
(
lambda
x
:
self
.
isTradePhaseCompleted
(
explanation
,
x
),
self
.
getTradePhaseList
())
return
[
x
for
x
in
self
.
getTradePhaseList
()
if
self
.
isTradePhaseCompleted
(
explanation
,
x
)]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPartiallyCompletedTradePhaseList'
)
def
getPartiallyCompletedTradePhaseList
(
self
,
explanation
):
...
...
@@ -558,7 +558,7 @@ class BusinessProcess(Path, XMLObject):
explanation -- an Order, Order Line, Delivery or Delivery Line or
Applied Rule which implicitely defines a simulation subtree
"""
return
filter
(
lambda
x
:
self
.
isTradePhasePartiallyCompleted
(
explanation
,
x
),
self
.
getTradePhaseList
())
return
[
x
for
x
in
self
.
getTradePhaseList
()
if
self
.
isTradePhasePartiallyCompleted
(
explanation
,
x
)]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isTradePhaseCompleted'
)
def
isTradePhaseCompleted
(
self
,
explanation
,
trade_phase
):
...
...
@@ -694,7 +694,7 @@ class BusinessProcess(Path, XMLObject):
kw
=
self
.
_getPropertyAndCategoryDict
(
explanation
,
amount
,
trade_model_path
,
delay_mode
=
delay_mode
)
trade_phase
=
filter_trade_phase
(
trade_model_path
.
getTradePhaseList
())
try
:
kw
[
'trade_phase'
],
=
trade_phase
kw
[
'trade_phase'
],
=
trade_phase
# pylint: disable=unpacking-non-sequence
except
ValueError
:
pass
kw
.
update
(
update_property_dict
)
...
...
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.BusinessProcess.xml
View file @
f86be183
...
...
@@ -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>
BusinessProcess
</string>
</value>
...
...
@@ -43,13 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:457, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
<string>
W:467, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
<string>
W:551, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
<string>
W:561, 11: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
<string>
W:697, 8: Attempting to unpack a non-sequence defined at line 655 (unpacking-non-sequence)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -59,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>
...
...
@@ -78,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>
...
...
@@ -87,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_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.py
View file @
f86be183
...
...
@@ -26,7 +26,6 @@
##############################################################################
from
Products.ERP5Type.mixin.constraint
import
ConstraintMixin
from
zLOG
import
LOG
class
DuplicateInventoryConstraint
(
ConstraintMixin
):
"""
...
...
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.xml
View file @
f86be183
...
...
@@ -6,10 +6,22 @@
</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>
DuplicateInventoryConstraint
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.DuplicateInventoryConstraint
</string>
</value>
...
...
@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
...
...
@@ -31,13 +55,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>
...
...
@@ -50,7 +89,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>
...
...
@@ -59,53 +98,30 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
ERP5TypeTestCase
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1377844470.45
</float>
<string>
GMT+9
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.TradeModelPath.py
View file @
f86be183
...
...
@@ -178,9 +178,17 @@ class TradeModelPath(Path):
result
[
base_category
]
=
category_url_list
return
result
def
_filterCategoryList
(
self
,
category_list
,
category
,
spec
=
(),
filter
=
None
,
portal_type
=
(),
base
=
0
,
keep_default
=
1
,
checked_permission
=
None
):
def
_filterCategoryList
(
self
,
category_list
,
category
,
spec
=
(),
filter
=
None
,
# pylint: disable=redefined-builtin
portal_type
=
(),
base
=
0
,
keep_default
=
1
,
checked_permission
=
None
,
):
"""
XXX - implementation missing
TBD - look at CategoryTool._buildFilter for inspiration
...
...
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.TradeModelPath.xml
View file @
f86be183
...
...
@@ -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>
TradeModelPath
</string>
</value>
...
...
@@ -43,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:182, 26: Redefining built-in \'filter\' (redefined-builtin)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,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>
...
...
@@ -74,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>
...
...
@@ -83,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_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
View file @
f86be183
...
...
@@ -19,18 +19,18 @@ for brain in getattr(context.portal_simulation, inventory_list_method_dict[simul
**
kw
):
if
positive_stock
and
negative_stock
and
not
zero_stock
and
brain
.
inventory
==
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
positive_stock
and
not
negative_stock
and
zero_stock
and
brain
.
inventory
<
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
negative_stock
and
zero_stock
and
not
positive_stock
and
brain
.
inventory
>
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
positive_stock
and
not
negative_stock
and
not
zero_stock
and
brain
.
inventory
<=
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
negative_stock
and
not
positive_stock
and
not
zero_stock
and
brain
.
inventory
>=
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
zero_stock
and
not
positive_stock
and
not
negative_stock
and
brain
.
inventory
!=
0
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
if
not
positive_stock
and
not
negative_stock
and
not
zero_stock
:
result_list
.
append
(
brain
)
result_list
.
append
(
brain
)
return
sorted
(
result_list
,
key
=
lambda
brain
:
(
brain
.
getResourceReference
(),
brain
.
getResourceTitle
(),
brain
.
variation_text
))
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getPreferredTradeBaseAmountItemList.py
View file @
f86be183
from
Products.ERP5Type.Utils
import
UpperCase
portal_categories
=
context
.
portal_categories
portal_preferences
=
context
.
portal_preferences
method_id
=
portal_preferences
.
getPreference
(
'preferred_category_child_item_list_method_id'
,
'getCategoryChildCompactLogicalPathItemList'
)
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/ContainerLine_asCellRange.py
View file @
f86be183
...
...
@@ -4,12 +4,12 @@ if resource is not None:
base_category_list
=
resource
.
getVariationBaseCategoryList
(
omit_optional_variation
=
1
)
for
base_category
in
base_category_list
:
if
matrixbox
==
1
:
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
,)
)
)
)
cell_range
.
append
(
[(
x
[
1
],
x
[
0
])
for
x
in
context
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,))]
)
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_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_asCellRange.py
View file @
f86be183
...
...
@@ -4,12 +4,12 @@ if resource is not None:
base_category_list
=
resource
.
getVariationBaseCategoryList
(
omit_optional_variation
=
1
)
for
base_category
in
base_category_list
:
if
matrixbox
==
1
:
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
,)
)
)
)
cell_range
.
append
(
[(
x
[
1
],
x
[
0
])
for
x
in
context
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,))]
)
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_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_hashVariationCategoryItemList.py
View file @
f86be183
# Remove empty items
item_list
=
filter
(
lambda
x
:
x
not
in
[(
''
,
''
),
[
''
,
''
]],
\
item_list
)
if
default_sub_field_property_dict
is
None
:
default_sub_field_property_dict
=
{}
sub_field_dict
=
{}
split_depth
=
1
resource
=
context
.
getResourceValue
()
...
...
@@ -12,6 +11,9 @@ else :
del
default_sub_field_property_dict
[
'item_list'
]
for
item
in
item_list
:
# Remove empty items
if
item
in
((
''
,
''
),
[
''
,
''
]):
continue
# Get value of the item
item_value
=
item
[
int
(
not
is_right_display
)]
# Hash key from item_value
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryLine_hashVariationCategoryItemList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<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>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
View file @
f86be183
from
Products.PythonScripts.standard
import
Object
line_list
=
[]
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
# XXX use a larger limit
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
View file @
f86be183
...
...
@@ -3,16 +3,12 @@ divergence_messages_list = context.getDivergenceList()
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
global
portal_object
,
new_id
,
l
portal_object
=
context
.
getPortalObject
()
new_id
=
0
l
=
[]
# function to create a new fast input line
def
createInputLine
(
d_message
):
global
portal_object
,
new_id
,
l
new_id
+=
1
def
createInputLine
(
d_message
,
new_id
):
int_len
=
3
o
=
newTempBase
(
portal_object
...
...
@@ -28,8 +24,8 @@ def createInputLine(d_message):
l
.
append
(
o
)
# generate all lines for the fast input form
for
d_message
in
divergence_messages_list
:
createInputLine
(
d_message
)
for
i
,
d_message
in
enumerate
(
divergence_messages_list
)
:
createInputLine
(
d_message
,
i
)
# return the list of fast input lines
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.py
View file @
f86be183
...
...
@@ -3,7 +3,6 @@
read_document_lines to False. Otherwise, it displays on
the fast input all documents lines already added
"""
from
Products.ERP5Type.Document
import
newTempBase
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
trade_document
=
context
...
...
@@ -123,35 +122,35 @@ empty_line_cpt = 1 # this counter is used so that we always add a fix
i
=
len_line_list
+
1
if
read_document_lines
is
False
:
while
empty_line_cpt
<=
lines_num
:
while
i
in
used_id
:
# do not used an id from previously generated lines
i
+=
1
# Retrieve values set by the update script
resource_relative_url
=
getattr
(
request
,
"field_listbox_resource_relative_url_new_%s"
%
i
,
None
)
resource_title
=
getattr
(
request
,
"field_listbox_title_new_%s"
%
i
,
None
)
reference
=
getattr
(
request
,
"field_listbox_reference_new_%s"
%
i
,
None
)
while
i
in
used_id
:
# do not used an id from previously generated lines
i
+=
1
# Retrieve values set by the update script
resource_relative_url
=
getattr
(
request
,
"field_listbox_resource_relative_url_new_%s"
%
i
,
None
)
resource_title
=
getattr
(
request
,
"field_listbox_title_new_%s"
%
i
,
None
)
reference
=
getattr
(
request
,
"field_listbox_reference_new_%s"
%
i
,
None
)
obj
=
trade_document
.
newContent
(
portal_type
=
line_portal_type
,
obj
=
trade_document
.
newContent
(
portal_type
=
line_portal_type
,
id
=
i
,
uid
=
"new_%s"
%
i
,
temp_object
=
1
,
reference
=
None
,
# otherwise it is acquired on parent
is_indexable
=
0
,)
used_id_append
(
i
)
# Set values inputted by user
if
resource_title
not
in
(
''
,
None
):
empty_line_cpt
-=
1
obj
.
edit
(
resource_title
=
resource_title
)
if
reference
not
in
(
''
,
None
):
empty_line_cpt
-=
1
obj
.
edit
(
reference
=
reference
)
used_id_append
(
i
)
# Set values inputted by user
if
resource_title
not
in
(
''
,
None
):
empty_line_cpt
-=
1
obj
.
edit
(
resource_title
=
resource_title
)
if
reference
not
in
(
''
,
None
):
empty_line_cpt
-=
1
obj
.
edit
(
reference
=
reference
)
# if a resource is selected, use it
if
resource_relative_url
not
in
(
''
,
None
):
empty_line_cpt
-=
1
resource
=
portal
.
restrictedTraverse
(
resource_relative_url
)
obj
.
setResourceValue
(
resource
)
empty_line_cpt
+=
1
result_append
(
obj
)
if
resource_relative_url
not
in
(
''
,
None
):
empty_line_cpt
-=
1
resource
=
portal
.
restrictedTraverse
(
resource_relative_url
)
obj
.
setResourceValue
(
resource
)
empty_line_cpt
+=
1
result_append
(
obj
)
return
result
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.py
View file @
f86be183
from
Products.ERP5Type.Cache
import
CachingMethod
portal
=
context
.
getPortalObject
()
if
context
.
getPortalType
()
in
portal
.
getPortalSaleTypeList
():
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.py
View file @
f86be183
...
...
@@ -4,7 +4,6 @@
which were already created so that they are not duplicated.
"""
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Log
import
log
portal
=
context
.
getPortalObject
()
# Retrieve line and cell portal type
...
...
@@ -21,7 +20,6 @@ for line in listbox:
# Only create line if user has selected a resource
if
'listbox_key'
in
line
and
(
line
.
get
(
'resource_relative_url'
,
None
)
not
in
(
""
,
None
)
\
or
line
.
get
(
'source'
,
None
)
not
in
(
""
,
None
)):
line_id
=
line
[
'listbox_key'
]
if
line
.
get
(
'resource_relative_url'
,
None
)
not
in
(
""
,
None
):
product
=
portal
.
restrictedTraverse
(
line
[
"resource_relative_url"
])
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_updateFastInputLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
, **kw
</string>
</value>
<value>
<string>
listbox=
()
, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryLine_asCellRange.py
View file @
f86be183
...
...
@@ -6,10 +6,10 @@ if resource is not None:
for
base_category
in
base_category_list
:
if
matrixbox
==
1
:
# 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
,)
)
)
)
cell_range
.
append
(
[(
x
[
1
],
x
[
0
])
for
x
in
context
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,))]
)
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_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_getAggregatedItemList.py
View file @
f86be183
from
DateTime
import
DateTime
def
sorted
(
seq
):
seq
=
seq
[:]
seq
.
sort
()
return
seq
portal
=
context
.
getPortalObject
()
request
=
portal
.
REQUEST
if
not
at_date
:
at_date
=
DateTime
()
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_setInventoryLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
, form_id=\'view\',**kw
</string>
</value>
<value>
<string>
listbox=
()
, form_id=\'view\',**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Inventory_updateInventoryLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
,**kw
</string>
</value>
<value>
<string>
listbox=
()
,**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Movement_getUseItemList.py
View file @
f86be183
from
Products.ERP5Type.Utils
import
UpperCase
portal_categories
=
context
.
portal_categories
portal_preferences
=
context
.
portal_preferences
method_id
=
portal_preferences
.
getPreference
(
'preferred_category_child_item_list_method_id'
,
'getCategoryChildCompactLogicalPathItemList'
)
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_asCellRange.py
View file @
f86be183
...
...
@@ -8,13 +8,13 @@ if resource is not None:
if
matrixbox
==
1
:
# XXX matrixbox is right_display (not as listfield) =>
# 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
.
getVariationCategoryItemList
(
base_category_list
=
(
base_category
,))
)
)
base_category_list
=
(
base_category
,))
]
)
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_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_statOrderStatList.py
View file @
f86be183
request
=
container
.
REQUEST
RESPONSE
=
request
.
RESPONSE
stat_line
=
request
.
get
(
'stat_line'
,
None
)
return
stat_line
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_generateReference.py
View file @
f86be183
...
...
@@ -4,9 +4,8 @@ and milestones.
"""
translateString
=
context
.
Base_translateString
request
=
context
.
REQUEST
current_type
=
context
.
getPortalType
()
if
not
reference
:
reference
=
'SO'
if
not
reference
:
reference
=
'SO'
def
generateReference
(
prefix
,
order
,
portal_type
):
for
order_line
in
order
.
contentValues
(
portal_type
=
portal_type
):
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_getODTDataDict.py
View file @
f86be183
...
...
@@ -7,7 +7,7 @@ def getSourceReference(line):
for
predicate
in
predicate_list
:
source_reference
=
predicate
.
getSourceReference
()
if
source_reference
:
return
source_reference
return
source_reference
return
''
def
getDestinationReference
(
line
):
...
...
@@ -19,7 +19,7 @@ def getDestinationReference(line):
for
predicate
in
predicate_list
:
destination_reference
=
predicate
.
getDestinationReference
()
if
destination_reference
:
return
destination_reference
return
destination_reference
return
''
#if context.getPortalType() in context.getPortalSaleTypeList():
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_printAsODSSummary.py
View file @
f86be183
# this API uses format= as argument
# pylint: disable=redefined-builtin
# We wants to get data in order to do a nice summary of items inside the order
# This report will mainly usefull when the same resource is ordered on many
# different lines
...
...
@@ -14,15 +17,12 @@ error_kw = {}
default_quantity_unit
=
None
default_quantity_unit_title
=
''
resource_dict
=
{}
summary_quantity_dict
=
{}
object_list
=
[]
untranslatable_column_list
=
[]
# We should not translate some columns
full_total_price
=
0
worker_column_list
=
[]
source_trade_dict
=
{}
context_relative_url
=
context
.
getRelativeUrl
()
def
sortMovement
(
a
,
b
):
return
cmp
(
a
.
getRelativeUrl
(),
b
.
getRelativeUrl
())
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_printAsODT.py
View file @
f86be183
# this API uses format=
# pylint:disable=redefined-builtin
if
target_language
:
container
.
REQUEST
[
'AcceptLanguage'
].
set
(
target_language
,
10
)
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PackingList_getODTDataDict.py
View file @
f86be183
...
...
@@ -9,7 +9,7 @@ def getSourceReference(line):
for
predicate
in
predicate_list
:
source_reference
=
predicate
.
getSourceReference
()
if
source_reference
:
return
source_reference
return
source_reference
return
''
def
getSubLineList
(
obj
):
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PackingList_printAsODT.py
View file @
f86be183
# this API uses format=
# pylint:disable=redefined-builtin
if
target_language
:
container
.
REQUEST
[
'AcceptLanguage'
].
set
(
target_language
,
10
)
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrderLine_getQuantityUnitItemList.py
View file @
f86be183
...
...
@@ -5,15 +5,6 @@ entered on the fast input
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
base_category
=
portal
.
portal_categories
.
quantity_unit
list_method_id
=
portal
.
portal_preferences
.
\
getPreferredCategoryChildItemListMethodId
(
'getCategoryChildCompactLogicalPathItemList'
)
method
=
getattr
(
base_category
,
list_method_id
)
item_list
=
method
(
base
=
0
,
local_sort_id
=
(
'int_index'
,
'translated_title'
),
checked_permission
=
'View'
)
result_item_list
=
[(
''
,
''
)]
resource_value
=
context
.
getResourceValue
()
...
...
@@ -55,9 +46,9 @@ if resource_value is None:
resource_value
=
resource_list
[
0
]
if
resource_value
is
not
None
:
quantity_unit_list
=
[(
x
.
getTranslatedLogicalPath
(),
x
.
getCategoryRelativeUrl
(
base
=
0
))
quantity_unit_list
=
[(
x
.
getTranslatedLogicalPath
(),
x
.
getCategoryRelativeUrl
(
base
=
0
))
for
x
in
resource_value
.
getQuantityUnitValueList
()]
# return the first quantity_unit item of resource
result_item_list
.
extend
(
quantity_unit_list
)
# return the first quantity_unit item of resource
result_item_list
.
extend
(
quantity_unit_list
)
return
result_item_list
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_setSaleOrderLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
, form_id=\'view\',**kw
</string>
</value>
<value>
<string>
listbox=
()
, form_id=\'view\',**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_updateSaleOrderLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
,**kw
</string>
</value>
<value>
<string>
listbox=
()
,**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.py
View file @
f86be183
...
...
@@ -31,7 +31,7 @@ for listitem in listbox :
with
ImmediateReindexContextManager
()
as
immediate_reindex_context_manager
:
# we build 'container_count' containers
for
container_number
in
range
(
container_count
):
for
_
in
range
(
container_count
):
new_container_id
=
'c'
+
str
(
next_container_number
)
# we use container_type to know which are the resource (and variation)
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_fastInput.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=
[]
,cancel_url=\'\',next_container_int_index=1,**kw
</string>
</value>
<value>
<string>
form_id=\'\',selection_index=None,selection_name=\'\',dialog_category=\'object_exchange\',container_count=0,container_type=\'\',gross_weight=0,listbox=
()
,cancel_url=\'\',next_container_int_index=1,**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_setSalePackingListLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
, form_id=\'view\',**kw
</string>
</value>
<value>
<string>
listbox=
()
, form_id=\'view\',**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SalePackingList_updateSalePackingListLineList.xml
View file @
f86be183
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox=
[]
,**kw
</string>
</value>
<value>
<string>
listbox=
()
,**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.py
View file @
f86be183
from
Products.ERP5Type.Message
import
Message
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
inventory
=
state_change
[
'object'
]
# use of the constraint
inventory
.
Base_checkConsistency
()
state_change
[
'object'
].
Base_checkConsistency
()
bt5/erp5_trade/bt/skip_coding_style_test
deleted
100644 → 0
View file @
7fa83bf4
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