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
140
Merge Requests
140
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
4ee585d8
Commit
4ee585d8
authored
Apr 08, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5/Document: Fix pylint warnings.
parent
d672defe
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
792 additions
and
808 deletions
+792
-808
product/ERP5/Document/DeliveryCell.py
product/ERP5/Document/DeliveryCell.py
+170
-174
product/ERP5/Document/DeliveryLine.py
product/ERP5/Document/DeliveryLine.py
+398
-403
product/ERP5/Document/InventoryCell.py
product/ERP5/Document/InventoryCell.py
+52
-54
product/ERP5/Document/InventoryLine.py
product/ERP5/Document/InventoryLine.py
+104
-106
product/ERP5/Document/OrderCell.py
product/ERP5/Document/OrderCell.py
+47
-49
product/ERP5/Document/OrderLine.py
product/ERP5/Document/OrderLine.py
+21
-22
No files found.
product/ERP5/Document/DeliveryCell.py
View file @
4ee585d8
This diff is collapsed.
Click to expand it.
product/ERP5/Document/DeliveryLine.py
View file @
4ee585d8
This diff is collapsed.
Click to expand it.
product/ERP5/Document/InventoryCell.py
View file @
4ee585d8
...
@@ -34,64 +34,62 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
...
@@ -34,64 +34,62 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
class
InventoryCell
(
DeliveryCell
):
class
InventoryCell
(
DeliveryCell
):
"""
"""
An InventoryCell allows to define specific inventory
An InventoryCell allows to define specific inventory
for each variation of a resource in an inventory line.
for each variation of a resource in an inventory line.
"""
"""
meta_type
=
'ERP5 Inventory Cell'
portal_type
=
'Inventory Cell'
add_permission
=
Permissions
.
AddPortalContent
isInventoryMovement
=
ConstantGetter
(
'isInventoryMovement'
,
value
=
True
)
meta_type
=
'ERP5 Inventory Cell'
# Declarative security
portal_type
=
'Inventory Cell'
security
=
ClassSecurityInfo
()
add_permission
=
Permissions
.
AddPortalContent
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
isInventoryMovement
=
ConstantGetter
(
'isInventoryMovement'
,
value
=
True
)
# Declarative security
# Declarative properties
security
=
ClassSecurityInfo
()
property_sheets
=
(
PropertySheet
.
Base
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
# Declarative properties
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
property_sheets
=
(
PropertySheet
.
Base
def
getTotalInventory
(
self
):
,
PropertySheet
.
CategoryCore
"""
,
PropertySheet
.
Amount
Returns the inventory, as cells are not supposed to contain more cells.
,
PropertySheet
.
InventoryMovement
"""
,
PropertySheet
.
Task
return
self
.
getInventory
()
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
def
getTotalInventory
(
self
):
def
getQuantity
(
self
):
"""
"""
Returns the inventory, as cells are not supposed to contain more cells.
Computes a quantity which allows to reach inventory
"""
"""
if
not
self
.
hasCellContent
():
# First check if quantity already exists
quantity
=
self
.
_baseGetQuantity
()
if
quantity
not
in
(
0.0
,
0
,
None
):
return
quantity
# Make sure inventory is defined somewhere (here or parent)
if
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
is
None
:
return
0.0
# No inventory defined, so no quantity
return
self
.
getInventory
()
return
self
.
getInventory
()
else
:
return
None
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
# Inventory cataloging
def
getQuantity
(
self
):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConvertedInventory'
)
"""
def
getConvertedInventory
(
self
):
Computes a quantity which allows to reach inventory
"""
"""
provides a default inventory value - None since
if
not
self
.
hasCellContent
():
no inventory was defined.
# First check if quantity already exists
"""
quantity
=
self
.
_baseGetQuantity
()
return
self
.
getInventory
()
# XXX quantity unit is missing
if
quantity
not
in
(
0.0
,
0
,
None
):
\ No newline at end of file
return
quantity
# Make sure inventory is defined somewhere (here or parent)
if
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
is
None
:
return
0.0
# No inventory defined, so no quantity
return
self
.
getInventory
()
else
:
return
None
# Inventory cataloging
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConvertedInventory'
)
def
getConvertedInventory
(
self
):
"""
provides a default inventory value - None since
no inventory was defined.
"""
return
self
.
getInventory
()
# XXX quantity unit is missing
product/ERP5/Document/InventoryLine.py
View file @
4ee585d8
...
@@ -36,112 +36,110 @@ from Products.ERP5.Document.Movement import Movement
...
@@ -36,112 +36,110 @@ from Products.ERP5.Document.Movement import Movement
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
class
InventoryLine
(
DeliveryLine
):
class
InventoryLine
(
DeliveryLine
):
"""
An Inventory Line describe the inventory of a resource, by variations.
"""
meta_type
=
'ERP5 Inventory Line'
portal_type
=
'Inventory Line'
add_permission
=
Permissions
.
AddPortalContent
isInventoryMovement
=
ConstantGetter
(
'isInventoryMovement'
,
value
=
True
)
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
"""
"""
An Inventory Line describe the inventory of a resource, by variations.
Returns the inventory if no cell or the total inventory if cells
"""
"""
if
not
self
.
hasCellContent
():
meta_type
=
'ERP5 Inventory Line'
return
self
.
getInventory
()
portal_type
=
'Inventory Line'
else
:
add_permission
=
Permissions
.
AddPortalContent
total_quantity
=
0.0
isInventoryMovement
=
ConstantGetter
(
'isInventoryMovement'
,
value
=
True
)
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
if
cell
.
getInventory
()
is
not
None
:
# Declarative security
total_quantity
+=
cell
.
getInventory
()
security
=
ClassSecurityInfo
()
return
total_quantity
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
# Declarative properties
'getQuantity'
)
property_sheets
=
(
PropertySheet
.
Base
def
getQuantity
(
self
):
,
PropertySheet
.
XMLObject
"""
,
PropertySheet
.
CategoryCore
Computes a quantity which allows to reach inventory
,
PropertySheet
.
Amount
"""
,
PropertySheet
.
InventoryMovement
if
not
self
.
hasCellContent
():
,
PropertySheet
.
Task
# First check if quantity already exists
,
PropertySheet
.
Arrow
quantity
=
self
.
_baseGetQuantity
()
,
PropertySheet
.
Movement
if
quantity
not
in
(
0.0
,
0
,
None
):
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
"""
Returns the inventory if no cell or the total inventory if cells
"""
if
not
self
.
hasCellContent
():
return
self
.
getInventory
()
else
:
total_quantity
=
0.0
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
if
cell
.
getInventory
()
is
not
None
:
total_quantity
+=
cell
.
getInventory
()
return
total_quantity
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
def
getQuantity
(
self
):
"""
Computes a quantity which allows to reach inventory
"""
if
not
self
.
hasCellContent
():
# First check if quantity already exists
quantity
=
self
.
_baseGetQuantity
()
if
quantity
not
in
(
0.0
,
0
,
None
):
return
quantity
# Make sure inventory is defined somewhere (here or parent)
inventory
=
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
if
inventory
is
not
None
:
return
inventory
return
quantity
return
quantity
else
:
# Make sure inventory is defined somewhere (here or parent)
return
None
inventory
=
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
if
inventory
is
not
None
:
# Inventory cataloging
return
inventory
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
return
quantity
'getConvertedInventory'
)
else
:
def
getConvertedInventory
(
self
):
return
None
"""
provides a default inventory value - None since
# Inventory cataloging
no inventory was defined.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
"""
'getConvertedInventory'
)
return
self
.
getInventory
()
# XXX quantity unit is missing
def
getConvertedInventory
(
self
):
"""
# Required for indexing
provides a default inventory value - None since
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
no inventory was defined.
'getInventoriatedQuantity'
)
"""
def
getInventoriatedQuantity
(
self
):
return
self
.
getInventory
()
# XXX quantity unit is missing
"""
Take into account efficiency in converted target quantity
# Required for indexing
"""
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
return
Movement
.
getInventoriatedQuantity
(
self
)
'getInventoriatedQuantity'
)
def
getInventoriatedQuantity
(
self
):
# XXX: Dirty but required for erp5_banking_core
"""
getBaobabSourceUid
=
lambda
x
:
x
.
getSourceUid
()
Take into account efficiency in converted target quantity
getBaobabSourceUid__roles__
=
PermissionRole
(
Permissions
.
View
)
"""
return
Movement
.
getInventoriatedQuantity
(
self
)
getBaobabDestinationUid
=
lambda
x
:
x
.
getDestinationUid
()
getBaobabDestinationUid__roles__
=
PermissionRole
(
Permissions
.
View
)
# XXX: Dirty but required for erp5_banking_core
getBaobabSourceUid
=
lambda
x
:
x
.
getSourceUid
()
getBaobabSourceSectionUid
=
lambda
x
:
x
.
getSourceSectionUid
()
getBaobabSourceUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationUid
=
lambda
x
:
x
.
getDestinationUid
()
getBaobabDestinationSectionUid
=
lambda
x
:
x
.
getDestinationSectionUid
()
getBaobabDestinationUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceSectionUid
=
lambda
x
:
x
.
getSourceSectionUid
()
getBaobabSourcePaymentUid
=
lambda
x
:
x
.
getSourcePaymentUid
()
getBaobabSourceSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourcePaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationSectionUid
=
lambda
x
:
x
.
getDestinationSectionUid
()
getBaobabDestinationPaymentUid
=
lambda
x
:
x
.
getDestinationPaymentUid
()
getBaobabDestinationSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationPaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourcePaymentUid
=
lambda
x
:
x
.
getSourcePaymentUid
()
getBaobabSourceFunctionUid
=
lambda
x
:
x
.
getSourceFunctionUid
()
getBaobabSourcePaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationPaymentUid
=
lambda
x
:
x
.
getDestinationPaymentUid
()
getBaobabDestinationFunctionUid
=
lambda
x
:
x
.
getDestinationFunctionUid
()
getBaobabDestinationPaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceFunctionUid
=
lambda
x
:
x
.
getSourceFunctionUid
()
getBaobabSourceProjectUid
=
lambda
x
:
x
.
getSourceProjectUid
()
getBaobabSourceFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationFunctionUid
=
lambda
x
:
x
.
getDestinationFunctionUid
()
getBaobabDestinationProjectUid
=
lambda
x
:
x
.
getDestinationProjectUid
()
getBaobabDestinationFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceProjectUid
=
lambda
x
:
x
.
getSourceProjectUid
()
getBaobabSourceProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationProjectUid
=
lambda
x
:
x
.
getDestinationProjectUid
()
getBaobabDestinationProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
\ No newline at end of file
product/ERP5/Document/OrderCell.py
View file @
4ee585d8
...
@@ -33,59 +33,57 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -33,59 +33,57 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
class
OrderCell
(
DeliveryCell
):
class
OrderCell
(
DeliveryCell
):
"""
"""
A OrderCell allows to define specific quantities
A OrderCell allows to define specific quantities
for each variation of a resource in a delivery line.
for each variation of a resource in a delivery line.
"""
"""
meta_type
=
'ERP5 Order Cell'
portal_type
=
'Order Cell'
isCell
=
1
meta_type
=
'ERP5 Order Cell'
# Declarative security
portal_type
=
'Order Cell'
security
=
ClassSecurityInfo
()
isCell
=
1
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative security
# Declarative properties
security
=
ClassSecurityInfo
()
property_sheets
=
(
PropertySheet
.
Base
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Arrow
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
# Declarative properties
def
reindexObject
(
self
,
*
k
,
**
kw
):
property_sheets
=
(
PropertySheet
.
Base
"""
,
PropertySheet
.
CategoryCore
Reindex children and simulation
,
PropertySheet
.
Arrow
"""
,
PropertySheet
.
Amount
self
.
recursiveReindexObject
(
*
k
,
**
kw
)
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
def
reindexObject
(
self
,
*
k
,
**
kw
):
"""
Reindex children and simulation
"""
self
.
recursiveReindexObject
(
*
k
,
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isMovement'
)
'isMovement'
)
def
isMovement
(
self
):
def
isMovement
(
self
):
"""
"""
should be considered as a movement if the parent does not have sub lines
should be considered as a movement if the parent does not have sub lines
"""
"""
return
not
self
.
getParentValue
().
hasLineContent
()
return
not
self
.
getParentValue
().
hasLineContent
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalPrice'
)
'getTotalPrice'
)
def
getTotalPrice
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
def
getTotalPrice
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
"only return a value if self is a movement"
"only return a value if self is a movement"
if
not
self
.
isMovement
():
if
not
self
.
isMovement
():
return
default
return
default
return
DeliveryCell
.
getTotalPrice
(
self
,
default
=
default
,
*
args
,
**
kw
)
return
DeliveryCell
.
getTotalPrice
(
self
,
default
=
default
,
*
args
,
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalQuantity'
)
def
getTotalQuantity
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
"only return a value if self is a movement"
if
not
self
.
isMovement
():
return
default
return
DeliveryCell
.
getTotalQuantity
(
self
,
default
=
default
,
*
args
,
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalQuantity'
)
def
getTotalQuantity
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
"only return a value if self is a movement"
if
not
self
.
isMovement
():
return
default
return
DeliveryCell
.
getTotalQuantity
(
self
,
default
=
default
,
*
args
,
**
kw
)
\ No newline at end of file
product/ERP5/Document/OrderLine.py
View file @
4ee585d8
...
@@ -32,27 +32,26 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -32,27 +32,26 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.DeliveryLine
import
DeliveryLine
from
Products.ERP5.Document.DeliveryLine
import
DeliveryLine
class
OrderLine
(
DeliveryLine
):
class
OrderLine
(
DeliveryLine
):
"""
"""
A order line defines quantity and price
A order line defines quantity and price
"""
"""
meta_type
=
'ERP5 Order Line'
portal_type
=
'Order Line'
meta_type
=
'ERP5 Order Line'
# Declarative security
portal_type
=
'Order Line'
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative security
# Declarative properties
security
=
ClassSecurityInfo
()
property_sheets
=
(
PropertySheet
.
Base
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
# Declarative properties
,
PropertySheet
.
Amount
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
Task
,
PropertySheet
.
XMLObject
,
PropertySheet
.
DublinCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Arrow
,
PropertySheet
.
Amount
,
PropertySheet
.
Movement
,
PropertySheet
.
Task
,
PropertySheet
.
Price
,
PropertySheet
.
DublinCore
,
PropertySheet
.
VariationRange
,
PropertySheet
.
Arrow
,
PropertySheet
.
ItemAggregation
,
PropertySheet
.
Movement
)
,
PropertySheet
.
Price
\ No newline at end of file
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
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