Esempio n. 1
0
class OrderStates_Enumerate(Enumerate):
    @classmethod
    def get_options(cls):
        options = []
        for name, value in states.items():
            options.append({
                'name': name,
                'value': value,
                'color': states_color[name]
            })
        return options


# Workflow definition
order_workflow = Workflow()
add_state = order_workflow.add_state
add_trans = order_workflow.add_trans

# States
states = {
    '': MSG(u'Unknow'),
    'open': MSG(u'Waiting payment'),
    'partial_payment': MSG(u'Partial payment'),
    'payment_ok': MSG(u'Payment validated'),
    'preparation': MSG(u'Order in preparation'),
    'out_stock': MSG(u'A product is out of stock'),
    'delivery': MSG(u'Package sent'),
    'payment_error': MSG(u'Payment error'),
    'cancel': MSG(u'Canceled'),
    'closed': MSG(u'Closed')
Esempio n. 2
0
# 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, see <http://www.gnu.org/licenses/>.

#  Import from itools
from itools.datatypes import Enumerate
from itools.gettext import MSG
from itools.workflow import Workflow


class OrderStateEnumerate(Enumerate):

    options = [
        {"name": "open", "value": MSG(u"Waiting payment"), "color": "#BF0000"},
        {"name": "partially-paid", "value": MSG(u"Partially paid"), "color": "#75906E"},
        {"name": "to-much-paid", "value": MSG(u"To much Paid"), "color": "#75906F"},
        {"name": "paid", "value": MSG(u"Paid"), "color": "#FFAB00"},
        {"name": "canceled", "value": MSG(u"Canceled"), "color": "#FF1F00"},
        {"name": "closed", "value": MSG(u"Closed"), "color": "#000000"},
    ]


order_workflow = Workflow()
add_state = order_workflow.add_state
for option in OrderStateEnumerate.options:
    add_state(option["name"], title=option["value"])
order_workflow.set_initstate("open")
Esempio n. 3
0
# 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, see <http://www.gnu.org/licenses/>.

# Import from the Standard Library
from unittest import TestCase, main

# Import from itools
from itools.workflow import Workflow, WorkflowAware

# Definition of the workflow
# Create the workflow object
workflow = Workflow()

# Specify the workflow states
workflow.add_state('private',
                   description='A private document only can be reached by'
                   ' authorized users.')
workflow.add_state('pending',
                   description='A pending document awaits review from'
                   ' authorized users to be published.')
workflow.add_state('public',
                   description='A public document can be reached by even'
                   ' anonymous users.')

# Specify the workflow transitions
workflow.add_trans('request',
                   'private',
Esempio n. 4
0
# Copyright (C) 2010 J. David Ibáñez <*****@*****.**>

# Import from itools
from itools.workflow import Workflow, WorkflowAware


# Workflow definition
workflow = Workflow()
# Specify the workflow states
workflow.add_state('private', title=u'Private')
workflow.add_state('pending', title=u'Pending')
workflow.add_state('public', title=u'Public')
# Specify the workflow transitions
workflow.add_trans('publish', 'private', 'public', title=u'Publish')
workflow.add_trans('request', 'private', 'pending', title=u'Request')
workflow.add_trans('reject', 'pending', 'private', title=u'Reject')
workflow.add_trans('accept', 'pending', 'public', title=u'Accept')
workflow.add_trans('retire', 'public', 'private', title=u'Retire')
workflow.set_initstate('private')


class Document(WorkflowAware):

    def onleave_private(self):
        print 'LEAVE PRIVATE'


    def ontrans_request(self):
        print 'REQUEST'

Esempio n. 5
0
# 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, see <http://www.gnu.org/licenses/>.

# Import from the Standard Library
from unittest import TestCase, main

# Import from itools
from itools.workflow import Workflow, WorkflowAware


# Definition of the workflow
# Create the workflow object
workflow = Workflow()

# Specify the workflow states
workflow.add_state(
    'private', description='A private document only can be reached by'
                           ' authorized users.')
workflow.add_state(
    'pending', description='A pending document awaits review from'
                           ' authorized users to be published.')
workflow.add_state(
    'public', description='A public document can be reached by even'
                          ' anonymous users.')

# Specify the workflow transitions
workflow.add_trans('request', 'private', 'pending',
                   description='Request the document publication.')
Esempio n. 6
0

class OrderStates_Enumerate(Enumerate):

    @classmethod
    def get_options(cls):
        options = []
        for name, value in states.items():
            options.append({'name': name,
                            'value': value,
                            'color': states_color[name]})
        return options


# Workflow definition
order_workflow = Workflow()
add_state = order_workflow.add_state
add_trans = order_workflow.add_trans

# States
states = {
  '': MSG(u'Unknow'),
  'open': MSG(u'Waiting payment'),
  'partial_payment': MSG(u'Partial payment'),
  'payment_ok': MSG(u'Payment validated'),
  'preparation': MSG(u'Order in preparation'),
  'out_stock': MSG(u'A product is out of stock'),
  'delivery': MSG(u'Package sent'),
  'payment_error': MSG(u'Payment error'),
  'cancel': MSG(u'Canceled'),
  'closed': MSG(u'Closed')}