Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Gabriel Monnerat
slapos.core
Commits
55bfa679
Commit
55bfa679
authored
Dec 05, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unused constraint
parent
2f586645
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
97 deletions
+1
-97
master/bt5/vifib_erp5/ConstraintTemplateItem/AvailableItemOnSource.py
...ifib_erp5/ConstraintTemplateItem/AvailableItemOnSource.py
+0
-95
master/bt5/vifib_erp5/bt/revision
master/bt5/vifib_erp5/bt/revision
+1
-1
master/bt5/vifib_erp5/bt/template_constraint_id_list
master/bt5/vifib_erp5/bt/template_constraint_id_list
+0
-1
No files found.
master/bt5/vifib_erp5/ConstraintTemplateItem/AvailableItemOnSource.py
deleted
100644 → 0
View file @
2f586645
##############################################################################
#
# Copyright (c) 2002-2010 Nexedi SA and Contributors. All Rights Reserved.
# Stephane COLLE <scolle@ville-sevran.fr>
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
Products.ERP5Type.Constraint
import
Constraint
from
Products.ERP5Type.Utils
import
convertToUpperCase
from
DateTime
import
DateTime
class
AvailableItemOnSource
(
Constraint
):
"""
This method checks if an Item is available
at the source node of a movement at the date start_date.
Configuration example:
{ 'id' : 'available_item',
'description' : '',
'type' : 'AvailableItemOnSource',
'base_category' : 'aggregate',
'portal_type' : ('Item', ),
},
"""
def
checkConsistency
(
self
,
obj
,
fixit
=
0
):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""
if
not
self
.
_checkConstraintCondition
(
obj
):
return
[]
errors
=
[]
base_category
=
self
.
constraint_definition
[
'base_category'
]
portal_type
=
self
.
constraint_definition
[
'portal_type'
]
aggregate_item_uid_list
=
[
obj
.
restrictedTraverse
(
x
).
getUid
()
for
x
in
obj
.
getCategoryMembershipList
(
base_category
,
portal_type
=
portal_type
)]
# only if there are aggregate items, of course...
if
(
len
(
aggregate_item_uid_list
)
>
0
):
source_value
=
obj
.
getSourceValue
()
start_date
=
obj
.
getStartDate
()
resource_value
=
obj
.
getResourceValue
()
quantity
=
obj
.
getQuantity
(
0
)
# we check if each aggregate item is actually on the source node
kw
=
{}
kw
[
'at_time'
]
=
start_date
# kw['resource_uid'] = resource_value.getUid()
if
source_value
is
not
None
:
kw
[
'node_uid'
]
=
source_value
.
getUid
()
kw
[
'item.aggregate_uid'
]
=
aggregate_item_uid_list
results
=
obj
.
portal_simulation
.
getCurrentTrackingList
(
**
kw
)
if
(
source_value
is
None
):
if
len
(
results
):
error_message
=
"Items are already located"
errors
.
append
(
self
.
_generateError
(
obj
,
error_message
))
else
:
if
(
len
(
results
)
!=
len
(
aggregate_item_uid_list
)):
error_message
=
"Items must be located on source node 1"
errors
.
append
(
self
.
_generateError
(
obj
,
error_message
))
else
:
for
result
in
results
:
if
(
result
.
uid
not
in
aggregate_item_uid_list
):
error_message
=
"Items must be located on source node 2"
errors
.
append
(
self
.
_generateError
(
obj
,
error_message
))
return
errors
master/bt5/vifib_erp5/bt/revision
View file @
55bfa679
585
586
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_erp5/bt/template_constraint_id_list
deleted
100644 → 0
View file @
2f586645
AvailableItemOnSource
\ 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