This question has been flagged

Hi guys,

I have a ticket and a solution model. I want to be able to pick known solutions from my ticket and then add a workflow to determine if the solution corrected the problem, was refused or is still pending.

Basically, I think I need to add fields to a many2many relationship but can't find out how to do that. Here is my code:

class tickets(models.Model):
_name = 'tickets.tickets'
solution_ids = fields.Many2many(
'tickets.solutions',
'tickets_solutions_rel',
'ticket_id',
'solution_id',
string='Solutions'
)

class solutions(models.Model):
_name = 'tickets.solutions'

ticket_ids = fields.Many2many(
'tickets.tickets',
'tickets_solutions_rel',
'solution_id',
'ticket_id',
string='Ticket'
)


And here I wish I could something like that: (To simplify here, i just tried to add a boolean field "accepted")

class tickets_solutions_rel(models.Model):
_name = 'tickets.tickets_solutions_rel'

ticket_ids = fields.Many2one(
'tickets.tickets'
)

solution_ids = fields.Many2one(
'tickets.solutions'
)

accepted = fields.Boolean()

to see it like that in my view:

<record model="ir.ui.view" id="ticket_form_view">
    <field name="name">Ticket form</field>
    <field name="model">tickets.tickets</field>
    <field name="arch" type="xml">
        <form string="Ticket form">
            <field name="solution_ids">
    <tree>
    <field name="tickets_solutions_rel.accepted"/>
<field name="name"/>
<field name="description"/>
</tree>
</field>
        </form>
    </field>
</record>

I'm really stuck here, if someone could help, it would be awesome ! ;)

Thanks

Avatar
Discard

Can you describe in detail your problem?

Author

Sure, when i ./odoo-bin my code. I obtain the error :

-Field tickets_solutions_rel.accepted does not exist.

I'm pretty sure i implemented my code incorreclty, but i don't know how to add fields to the table that stores the relation.