コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
1647 ビュー

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
1416
2
12月 23
1635
1
12月 23
1494
1
6月 23
1927
1
6月 23
4737