This question has been flagged
1 Reply
2223 Views

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
Discard
Best Answer

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
Discard
Author

Dear Niyas,

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