İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
1965 Görünümler

I am working on an Odoo 16 module and I'm facing an issue with context passing when creating a new contact from my module. Specifically, I have three custom fields that should only be visible when a certain context is present, but they are not showing up as expected.

When I start writing in the contact_id field and click "create and edit", the context should be passed so that I can fill out the additional fields in res.partner, but it doesn't work. However, when I click on a contact that already exists, the context is being passed correctly and the fields are visible.

res_partner.py: 

from odoo import models, fields, api

class ResPartner(models.Model):
    _inherit = 'res.partner'

    age = fields.Integer(string="Age", tracking=True)
    sex = fields.Selection([
        ('male', 'Male'),
        ('female', 'Female'),
        ('other', 'Other')
    ], string="Sex", tracking=True)
    occupational_group = fields.Selection([
        ('white_collar', 'White Collar'),
        ('blue_collar', 'Blue Collar'),
        ('other', 'Other')
    ], string="Occupational Group", tracking=True)
    show_claim_fields = fields.Boolean(string="Show Claim Fields", compute="_compute_show_claim_fields")


res_partner_views.xml: 

res.partner.form.inherited res.partner



claim_details_views.xml: 

Add claim ir.actions.act_window claim.details form new {'default_policy_number': policy_number} Create Contact res.partner form new {'default_from_claims': True} claim.details.view.form claim.details




Any ideas how to fix it? Any help would be greatly appreciated!I

Avatar
Vazgeç

Please post your xml view under code code snippet. Your question is unclear.

En İyi Yanıt

Your question is not clear can you explain elaborate.


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
4
Tem 25
1647
1
Tem 25
905
1
Nis 25
915
0
Mar 25
885
0
Ağu 24
1271