Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from trytond.model import Workflow, ModelView, ModelSQL, fields
- from trytond.wizard import Wizard, StateView, StateTransition, Button
- from trytond.transaction import Transaction
- from trytond.pool import Pool
- class Presupuesto(ModelSQL, ModelView):
- 'Presupuesto'
- _name = 'presupuesto.presupuesto'
- _description = __doc__
- name = fields.Char('Name')
- greeting = fields.Char('Greeting')
- edad = fields.Char('Edad')
- state = fields.Selection([
- ('draft', 'Draft'),
- ('quotation', 'Quotation'),
- ('confirmed', 'Confirmed'),
- ('processing', 'Processing'),
- ('done', 'Done'),
- ('cancel', 'Canceled'),
- ], 'State', readonly=False, required=False)
- def __init__(self):
- super(Presupuesto, self).__init__()
- self._buttons.update({
- 'cancel': {
- 'invisible': ((Eval('state') == 'cancel')
- | (~Eval('state').in_(['draft', 'quotation'])
- & (Eval('invoice_state') != 'exception')
- & (Eval('shipment_state') != 'exception'))),
- },
- 'draft': {
- 'invisible': Eval('state') != 'quotation',
- },
- 'quote': {
- 'invisible': Eval('state') != 'draft',
- 'readonly': ~Eval('lines', []),
- },
- 'confirm': {
- 'invisible': Eval('state') != 'quotation',
- },
- 'process': {
- 'invisible': Eval('state') != 'confirmed',
- },
- })
- # The states where amounts are cached
- self._states_cached = ['confirmed', 'processing', 'done', 'cancel']
- @ModelView.button
- @Workflow.transition('cancel')
- def cancel(self, ids):
- import pdb; pdb.set_trace()
- self.store_cache(ids)
- Presupuesto()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement