Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
1941 Vues

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
Ignorer

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

Meilleure réponse

Your question is not clear can you explain elaborate.


Avatar
Ignorer
Publications associées Réponses Vues Activité
4
juil. 25
1625
1
juil. 25
877
1
avr. 25
896
0
mars 25
853
0
août 24
1251