Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3024 Vistas

I used the partner_id m2o from stock move in my custom module BUT when I tried to display it in the loop like:

partner_id.id (returns False) but when i tried the product_id.id it returns a value, 

In my stock.move I have 3 m2o fields (product_id,partner_id,and invoice_id)

I tried to loop the product_id.id and invoice_id.id, then it returns a value which means I have either sales or purchase but when I tried to loop the partner_id.id, it returns False, I tried the other fields of the partner_id like name or date but still it returns false. 

Then I tried to check if the partner_id.id is empty or not then it returns False which mean it is empty even though when I check the stock.move manually and there's a data on it


Each record of the stock move consist of product_id.id,invoice_id.id,partner_id.id,pcs,kgs,amount.  If there's a value return in product_id.id and invoice_id.id, it means there's a partner_id.id.


But, Why the partner_id.id returns False?

Avatar
Descartar
Mejor respuesta

Hi,

First of all make sure that there is a field partner_id in the stock.move, then you have to check whether there is a value in the field partner_id before using partner_id.id.

So by adding an if statement i hope you can solve your issue,

if partner_id:


Thanks

Avatar
Descartar
Autor

Dear Niyas,

If the partner_id.id don't have any value, it will return false?

Publicaciones relacionadas Respuestas Vistas Actividad
2
oct 23
5675
3
sept 23
2517
0
may 23
2559
1
may 23
2021
1
abr 23
1797