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

I want to inherited the "serial_no" from "maintenance.equipment"  to "maintenance.request" if it's possible how ? 

Note: the request and equipment model once inherited to my custom module  

 

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

Hi,

You can use Delegation Inheritance for this case. In delegation inheritance, you create a new object that delegates some of its functionality to an existing object.

Here's an example : 

class MaintenanceRequest(models.Model):

    _name = 'maintenance.request'

    _inherit = 'maintenance.equipment'


For more information please refer to this blog: Different Types of Inheritance in Odoo



Hope it helps


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

Hi Nasrat 

Try to add a serial_no field in maintenance request and use related to fetch its value based on maintenance.equipment 


Class MaintenanceRequest(models.Model):

_inherit = 'maintenance.request'

serial_no = fields.Char(string='Serial No',related='equipment_id.serial_no')


Regards

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
فبراير 25
1391
2
ديسمبر 23
1626
1
ديسمبر 23
1485
1
يونيو 23
1917
1
يونيو 23
4728