I have some fields in a module which i want to access as many2one fields in my module but fails to access the fields.
Here is my code:-
Code:-
class location_rental(models.Model):
_name = "location.rental"
location_id = fields.Char('Location_id', required=True)
location_name = fields.Char("Location Name")
row = fields.Char("Row")
column = fields.Char("Column")
level = fields.Char("Level")
Code:-
class rental_pet(models.Model):
_name = 'rental.pet'
location_id = fields.Many2one('location.rental.location_id', string="Location Id")
row = fields.Many2one("location.rental.row", string="Row")
I am accessing many2one fields as shown in above code but it shows an error. May I get some help?
class rental_pet(models.Model):
_name = 'rental.pet'
location_rental_id = fields.Many2one('location.rental',string="location_rental")
location_id = fields.Char(related='location_rental_id.location_id',string="Location Id")
row = fields.Char(related='location_rental_id.row', string="Row")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.