Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1633 Weergaven

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  

 

Avatar
Annuleer
Beste antwoord

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


Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
feb. 25
1404
2
dec. 23
1631
1
dec. 23
1487
1
jun. 23
1919
1
jun. 23
4732