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

Would it be possible to filter the data in res.partner directly in the inherited model before showing it on the page in a list view or kanban or any view?
I was thinking maybe by inheriting the search or read method. If it can be done, should it be done in one of these two or any other? can you please provide a guide on how to do it? 

What I've tried, in the search method, I've tried to append my domain: 

@api.model
def search(self, args, offset=0, limit=None, order=None):
args += [('id', '=', 8)]
print(args)
return super(ResPartner, self).search(args, offset, limit, order)

this will print two things: 

[('id', 'in', [2, 7, 8, 9, 10, 11]), ('id', '=', 8)]


and 

[('parent_id', 'in', [8, 9, 3, 1, 7, 10, 11]), ('id', '=', 8)]


which is not good, since it will still retrieve the full list. 

Another thing that I've tried, is to reassign only my domain to the args: 

@api.model
def search(self, args, offset=0, limit=None, order=None):
args = [('id', '=', 8)]
print(args)
return super(ResPartner, self).search(args, offset, limit, order)

this will print: 

[('id', '=', 8)]

even though the args is now only my domain, it's still returning the full list that I want to filter and I can see everything in the page. 

Is this the right direction to achieve this? 

Any ideas are welcome! 
Thanks


Avatar
Abbandona
Risposta migliore

Hi,

You have the option to enable 'Purchase Order Approval,' which enables you to seek approval from managers for orders exceeding a specified minimum amount.


This feature provides a single level of approval. However, if you require further restrictions, additional customizations will be necessary.

For further details on Purchase Order Approval, please consult this blog: Purchase Order Approval 

Regards


Avatar
Abbandona
Autore

Hi, thanks for the reply, but I think it's not for the right thread 😀

Post correlati Risposte Visualizzazioni Attività
1
set 23
2749
1
mar 15
4184
2
mar 15
4202
2
feb 24
4198
1
lug 23
2615