Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2413 Widoki

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)

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 25
1837
1
lut 24
3353
0
lis 24
1809
4
sie 24
2099
2
lut 23
2576