跳至内容
菜单
此问题已终结
509 查看

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!

形象
丢弃
相关帖文 回复 查看 活动
0
2月 24
6
3
4月 25
769
1
3月 25
376
4
3月 25
2984
3
2月 25
3570