Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4416 Vistas
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
Descartar

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

Autor

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

Autor

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

Autor Mejor respuesta

"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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 22
4372
1
may 22
2840
1
ene 22
3035
1
ago 24
2000
1
ago 24
2580