This question has been flagged
1 Reply
3768 Views

I've been developing a custom module which allows you to store data on multiple sites a company owns, and gas/electric meters installed at that location. When I try and save a new site record it throws the error. Not sure what I've done wrong.

error here pastebin.com/UzSGZmVG

code here pastebin.com/5MNMuBrF (I commented out the required=True to see if that was causing the issue).

view here pastebin.com/H7sSrQat

Avatar
Discard
Best Answer

There is an issue with one2many/many2one definition of meter/site. site --> one2many --> meter meter --> many2one --> site

means in site object, meter_ref should be many2one of meter but it is defined as text field and that's why its throwing an error. You may also get the same for site --> partner relationship.

Hope it will help you.

Thanks, Priyesh Solanki

Avatar
Discard
Author

Thanks, I have fixed the error. But now I am more confused, I didn't add in an inverse field for site_owner, it just links to res.partner and shows the name field which is how I want it.

Code now. pastebin.com/mn10kdR4

This doesn't work entirely as desired, for instance MPAN is showing in the notebook listing instead of meter_ref and there's an unknown field (presumably the new many2one) when adding a new meter.