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

I have created a Many2one field in my custom model

Python:

class SalesGroup(models.Model):    
    _name = 'pl.sales.group'
    
    warehouse_id = fields.Many2one('stock.warehouse', string='Warehouse',required=True)

However, when i am creating/editing a record, all the warehouses listed down, but when i select one value and save the form/record, the warehouse field sets to null.



아바타
취소
작성자 베스트 답변

I solved it myself. The field wasn't setting to null rather than it was not showing any data value. A many2one relation shows display_name field value, when record is saved. I set store=True flag on display_name, without computing or initiating it, which is why that field was set to null on all records.

아바타
취소
베스트 답변

Hi , 

Try Giving force_save="1" along with field definition in XML.
      

Hope It Helps,
Kiran K


아바타
취소
작성자

Tried force_save="1" and store=True. Not solved. I think this is specifically in case of stock.warehouse

관련 게시물 답글 화면 활동
2
4월 23
2871
2
2월 25
40654
2
11월 22
2916
1
2월 22
7938
0
10월 21
2325