Ir al contenido
Menú
Se marcó esta pregunta
2113 Vistas

Dear All, 

I am using studio to enhance some of the records we are keeping track of. For example the serialnumbers. In which I added a locations. A many2one field with contacts. With that I am able to generate a grouplabel in the contacts that take you directly to all related serials numbers for that client.

Now I want that label to behave just like the sales label. The difference is that with the sales label it also shows all sales orders related to contacts related to the main contact.

For example. Company A has 1 sales order and Company A, Herman has 1. Then the label in contact Company A will show 2 sales orders present.

This same functionality I want to make for the serialnumbers. Anybody got an Idea how to go with this?

This is the current code associated with the label.


results = self.env['stock.production.lot'].read_group([('x_studio_installation_location', 'in', self.ids)], ['x_studio_installation_location'], ['x_studio_installation_location'])
dic = {}
for x in results: dic[x['x_studio_installation_location'][0]] = x['x_studio_installation_location_count']
for record in self: record['x_x_studio_installation_location__stock_production_lot_count'] = dic.get(record.id, 0)

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
abr 25
1240
1
feb 24
2900
0
nov 24
1454
4
ago 24
1741
2
feb 23
2117