trytond-sale_waiting /

#This file is part sale_waiting module for Tryton.
#The COPYRIGHT file at the top level of this repository contains 
#the full copyright notices and license terms.

from trytond.model import Workflow, ModelView, fields
from trytond.pyson import If, Eval
from trytond.pool import PoolMeta

__all__ = ['Sale']
__metaclass__ = PoolMeta

class Sale:
    __name__ = ''

    state = fields.Selection([
        ('draft', 'Draft'),
        ('quotation', 'Quotation'),
        ('confirmed', 'Confirmed'),
        ('processing', 'Processing'),
        ('done', 'Done'),
        ('cancel', 'Canceled'),
        ('waiting', 'Waiting'),
    ], 'State', required=True, readonly=True)
    sale_date = fields.Date('Sale Date',
            'readonly': ~Eval('state').in_(['draft', 'quotation']),
            'required': ~Eval('state').in_(['draft', 'quotation', 'cancel','waiting']),

    def __setup__(cls):
        super(Sale, cls).__setup__()
        cls._transitions |= set((
                ('draft', 'quotation'),
                ('quotation', 'confirmed'),
                ('confirmed', 'processing'),
                ('processing', 'processing'),
                ('draft', 'cancel'),
                ('quotation', 'cancel'),
                ('quotation', 'draft'),
                ('draft', 'waiting'),
                ('waiting', 'draft'),
                ('waiting', 'quotation'),
                'draft': {
                    'invisible': ~Eval('state').in_(['cancel', 'quotation', 'waiting']),
                    'icon': If(Eval('state') == 'cancel', 'tryton-clear',
                'set_waiting': {
                    'invisible': Eval('state') != 'waiting',

    def waiting(cls, sales):

    def set_waiting(cls, sales):
        for sale in sales:
            if sale.state == 'waiting':
                cls.write([sale], {
                'state': 'quotation',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.