تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5 الردود
11942 أدوات العرض

hello i need help, i made model inheritance now when i want to delete an object from model i have this error 

this is my inheritance, I do not want to overload the model product.product 
thanks, excuse my english is not good ;XD
TypeError: Mixing apples and oranges: product.product().union(parcinfo.equipement(2,))
class Equipement(models.Model):
_name = 'parcinfo.equipement'
_inherit = 'product.product'
_description = 'description des equipements du parc informatique'
الصورة الرمزية
إهمال
أفضل إجابة

Returning nothing in creare,write functions throw same error

Make sure you are returning the result

الصورة الرمزية
إهمال
أفضل إجابة

Hi mesby, 
May be you are trying to compare objects and id.

Example: product.template(1,) == 12 [In that case throws that kinda error]

الصورة الرمزية
إهمال
أفضل إجابة

Hi mesby,


The error mixing oranges and apples occur when you are trying to do some operations on two completely unrelated objects. From your error you can see that you are doing some operation on two different models, product.product and parcinfo.equipment. Check your code properly.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

my code is a simple inheritance I just want to delete an object. how to solve it please


الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Remove the name attribute from the class and see, also nice if you can add those codes defined inside this class. The reason for the error is what Mihran specified in his answer.


class Equipement(models.Model):
_inherit = 'product.product'
_description = 'description des equipements du parc informatique'

Thanks

الصورة الرمزية
إهمال