Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1609 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

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

Publicaciones relacionadas Respuestas Vistas Actividad
1
sept 23
2738
1
mar 15
4167
2
mar 15
4199
2
feb 24
4185
1
jul 23
2607