Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
610 Widoki

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!

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lut 24
6
4
maj 25
1114
2
maj 25
4226
1
mar 25
604
4
mar 25
3288