Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1617 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 25
1387
2
ธ.ค. 23
1623
1
ธ.ค. 23
1485
1
มิ.ย. 23
1917
1
มิ.ย. 23
4725