Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2307 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 25
1695
1
feb 24
3217
0
nov 24
1712
4
ago 24
1971
2
feb 23
2428