I have three models which are connected with each other.
The first one is an inheriting of product.template
(product_template.py)
and as you see I have a one2many
field which is connected to the second model showed in here.
When I want to access variables from product_template.py
with dot notation
I can see variable suggestion and I guess it works fine.
class ProductTemplate(models.Model):
_inherit = "product.template"
kestet_ids = fields.One2many('kestet.lines', 'product_template_id', string="Kestet", store=True)
class OnetoMany(models.Model):
_name = "kestet.lines"
partner_id = fields.Many2one("res.partner")
kestet = fields.Char(string="Emri i Kestit(n)")
vlera = fields.Integer(string="Vlera e Kestit(n)")
data = fields.Date()
sel1 = fields.Selection(
[('kontrate', 'Kontrate'), ('levrim', 'Levrim Kredie'), ('karabina', 'Karabina'), ('hipoteka', 'Hipoteka'),
('Celsat', 'Celsat'), ('Ne Perfundim', 'Ne Perfundim'),
('other', 'Tjeter')], string="Menyra Likujdimit")
pagesa1 = fields.Selection([('Cash', 'Cash'), ('Bank', 'Bank'), ('Klering', 'Klering')], string="Menyra Pageses")
product_template_id = fields.Many2one("product.template")
property_contract_id = fields.Many2one("property.contract")
Now when I try to access it from this other model property_contract.py
and do the same thing as above, it doesn't give me variable suggestions and I can not access variable values.
class PropertyContract(models.Model):
_name = "property.contract"
_order = 'start_date'
name = fields.Char("Contract Number")
kestet2_ids = fields.Many2one('kestet.lines')
I also tried:
installment_id = fields.Many2one("product.templates")
installment_relation = fields.One2many(related="installment_id.kestet_ids")
It failed giving me results. I tried also the above code but didn't work...
What am I doing wrong here?