Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1839 Vizualizări

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

Imagine profil
Abandonează

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

Cel mai bun răspuns

Your question is not clear can you explain elaborate.


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
4
mai 25
1484
1
mai 25
751
1
apr. 25
819
0
mar. 25
768
0
aug. 24
1175