Skip to Content
Menu
This question has been flagged
3 Replies
4990 Views

Is there any way to use one2many field without declaring it in a class? I

Avatar
Discard
Best Answer

hi,

Please go through this link

https://www.odoo.com/nl_NL/forum/help-1/question/show-tree-view-inside-a-note-book-page-22944

Avatar
Discard
Author

Thank you for responding,it is not clear and what i want to know is whether we can use a one2many field without declaring it in a specified class?

friend did you find an answer to your problem

Best Answer

#--------------- Class 2----------------

class class2(models.Model):

_name = 'class2'

_description = 'Class 2'

item_order_line = fields.Many2one('class1','Item')

item_id = fields.Char('Item Number')

item_title = fields.Char('Item Title')

quantity_ordered = fields.Integer('Quantity')

sale_price = fields.Char('Sale Price')

#----------------- Class 1 -----------------

class class1(models.Model):

_name = 'class1'

_description = 'Class 1'

_inherit = ['class2']

#------------------ o2m -----------------

order_line = fields.One2many('class2','item_order_line',string='Order Lines')

Example ;)

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 23
12549
1
Aug 23
11054
1
Jul 23
7228
4
Apr 23
8677
2
Feb 23
17600