Skip to Content
Menu
This question has been flagged
I'm getting this error, "ValueError: Invalid field product.product(32,) on model 'mrp.bom'" while trying to update a OCA module to be compatible with version 15. Happens when I go to create the model and try to set a product

Based on an OCA module, mrp_production_request, I haven't changed anything in the model other than that method

I have the "record.bom_id = boms" separated out for debugging, and that's where the error is

@api.onchange("product_id")
def _onchange_product_id(self):
for record in self:
if record.product_id:
record.product_uom_id = record.product_id.uom_id
boms = record.env["mrp.bom"]._bom_find(
record.product_id,
company_id=record.company_id.id,
picking_type=record.picking_type_id,
)
record.bom_id = boms

(What's up with this website, it keeps putting backslashes on all my text, im pretty sure it doesn't like links)

Here's the full error: https://www.toptal.com/developers/hastebin/ifecavurik.trace
OCA Module: https://github.com/OCA/manufacture/blob/13.0/mrp_production_request/models/mrp_production_request.py#L249-L257
Avatar
Discard

elaborate the question with the module that you are trying to use.
also for adding codes in odoo forum, see; https://www.youtube.com/watch?v=nw3q0Cs1swg

Author

Niyas, I tried, but the website kept putting backslashes on my post (hence my comment in parentheses). So I tried to put it in links, but didn't work, my post is quite elaborate, but the website is bugged

Author

Niyas, I edited the post to not include any actual links and that made the backslashes go away. But then it made my whole post monospaced. This is by far one of the worst rich text editors I've ever used. A new one should be implemented, see; https://www.youtube.com/watch?v=TQG4yNVnGV4

Author Best Answer

"record.env["mrp.bom"]._bom_find(...)" now returns a dict, so you have to index return with the product like "boms[record.product_id]"

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 22
2144
1
May 22
1116
1
Jan 22
1730
1
Aug 24
362
1
Aug 24
945