Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1398 Zobrazení

I'm using this code to get the order lines of a sale order
    sale_order_line_ids = fields.Many2many("sale.order.line","helpdesk_ticket_ids", compute="_compute_sale_order_lines", copy=True, auto_join=True)


    @api.depends("sale_order_id")    def _compute_sale_order_lines(self):        for record in self:            if record.sale_order_id:                record.write({"sale_order_line_ids": [(6, 0, record.sale_order_id.order_line.ids)]}) 

but if they are used in a view they cant be edited.
does anybody know what can be done to make them editable?

Avatar
Zrušit
Nejlepší odpověď

Hi,


You can't edit the field in the view because it is a computed field. By setting the computed field to readonly=False, you will make it editable.


.py

 sale_order_line_ids = fields.Many2many("sale.order.line","helpdesk_ticket_ids", compute="_compute_sale_order_lines", copy=True, auto_join=True,readonly=False)


Hope it helps

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 24
1933
1
led 25
3162
2
srp 24
5720
1
říj 23
1190
6
pro 22
8583