Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5162 Vizualizări

Hi,

how can I update a stock.move field in sale.order in an onchange method?

I have the following workaround:

@api.onchange("test_field")
def _on_change(self):
    list = []
    for line in self.order_line:
        for move in line.move_ids:
            move.update({'state': 'new_state'}) #not working! -> no error but no change on database
         list.append([1, self._origin.id, line])
self.update({'order_line': list }) #not working! -> error: AttributeError: 'sale.order.line' object has no attribute 'items'

What am I doing wrong here? Is there another possibility to change the move_line state from sale_order??

Thanks!!

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,


Please check this.


@api.onchange('test_field')

def _onchange_test_field(self):

    for line in self.order_line:

        for move in line.move_ids:

            move.state = 'new_state'


Hope it helps

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
sept. 23
5739
0
iun. 22
2196
1
iul. 20
3919
1
mai 20
8115
1
ian. 25
1703