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
Hugo Ricateau
erp5
Commits
9d710981
Commit
9d710981
authored
Dec 31, 2015
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code factorization for security permissions in Solvers
parent
e447832e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
33 deletions
+15
-33
product/ERP5/Document/AcceptSolver.py
product/ERP5/Document/AcceptSolver.py
+1
-5
product/ERP5/Document/AdoptSolver.py
product/ERP5/Document/AdoptSolver.py
+1
-5
product/ERP5/Document/ItemListSplitSolver.py
product/ERP5/Document/ItemListSplitSolver.py
+1
-5
product/ERP5/Document/MovementSplitSolver.py
product/ERP5/Document/MovementSplitSolver.py
+1
-4
product/ERP5/Document/QuantitySplitSolver.py
product/ERP5/Document/QuantitySplitSolver.py
+1
-4
product/ERP5/Document/TradeModelSolver.py
product/ERP5/Document/TradeModelSolver.py
+1
-5
product/ERP5/Document/UnifySolver.py
product/ERP5/Document/UnifySolver.py
+1
-5
product/ERP5/mixin/solver.py
product/ERP5/mixin/solver.py
+8
-0
No files found.
product/ERP5/Document/AcceptSolver.py
View file @
9d710981
...
...
@@ -29,7 +29,6 @@
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5.mixin.solver
import
ConfigurablePropertySolverMixin
class
AcceptSolver
(
ConfigurablePropertySolverMixin
):
...
...
@@ -42,10 +41,7 @@ class AcceptSolver(ConfigurablePropertySolverMixin):
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
Adopt new property to simulation movements, with keeping the
original one recorded.
...
...
product/ERP5/Document/AdoptSolver.py
View file @
9d710981
...
...
@@ -29,7 +29,6 @@
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5.mixin.solver
import
ConfigurablePropertySolverMixin
class
AdoptSolver
(
ConfigurablePropertySolverMixin
):
...
...
@@ -42,10 +41,7 @@ class AdoptSolver(ConfigurablePropertySolverMixin):
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
Adopt new property to movements or deliveries.
"""
...
...
product/ERP5/Document/ItemListSplitSolver.py
View file @
9d710981
...
...
@@ -31,7 +31,6 @@ import zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_base
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5.mixin.solver
import
SolverMixin
from
Products.ERP5.mixin.configurable
import
ConfigurableMixin
...
...
@@ -65,10 +64,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
interfaces
.
IConfigurable
,
)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""This method create new movement based on difference of aggregate sets.
It supports only removed items.
Quantity divergence is also solved with sum of aggregated quantities stored
...
...
product/ERP5/Document/MovementSplitSolver.py
View file @
9d710981
...
...
@@ -58,10 +58,7 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
interfaces
.
IConfigurable
,
)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
This method splits a Delivery and move movements in to a new
Delivery. Splitting is done by duplicating the Delivery, removing
...
...
product/ERP5/Document/QuantitySplitSolver.py
View file @
9d710981
...
...
@@ -31,7 +31,6 @@ import zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_base
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5.mixin.solver
import
SolverMixin
...
...
@@ -67,9 +66,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
"""
configuration_dict
=
self
.
getConfigurationPropertyDict
()
...
...
product/ERP5/Document/TradeModelSolver.py
View file @
9d710981
...
...
@@ -29,7 +29,6 @@
import
zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5.Document.AcceptSolver
import
AcceptSolver
class
TradeModelSolver
(
AcceptSolver
):
...
...
@@ -58,10 +57,7 @@ class TradeModelSolver(AcceptSolver):
# Declarative interfaces
zope
.
interface
.
implements
(
interfaces
.
ISolver
,)
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
Adopt new values to simulation movements, with keeping the original
one recorded, and then update Trade Model related lines accordingly.
...
...
product/ERP5/Document/UnifySolver.py
View file @
9d710981
...
...
@@ -30,7 +30,6 @@
import
zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5.Document.AcceptSolver
import
AcceptSolver
class
UnifySolver
(
AcceptSolver
):
...
...
@@ -90,10 +89,7 @@ class UnifySolver(AcceptSolver):
simulation_movement_list
.
append
(
simulation_movement
)
return
simulation_movement_list
# ISolver Implementation
security
.
declarePrivate
(
'solve'
)
@
UnrestrictedMethod
def
solve
(
self
,
activate_kw
=
None
):
def
_solve
(
self
,
activate_kw
=
None
):
"""
Adopt new property value to simulation movements and their deliveries,
while keeping the original one recorded.
...
...
product/ERP5/mixin/solver.py
View file @
9d710981
...
...
@@ -30,6 +30,7 @@
import
zope.interface
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
interfaces
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5.mixin.configurable
import
ConfigurableMixin
...
...
@@ -44,7 +45,14 @@ class SolverMixin(object):
# Declarative interfaces
zope
.
interface
.
implements
(
interfaces
.
ISolver
,)
def
_solve
(
self
,
activate_kw
=
None
):
raise
NotImplementedError
# Implementation of ISolver
security
.
declarePrivate
(
'solve'
)
def
solve
(
self
,
activate_kw
=
None
):
with
super_user
():
self
.
_solve
(
activate_kw
=
activate_kw
)
def
getPortalTypeValue
(
self
):
return
self
.
getPortalObject
().
portal_solvers
.
_getOb
(
self
.
getPortalType
())
...
...
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