I have an One2many field on a model and I wanna read the same values from another model. I tried adding a Many2one relation to it but it seems to not read data. Can someone please help me?
the way I have defined one2many:
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")
class ProductTemplate(models.Model):
_inherit = "product.template"
kestet_ids = fields.One2many('kestet.lines', 'product_template_id', string="Kestet", store=True)
property.contract(where I need it the most):
class PropertyContract(models.Model):
_name = "property.contract"
_order = 'start_date'kestet2_id = fields.Many2one('kestet.lines')
everytime it gives me 0 when I do kestet2_id.vlera
You need connection between "product.template" and "property.contract"
I did that but it gave me empty recordset everytime.