تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4413 أدوات العرض
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
الصورة الرمزية
إهمال

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

الكاتب

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

الكاتب

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

الكاتب أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 22
4371
1
مايو 22
2840
1
يناير 22
3034
1
أغسطس 24
1999
1
أغسطس 24
2580