This question has been flagged

Hey all,

I have the following question:


I have a model called vlabel.products and another model that inherites from res.partner. 

They share a relationship through this line in the vlabel.product model:

related_company = fields.Many2one('res.partner', string='Licencee', required=True)


and this line in the other model:
products = fields.One2many('vlabel.product', 'related_company', string='Products')


Now, for the vlabel.product, I want to display a number that is related to the order from which products were created for related_company, so I guess that would be some kind of index.

Let's say I have a company "Awesome Company" that has four products related to it and I have 4 product records that all belong to the "Awesome Company".

In a show view for the vlabel.product modeI I want to display a number that refers to the order in which these products were created for the specific company.

So, when it was the first product created for this specific company, I want to display a 1. If it was the second product a 2, and so on and so forth. 

This of course means that multiple products can have the same number, which is what I want.

I tried index.method and multiple other ways to get to the number but didn't manage at all. Any help is appreciated.


Greetings

Adrian


Avatar
Discard
Author

push