콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
1674 화면

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
2월 25
1441
2
12월 23
1657
1
12월 23
1527
1
6월 23
1945
1
6월 23
4763