Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1651 Lượt xem

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  

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 25
1419
2
thg 12 23
1640
1
thg 12 23
1495
1
thg 6 23
1928
1
thg 6 23
4740