跳至內容
選單
此問題已被標幟
1 回覆
5319 瀏覽次數

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!!

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
9月 23
5850
0
6月 22
2227
1
7月 20
3976
1
5月 20
8251
1
1月 25
1819