Skip to Content
Menú
This question has been flagged
524 Vistes

Hello

I am having a seamingly weird issue. I have extended the Sales order model to add 3 extra fields, 2 of them are Many2one relational fields (event and stand), and 1 is a related field (stand number).

one of the relational fields is actually a parent of the other. Events have stands, and if I create a sales order for a stand, I want it to save the event id as well so I can keep track of all the sales orders of the event.

When I create a new sales order from a stand, I pass through the context the event_id, and the partner_id

  

when the pop up window comes up, it correctly displays both the event, and the client


but when I save the record, the partner_id is saved properly, but the event_id gets set to null.


I tried overriding the create() method on my salesorder class but even there, the vals_list only shows partner_id and stand_id, not event_id.


here is my class extension:

class SaleOrder(models.Model):
    _inherit = 'sale.order'

    event_id = fields.Many2one('irig.event', string='RigEx Event', store=True)
    stand_id = fields.Many2one('irig.stand', string='RigEx Stand')
    stand_identifier = fields.Char(related="stand_id.stand_identifier")

I have tried it with and without the "store" property and with and without the "change_default" property as well


Can anybody help me figure this out?

p.s. I tried posting some pictures, but apparently I dont have enough good karma 🤷‍♂️

Thank you very much!

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de febr. 24
6
3
d’abr. 25
782
1
de març 25
391
4
de març 25
3007
3
de febr. 25
3589