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

I'm trying to make a relation between the model client.parte and the model  helpdesk.ticket beeing client.parte the main one so i can relate the ticket code to a  report, to do that i create a field in mi client.parte called ticket that should be  a many2one, and i try to make that the domain is the name of the customer in the report is the same of many tickets and i can select one, but the problem is that the name is too a many2one field
I think it sould look something like this, but i cant make it work
   ticket = fields.many2one('helpdesk.ticket', string='Ticket vinculado', domain="[('nombrecomercial', '=', self.partnergf_id)]")

client.parte_nombrecomercial=
 [ nombrecomercial = fields.Many2one('res.partner', string='Nombre comercial', domain=[('is_company', '=', True)]) ]
helpdesk.ticket_partnergf_id=
[partnergf_id = fields.Many2one('res.partner', string='Cliente', domain=[('is_company', '=', True)])]


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

you can try this code


from odoo import api, fields, models


class ClientParte(models.Model):

    _name = 'client.parte'

    _description = 'Client Parte'


    partnergf_id = fields.Many2one('res.partner', string='Customer', domain=[('is_company', '=', True)])

    ticket = fields.Many2one('helpdesk.ticket', string='Ticket bound', domain="[('partnergf_id.nombrecomercial', '=', nombrecomercial)]")


class ResPartner(models.Model):

    _inherit = 'res.partner'


    nombrecomercial = fields.Many2one('res.partner', string='Nombre comercial', domain=[('is_company', '=', True)])


class HelpdeskTicket(models.Model):

    _name = 'helpdesk.ticket'

    _description = 'Helpdesk Ticket'



    partnergf_id = fields.Many2one('res.partner', string='Customer', domain=[('is_company', '=', True)])


Hope it helps

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
sept. 25
1982
1
iun. 25
2010
3
iul. 25
3587
1
mai 25
1715
4
mai 25
3059