Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to define States of object in openERP-7 & OpenERP-8(Odoo)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 441
    Comment on it

    First we have to define the States

    So to define states follow the below code.

                       
     columns = {
                    state: fields.selection([
                     (new,New),                   
                     (assigned,Assigned),
                     (negotiation,Negotiation),
                     (won,Won),
                     (lost,Lost)], Stage, readonly=True),
                } 
    

    After that you can add States Fields (Object).

    def mymod_new(self, cr, uid, ids):
         self.write(cr, uid, ids, { 'state' : 'new' })
         return True
    def mymod_assigned(self, cr, uid, ids):
         self.write(cr, uid, ids, { 'state' : 'assigned' })
         return True
    def mymod_negotiation(self, cr, uid, ids):
         self.write(cr, uid, ids, { 'state' : 'negotiation' })
         return True
    def mymod_won(self, cr, uid, ids):
         self.write(cr, uid, ids, { 'state' : 'won' })
         return True
    def mymod_lost(self, cr, uid, ids):
         self.write(cr, uid, ids, { 'state' : 'lost' })
         return True

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: