Skip to Content
Menu
This question has been flagged
1238 Views

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
Discard
Related Posts Replies Views Activity
1
Feb 24
1167
0
Nov 24
277
4
Aug 24
328
2
Feb 23
899
0
Dec 24
23