Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
715 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...