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
137
Merge Requests
137
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
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
class
InventoryCell
(
DeliveryCell
):
"""
An InventoryCell allows to define specific inventory
for each variation of a resource in an inventory line.
"""
"""
An InventoryCell allows to define specific inventory
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'
portal_type
=
'Inventory Cell'
add_permission
=
Permissions
.
AddPortalContent
isInventoryMovement
=
ConstantGetter
(
'isInventoryMovement'
,
value
=
True
)
# 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
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
"""
Returns the inventory, as cells are not supposed to contain more cells.
"""
return
self
.
getInventory
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
"""
Returns the inventory, as cells are not supposed to contain more cells.
"""
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)
if
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
is
None
:
return
0.0
# No inventory defined, so no quantity
return
self
.
getInventory
()
else
:
return
None
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)
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
# 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
\ No newline at end of file
product/ERP5/Document/InventoryLine.py
View file @
4ee585d8
...
...
@@ -36,112 +36,110 @@ from Products.ERP5.Document.Movement import Movement
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
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
"""
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
):
"""
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
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
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
# Required for indexing
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getInventoriatedQuantity'
)
def
getInventoriatedQuantity
(
self
):
"""
Take into account efficiency in converted target quantity
"""
return
Movement
.
getInventoriatedQuantity
(
self
)
# XXX: Dirty but required for erp5_banking_core
getBaobabSourceUid
=
lambda
x
:
x
.
getSourceUid
()
getBaobabSourceUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationUid
=
lambda
x
:
x
.
getDestinationUid
()
getBaobabDestinationUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceSectionUid
=
lambda
x
:
x
.
getSourceSectionUid
()
getBaobabSourceSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationSectionUid
=
lambda
x
:
x
.
getDestinationSectionUid
()
getBaobabDestinationSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourcePaymentUid
=
lambda
x
:
x
.
getSourcePaymentUid
()
getBaobabSourcePaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationPaymentUid
=
lambda
x
:
x
.
getDestinationPaymentUid
()
getBaobabDestinationPaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceFunctionUid
=
lambda
x
:
x
.
getSourceFunctionUid
()
getBaobabSourceFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationFunctionUid
=
lambda
x
:
x
.
getDestinationFunctionUid
()
getBaobabDestinationFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceProjectUid
=
lambda
x
:
x
.
getSourceProjectUid
()
getBaobabSourceProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationProjectUid
=
lambda
x
:
x
.
getDestinationProjectUid
()
getBaobabDestinationProjectUid__roles__
=
PermissionRole
(
Permissions
.
View
)
# 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
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
# Required for indexing
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getInventoriatedQuantity'
)
def
getInventoriatedQuantity
(
self
):
"""
Take into account efficiency in converted target quantity
"""
return
Movement
.
getInventoriatedQuantity
(
self
)
# XXX: Dirty but required for erp5_banking_core
getBaobabSourceUid
=
lambda
x
:
x
.
getSourceUid
()
getBaobabSourceUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationUid
=
lambda
x
:
x
.
getDestinationUid
()
getBaobabDestinationUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceSectionUid
=
lambda
x
:
x
.
getSourceSectionUid
()
getBaobabSourceSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationSectionUid
=
lambda
x
:
x
.
getDestinationSectionUid
()
getBaobabDestinationSectionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourcePaymentUid
=
lambda
x
:
x
.
getSourcePaymentUid
()
getBaobabSourcePaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationPaymentUid
=
lambda
x
:
x
.
getDestinationPaymentUid
()
getBaobabDestinationPaymentUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabSourceFunctionUid
=
lambda
x
:
x
.
getSourceFunctionUid
()
getBaobabSourceFunctionUid__roles__
=
PermissionRole
(
Permissions
.
View
)
getBaobabDestinationFunctionUid
=
lambda
x
:
x
.
getDestinationFunctionUid
()
getBaobabDestinationFunctionUid__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
from
Products.ERP5.Document.DeliveryCell
import
DeliveryCell
class
OrderCell
(
DeliveryCell
):
"""
A OrderCell allows to define specific quantities
for each variation of a resource in a delivery line.
"""
"""
A OrderCell allows to define specific quantities
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'
portal_type
=
'Order Cell'
isCell
=
1
# 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
.
Arrow
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Arrow
,
PropertySheet
.
Amount
,
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
)
def
reindexObject
(
self
,
*
k
,
**
kw
):
"""
Reindex children and simulation
"""
self
.
recursiveReindexObject
(
*
k
,
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isMovement'
)
def
isMovement
(
self
):
"""
should be considered as a movement if the parent does not have sub lines
"""
return
not
self
.
getParentValue
().
hasLineContent
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isMovement'
)
def
isMovement
(
self
):
"""
should be considered as a movement if the parent does not have sub lines
"""
return
not
self
.
getParentValue
().
hasLineContent
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalPrice'
)
def
getTotalPrice
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
"only return a value if self is a movement"
if
not
self
.
isMovement
():
return
default
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
)
def
getTotalPrice
(
self
,
default
=
0.0
,
*
args
,
**
kw
):
"only return a value if self is a movement"
if
not
self
.
isMovement
():
return
default
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
)
\ No newline at end of file
product/ERP5/Document/OrderLine.py
View file @
4ee585d8
...
...
@@ -32,27 +32,26 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.DeliveryLine
import
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'
portal_type
=
'Order Line'
# 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
.
DublinCore
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
\ 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