attributeerror '_unknown' object has no attribute 'id' odoo
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Hi,
Could you double-check that your __manifest .py file contains the appropriate depends and make sure the model name given in the Many2one fields are correct.
Hi,
There are several reasons to get the error “unknown object has no attribute id “
->If we add a many2one field , for example
product_id = fields.Many2one(‘product.product’ string=’Product’)
But we didn’t add ‘product’ on 'depends' in the manifest file,and then we get the error.
->If define a Many2one field without a model, ie, for example
Product_id = fields.Many2one(string=’Product’)
->When we pass wrong data types , for example
field_name = fields.Many2one('partner_id.phone', string=’ Number', readonly=True)
Here the field phone is a Char field , but we give the field type is Many2one
Regards
Hi,
Other than the shared code, did you have any many2one field without comodel specified in your module ?
Thanks
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
0
يوليو 19
|
4833 | ||
object has no attribute '_ids'
تم الحل
|
|
2
مايو 15
|
20583 | |
|
0
ديسمبر 22
|
2749 | ||
|
1
سبتمبر 22
|
3697 | ||
|
0
سبتمبر 22
|
2312 |
class Employeeservice(models.Model):
_name = "employee.service"
_description = "Service"
_rec_name = 'combination'
code = fields.Char('code Service',size=5,required=True)
name = fields.Char('Libellé Service',size=150,required=True)
visa = fields.Char(string='Visa service',size=10)
priv_req = fields.Char(string='Prive req',size=1)
type_visa = fields.Char(string='Type visa',size=1)
type_service = fields.Char(string='Type service',size=10)
_sql_constraints = [('unique_code', 'unique(code)', 'Le code doit être unique !')]
combination = fields.Char(string='Combination', compute='_compute_fields_combination')
@api.depends('code','name')
def _compute_fields_combination(self):
for rec in self:
if rec.code and rec.name:
rec.combination = rec.code + ' ' + rec.name