Skip to Content
Menu
This question has been flagged
1 Atsakyti
1804 Rodiniai

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

Portretas
Atmesti

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

Best Answer

Your question is not clear can you explain elaborate.


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
4
geg. 25
1453
1
geg. 25
724
1
bal. 25
774
0
kov. 25
757
0
rugp. 24
1136