Advertisement
lukio

openerp-example-workflow.py

May 3rd, 2012
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.61 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. # gcoop
  4. ##############################################################################
  5.  
  6.  
  7. from osv import fields,osv
  8. from tools.translate import _
  9.  
  10. class gcoop_example(osv.osv):
  11.  
  12.     def _sel_func6(self, cr, uid, context=None):
  13.         return true
  14.  
  15.     _name = 'gcoop.example'
  16.     _columns = {
  17.         'tipo': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'),
  18.         'state': fields.selection([('new','New'),('assigned','Assigned'),
  19.                 ('negotiation','Negotiation'),
  20.                 ('won','Won'),
  21.                 ('lost','Lost')
  22.                 ], 'Stage', readonly=True),
  23.         'field_1': fields.char('Field_1', size=20),
  24.         'field_2': fields.char('Field_2', size=16),
  25.         'field_2': fields.text('Observaciones'),
  26.         'manuf_warranty': fields.boolean('Manufacturer warranty?'),
  27.     }
  28.     _defaults = {
  29.         'state': 'new',
  30.     }
  31.     def gcoop_new(self, cr, uid, ids):
  32.         self.write(cr, uid, ids, { 'state' : 'new' })
  33.         return True
  34.  
  35.     def gcoop_assigned(self, cr, uid, ids):
  36.         self.write(cr, uid, ids, { 'state' : 'assigned' })
  37.         return True
  38.  
  39.     def gcoop_negotiation(self, cr, uid, ids):
  40.         self.write(cr, uid, ids, { 'state' : 'negotiation' })
  41.         return True
  42.  
  43.     def gcoop_won(self, cr, uid, ids):
  44.         self.write(cr, uid, ids, { 'state' : 'won' })
  45.         return True
  46.  
  47.     def gcoop_lost(self, cr, uid, ids):
  48.         self.write(cr, uid, ids, { 'state' : 'lost' })
  49.         return True
  50.  
  51. gcoop_example()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement