Odoo Help


Perform action on click Boolean Field

Atul Kumar jain
on 1/13/14, 8:46 AM 2,419 views

I want to Generate Purchase Order From the sale order, so i inherit here sale order and many2one field for purchase order error but it has given me error that is except_orm: ('Programming Error', 'There is no reference available for purchase.order'

class sale_inherit_course(orm.Model):
            'create_course':fields.boolean('Create Course'),
            'course_name':fields.many2one('openacademy.course', 'Course', ondelete="cascade"),
           'responsible': fields.related('course_name', 'responsible_id', type='many2one', relation='res.users', string="co-ordinator", readonly=True),
           'buy_back':fields.boolean('Buy Back'),
           'purchase_order':fields.many2one('purchase.order', 'Create Back Order', ondelete="cascade"),
           'responsible_me': fields.related('purchase_order', 'responsible_id', type='many2one', relation='res.users', string="User", readonly=True),

    def create(self, cr, uid, vals, context=None):
        if vals.get('create_course'):
            sequence=self.pool.get('ir.sequence').get(cr, uid, 'openacademy.course.seq')
            new_course=course_obj.create(cr, uid, {'name':sequence,'responsible_id':vals.get('user_id')}, context=context)
            import pprint
           pprint.pprint( vals )
          pprint.pprint( vals )
      elif vals.get('buy_back'):
          sequence=self.pool.get('ir.sequence').get(cr, uid, 'purchase.order')
          new_purchase=purchase_obj.create(cr, uid, {'name':sequence,'responsible_id':vals.get('user_id')}, context=context)

    return super(sale_inherit_course, self).create(cr, uid, vals, context=context)

Here Error Occur that is except_orm: ('Programming Error', 'There is no reference available for purchase.order'




| 5 4 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 1/13/14, 8:55 AM

Have you checked the Sale Module Depends Purchase module added in __openerp__.py File ?? If not add the depends


i want to create function that can compute purchase order value and sale order value so how i can do that

Atul Kumar jain
on 1/14/14, 3:01 AM

Atul Kumar jain

--Atul Kumar jain--
| 5 3 7
Indore, India
--Atul Kumar jain--


Atul Kumar jain
On 1/13/14, 8:47 AM

I am getting stuck to solve this problem

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/13/14, 8:46 AM
Seen: 2419 times
Last updated: 3/16/15, 8:10 AM