콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2106 화면

This is how it should work.For example:

1 ------column1------------

2 ------column2------------

3 ------column3------------

4 ------Column4------------

etc..

I have made an automated action for this, but it does not work as intended:

The automated action refers to the model of the one2many field and is triggered when a record is created. The following Python code is executed:



for line in record.picking_id.move_line_ids_without_package:
  for rec in str(record.x_studio_position):
    record['x_studio_position'] = len(record.picking_id.move_line_ids_without_package) 

What happens is the following for e.g. 4 columns

4 ------column1------------

4 ------column2------------

4------column3------------

4 ------column4------------

It will write the total number in each row instead of the current column number.



아바타
취소
베스트 답변

You set the position to the number of lines in the field move_line_ids_without_package, it will be the same for all lines.

You can use enumerate to get the line sequence

Example:

for index, line in enumerate(record.picking_id.move_line_ids_without_package): line['x_studio_position'] = index + 1

아바타
취소