Odoo Help

3

2
1 Answer
7
Avatar

saad Morocco

--saad--

1028
| 5 4 10
Casablanca, Morocco
--saad--
saad Morocco
9/12/13, 6:42 AM

Hi,
You should put ondelete="cascade" in the field relation id like here:

class sale_order(osv.osv):
    _name = 'sale.order'
    _columns = {
        'name': fields.char('Order Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True),
        'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
        ....
sale_order()


class sale_order_line(osv.osv):
     _name = 'sale.order.line'
     _columns = {
        'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}),
        .
        .
        .
sale_order_line()
1 Comment
Shaumyadeep Chaudhuri India
9/12/13, 10:18 AM

Thanks, i was doing it the other way round. Now it solved the problem

Ask a Question
Keep Informed
1 follower(s)
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.

Register
Odoo Training Center

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

Test it now