Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
713 views
in Technique[技术] by (71.8m points)

odoo - Cant figure out how to import one2many and many2one models

Here's the code of a custom model i made, the first class is a model of stocks and general information. The second class contains the daily prices of each of the stocks in the first class for 10 days. The relational field that connects the two is the name of the stock.

I've done a lot of research in order to import the models but i seem to not be able to make it work, any help would be massively appreciated.

class ticker_info(models.Model):
    _name = 'ticker.rep'
    _description = 'Repository of stocks'

    name = fields.Many2one('ticker.db', string = 'Tickers')
    Sector = fields.Char()
    Symbol = fields.Char()


class ticker_prices(models.Model):
    _name = 'ticker.db'
    _description = 'Database of historical data'

    name = fields.Char(string = 'Tickers')
    Date = fields.Datetime()
    Close = fields.Float(digits=(9, 5))

Edit: For each stock in class 1 it needs to be connected to model 2 where i can see 10 daily prices of that stock.

question from:https://stackoverflow.com/questions/66063962/cant-figure-out-how-to-import-one2many-and-many2one-models

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...