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

For example, I want to modify the domain of `sale.order.order_line`, and I have to copy all code and add the domain:

class SaleOrder(orm.Model):
    _name = _inherit = "sale.order"
    
    _columns = {
        # Copied from the original, but with domain
        'order_line': fields.one2many(
            'sale.order.line', 
            'order_id', 
            'Order Lines', 
            domain=[("optional", "=", False)],
            readonly=True, 
            states={'draft': [('readonly', False)], 
                    'sent': [('readonly', False)]}),
    }

But I want to know if there is any way to just declare what I want to modify, and leave the rest as is. Something similar to:

class SaleOrder(orm.Model):
    _name = _inherit = "sale.order"

    _columns = {
        'order_line': {
            "domain": [("optional", "=", False)],
        }
    }

Is it possible?

아바타
취소
베스트 답변

I don't think that is possible. If you create a field that alreasy exists in the original module, you will completely redefine the field. So yes, if you only wanted to add "required=True" to a field, you have to copy the entire field and add that attribute unfortunately.

Perhaps this will be different with the new API, but for now I think it is not possible.

아바타
취소
관련 게시물 답글 화면 활동
1
2월 23
8157
2
5월 22
2948
1
5월 22
3690
2
4월 17
3478
1
4월 24
3629