Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
1ff851b1
Commit
1ff851b1
authored
Dec 24, 2019
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Preparation of erp5_base migration from FS: Fix pylint bad-indentation warnings.
parent
187c6554
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
719 additions
and
721 deletions
+719
-721
product/ERP5/Document/AgentPrivilege.py
product/ERP5/Document/AgentPrivilege.py
+17
-17
product/ERP5/Document/Assignment.py
product/ERP5/Document/Assignment.py
+17
-17
product/ERP5/Document/BankAccount.py
product/ERP5/Document/BankAccount.py
+26
-26
product/ERP5/Document/Career.py
product/ERP5/Document/Career.py
+20
-20
product/ERP5/Document/Coordinate.py
product/ERP5/Document/Coordinate.py
+174
-176
product/ERP5/Document/Image.py
product/ERP5/Document/Image.py
+5
-5
product/ERP5/Document/Organisation.py
product/ERP5/Document/Organisation.py
+19
-19
product/ERP5/Document/Person.py
product/ERP5/Document/Person.py
+168
-168
product/ERP5/Document/RoleDefinition.py
product/ERP5/Document/RoleDefinition.py
+28
-28
product/ERP5/Document/SupplyCell.py
product/ERP5/Document/SupplyCell.py
+40
-40
product/ERP5/Document/SupplyLine.py
product/ERP5/Document/SupplyLine.py
+202
-202
product/ERP5/mixin/builder.py
product/ERP5/mixin/builder.py
+3
-3
No files found.
product/ERP5/Document/AgentPrivilege.py
View file @
1ff851b1
...
@@ -32,22 +32,22 @@ from Products.ERP5Type.XMLObject import XMLObject
...
@@ -32,22 +32,22 @@ from Products.ERP5Type.XMLObject import XMLObject
class
AgentPrivilege
(
XMLObject
):
class
AgentPrivilege
(
XMLObject
):
"""
"""
An Agent Privilege allow the Bank Account owner to give permissions to an Agent for a given period of time, for a maximum amount of money.
An Agent Privilege allow the Bank Account owner to give permissions to an Agent for a given period of time, for a maximum amount of money.
"""
"""
# CMF Type Definition
# CMF Type Definition
meta_type
=
'ERP5 Agent Privilege'
meta_type
=
'ERP5 Agent Privilege'
portal_type
=
'Agent Privilege'
portal_type
=
'Agent Privilege'
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Default Properties
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
AgentPrivilege
,
PropertySheet
.
AgentPrivilege
)
)
product/ERP5/Document/Assignment.py
View file @
1ff851b1
...
@@ -33,22 +33,22 @@ from Products.ERP5.Document.Path import Path
...
@@ -33,22 +33,22 @@ from Products.ERP5.Document.Path import Path
class
Assignment
(
Path
):
class
Assignment
(
Path
):
# CMF Type Definition
# CMF Type Definition
meta_type
=
'ERP5 Assignment'
meta_type
=
'ERP5 Assignment'
portal_type
=
'Assignment'
portal_type
=
'Assignment'
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Default Properties
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Arrow
,
PropertySheet
.
Path
,
PropertySheet
.
Path
,
PropertySheet
.
Assignment
,
PropertySheet
.
Assignment
)
)
product/ERP5/Document/BankAccount.py
View file @
1ff851b1
...
@@ -34,43 +34,43 @@ from Products.ERP5.Document.Node import Node
...
@@ -34,43 +34,43 @@ from Products.ERP5.Document.Node import Node
from
Products.ERP5.Document.Coordinate
import
Coordinate
from
Products.ERP5.Document.Coordinate
import
Coordinate
class
BankAccount
(
Node
,
Coordinate
):
class
BankAccount
(
Node
,
Coordinate
):
"""
"""
A bank account number holds a collection of numbers and codes
A bank account number holds a collection of numbers and codes
(ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
(ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
A Bank Account is owned by a Person or an Organisation. A Bank Account
A Bank Account is owned by a Person or an Organisation. A Bank Account
contain Agents with Agent Privileges used by the owner to delegate the
contain Agents with Agent Privileges used by the owner to delegate the
management of the bank account to trusted third-party Persons.
management of the bank account to trusted third-party Persons.
"""
"""
meta_type
=
'ERP5 Bank Account'
meta_type
=
'ERP5 Bank Account'
portal_type
=
'Bank Account'
portal_type
=
'Bank Account'
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
# Declarative properties
property_sheets
=
(
PropertySheet
.
CategoryCore
property_sheets
=
(
PropertySheet
.
CategoryCore
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Resource
,
PropertySheet
.
Resource
,
PropertySheet
.
Reference
,
PropertySheet
.
Reference
,
PropertySheet
.
BankAccount
,
PropertySheet
.
BankAccount
)
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getReference'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getReference'
)
def
getReference
(
self
,
*
args
,
**
kw
):
def
getReference
(
self
,
*
args
,
**
kw
):
"""reference depends on the site configuration.
"""reference depends on the site configuration.
"""
"""
value
=
self
.
_baseGetReference
(
*
args
,
**
kw
)
value
=
self
.
_baseGetReference
(
*
args
,
**
kw
)
if
value
in
(
None
,
''
):
if
value
in
(
None
,
''
):
# Try to get a skin from type name
# Try to get a skin from type name
method
=
self
.
_getTypeBasedMethod
(
'getReference'
)
method
=
self
.
_getTypeBasedMethod
(
'getReference'
)
if
method
is
not
None
:
if
method
is
not
None
:
return
method
(
*
args
,
**
kw
)
return
method
(
*
args
,
**
kw
)
return
value
return
value
# XXX The following "helper methods" have been commented out, and kept in the
# XXX The following "helper methods" have been commented out, and kept in the
# code as an example.
# code as an example.
...
...
product/ERP5/Document/Career.py
View file @
1ff851b1
...
@@ -33,27 +33,27 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -33,27 +33,27 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.Path
import
Path
from
Products.ERP5.Document.Path
import
Path
class
Career
(
Path
):
class
Career
(
Path
):
"""
"""
Contains information about abilities, salary, grade, role... of a
Contains information about abilities, salary, grade, role... of a
Person at a certain career step.
Person at a certain career step.
"""
"""
# CMF Type Definition
# CMF Type Definition
meta_type
=
'ERP5 Career'
meta_type
=
'ERP5 Career'
portal_type
=
'Career'
portal_type
=
'Career'
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Default Properties
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Arrow
,
PropertySheet
.
Path
,
PropertySheet
.
Path
,
PropertySheet
.
Reference
,
PropertySheet
.
Reference
,
PropertySheet
.
Assignment
,
PropertySheet
.
Assignment
)
)
product/ERP5/Document/Coordinate.py
View file @
1ff851b1
This diff is collapsed.
Click to expand it.
product/ERP5/Document/Image.py
View file @
1ff851b1
...
@@ -204,7 +204,7 @@ class Image(TextConvertableMixin, File, OFSImage):
...
@@ -204,7 +204,7 @@ class Image(TextConvertableMixin, File, OFSImage):
"""Return list of HTML <a> tags for displays."""
"""Return list of HTML <a> tags for displays."""
links
=
[]
links
=
[]
for
display
in
self
.
displayIds
(
exclude
):
for
display
in
self
.
displayIds
(
exclude
):
links
.
append
(
'<a href="%s?display=%s">%s</a>'
%
(
self
.
REQUEST
[
'URL'
],
display
,
display
))
links
.
append
(
'<a href="%s?display=%s">%s</a>'
%
(
self
.
REQUEST
[
'URL'
],
display
,
display
))
return
links
return
links
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'displayMap'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'displayMap'
)
...
@@ -367,11 +367,11 @@ class Image(TextConvertableMixin, File, OFSImage):
...
@@ -367,11 +367,11 @@ class Image(TextConvertableMixin, File, OFSImage):
cwd
=
'/'
,
cwd
=
'/'
,
close_fds
=
True
)
close_fds
=
True
)
try
:
try
:
# XXX: The only portable way is to pass what stdin.write can accept,
# XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE.
# which is a string for PIPE.
image
,
err
=
process
.
communicate
(
data
)
image
,
err
=
process
.
communicate
(
data
)
finally
:
finally
:
del
process
del
process
if
image
:
if
image
:
return
StringIO
(
image
)
return
StringIO
(
image
)
raise
ConversionError
(
'Image conversion failed (%s).'
%
err
)
raise
ConversionError
(
'Image conversion failed (%s).'
%
err
)
...
...
product/ERP5/Document/Organisation.py
View file @
1ff851b1
...
@@ -33,7 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces
...
@@ -33,7 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces
from
Products.ERP5.Document.Node
import
Node
from
Products.ERP5.Document.Node
import
Node
class
Organisation
(
Node
):
class
Organisation
(
Node
):
"""
"""
An Organisation object holds the information about
An Organisation object holds the information about
an organisation (ex. a division in a company, a company,
an organisation (ex. a division in a company, a company,
a service in a public administration).
a service in a public administration).
...
@@ -46,27 +46,27 @@ class Organisation(Node):
...
@@ -46,27 +46,27 @@ class Organisation(Node):
Organisation objects inherit from the MetaNode base class
Organisation objects inherit from the MetaNode base class
(one of the 5 base classes in the ERP5 universal business model)
(one of the 5 base classes in the ERP5 universal business model)
"""
"""
meta_type
=
'ERP5 Organisation'
meta_type
=
'ERP5 Organisation'
portal_type
=
'Organisation'
portal_type
=
'Organisation'
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
zope
.
interface
.
implements
(
interfaces
.
INode
)
zope
.
interface
.
implements
(
interfaces
.
INode
)
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Organisation
,
PropertySheet
.
Organisation
,
PropertySheet
.
Mapping
,
PropertySheet
.
Mapping
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Reference
,
PropertySheet
.
Reference
)
)
product/ERP5/Document/Person.py
View file @
1ff851b1
This diff is collapsed.
Click to expand it.
product/ERP5/Document/RoleDefinition.py
View file @
1ff851b1
...
@@ -33,36 +33,36 @@ from Products.ERP5Type.ERP5Type \
...
@@ -33,36 +33,36 @@ from Products.ERP5Type.ERP5Type \
import
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
import
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
class
RoleDefinition
(
XMLObject
):
class
RoleDefinition
(
XMLObject
):
# CMF Type Definition
# CMF Type Definition
meta_type
=
'ERP5 Role Definition'
meta_type
=
'ERP5 Role Definition'
portal_type
=
'Role Definition'
portal_type
=
'Role Definition'
add_permission
=
Permissions
.
ChangeLocalRoles
add_permission
=
Permissions
.
ChangeLocalRoles
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
zope
.
interface
.
implements
(
interfaces
.
ILocalRoleGenerator
)
zope
.
interface
.
implements
(
interfaces
.
ILocalRoleGenerator
)
# Default Properties
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
RoleDefinition
,
PropertySheet
.
RoleDefinition
)
)
def
_setRoleName
(
self
,
value
):
def
_setRoleName
(
self
,
value
):
if
value
and
value
not
in
\
if
value
and
value
not
in
\
zip
(
*
self
.
RoleDefinition_getRoleNameItemList
())[
1
]:
zip
(
*
self
.
RoleDefinition_getRoleNameItemList
())[
1
]:
raise
Unauthorized
(
"You are not allowed to give %s role"
%
value
)
raise
Unauthorized
(
"You are not allowed to give %s role"
%
value
)
self
.
_baseSetRoleName
(
value
)
self
.
_baseSetRoleName
(
value
)
security
.
declarePrivate
(
"getLocalRolesFor"
)
security
.
declarePrivate
(
"getLocalRolesFor"
)
def
getLocalRolesFor
(
self
,
ob
,
user_name
=
None
):
def
getLocalRolesFor
(
self
,
ob
,
user_name
=
None
):
group_id_generator
=
getattr
(
ob
,
group_id_generator
=
getattr
(
ob
,
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
)
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
)
role_list
=
self
.
getRoleName
(),
role_list
=
self
.
getRoleName
(),
return
{
group_id
:
role_list
return
{
group_id
:
role_list
for
group_id
in
group_id_generator
(
category_order
=
(
'agent'
,),
for
group_id
in
group_id_generator
(
category_order
=
(
'agent'
,),
agent
=
self
.
getAgentList
())}
agent
=
self
.
getAgentList
())}
product/ERP5/Document/SupplyCell.py
View file @
1ff851b1
...
@@ -32,49 +32,49 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -32,49 +32,49 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.Path
import
Path
from
Products.ERP5.Document.Path
import
Path
class
SupplyCell
(
Path
):
class
SupplyCell
(
Path
):
"""A Supply Cell is used for different variations in a supply line.
"""A Supply Cell is used for different variations in a supply line.
"""
"""
meta_type
=
'ERP5 Supply Cell'
meta_type
=
'ERP5 Supply Cell'
portal_type
=
'Supply Cell'
portal_type
=
'Supply Cell'
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative properties
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Price
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
SupplyLine
,
PropertySheet
.
Discount
,
PropertySheet
.
Discount
,
PropertySheet
.
Path
,
PropertySheet
.
Path
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
FlowCapacity
,
PropertySheet
.
Predicate
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
MappedValue
,
PropertySheet
.
Reference
,
PropertySheet
.
Reference
)
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'hasCellContent'
)
'hasCellContent'
)
def
hasCellContent
(
self
,
base_id
=
'movement'
):
def
hasCellContent
(
self
,
base_id
=
'movement'
):
"""A cell cannot have cell content itself.
"""A cell cannot have cell content itself.
"""
"""
return
0
return
0
# Override getQuantityUnitXXX to negate same methods defined in
# Override getQuantityUnitXXX to negate same methods defined in
# Amount class. Because cell must acquire quantity unit from line
# Amount class. Because cell must acquire quantity unit from line
# not from resource.
# not from resource.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantityUnitValue'
)
'getQuantityUnitValue'
)
def
getQuantityUnitValue
(
self
):
def
getQuantityUnitValue
(
self
):
return
self
.
getParentValue
().
getQuantityUnitValue
()
return
self
.
getParentValue
().
getQuantityUnitValue
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantityUnit'
)
'getQuantityUnit'
)
def
getQuantityUnit
(
self
,
checked_permission
=
None
):
def
getQuantityUnit
(
self
,
checked_permission
=
None
):
return
self
.
getParentValue
().
getQuantityUnit
(
checked_permission
=
checked_permission
)
return
self
.
getParentValue
().
getQuantityUnit
(
checked_permission
=
checked_permission
)
product/ERP5/Document/SupplyLine.py
View file @
1ff851b1
This diff is collapsed.
Click to expand it.
product/ERP5/mixin/builder.py
View file @
1ff851b1
...
@@ -791,9 +791,9 @@ class BuilderMixin(XMLObject, Amount, Predicate):
...
@@ -791,9 +791,9 @@ class BuilderMixin(XMLObject, Amount, Predicate):
category_index_dict
[
i
.
getId
()]
=
i
.
getIntIndex
()
category_index_dict
[
i
.
getId
()]
=
i
.
getIntIndex
()
def
sort_movement_group
(
a
,
b
):
def
sort_movement_group
(
a
,
b
):
return
cmp
(
category_index_dict
.
get
(
a
.
getCollectOrderGroup
()),
return
cmp
(
category_index_dict
.
get
(
a
.
getCollectOrderGroup
()),
category_index_dict
.
get
(
b
.
getCollectOrderGroup
()))
or
\
category_index_dict
.
get
(
b
.
getCollectOrderGroup
()))
or
\
cmp
(
a
.
getIntIndex
(),
b
.
getIntIndex
())
cmp
(
a
.
getIntIndex
(),
b
.
getIntIndex
())
if
portal_type
is
None
:
if
portal_type
is
None
:
portal_type
=
self
.
getPortalMovementGroupTypeList
()
portal_type
=
self
.
getPortalMovementGroupTypeList
()
movement_group_list
=
[
x
for
x
in
self
.
contentValues
(
filter
=
{
'portal_type'
:
portal_type
})
\
movement_group_list
=
[
x
for
x
in
self
.
contentValues
(
filter
=
{
'portal_type'
:
portal_type
})
\
...
...
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