Hai i am new to openERP When i execute the mymod_assigned function i got the above error on line 27. My code is pasted below.The error is in that function on raise osv.except_osv(). Pls help me....
from openerp import pooler
from openerp.osv import fields, osv
from openerp import netsvc
class mymod(osv.Model):
_name = 'mymod.mymod'
_columns = {
'name': fields.char('Name', size = 100),
'dob': fields.date('Date of birth'),
'father_name': fields.char('Father Name', size = 100),
'state': fields.selection([
('new','New'),
('assigned','Assigned'),
('negotiation','Negotiation'),
('won','Won'),
('lost','Lost')], 'Stage', readonly=True),
}
def mymod_new(self, cr, uid, ids):
self.write(cr, uid, ids, {'state': 'new'})
return True
def mymod_assigned(self, cr, uid, ids,context=None):
for o in self.browse(cr, uid, ids):
if (o.state =='new'):
raise osv.except_osv(_('Error!'),_('You cannot confirm a sales order which has no line.'))
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
mymod()