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

I want to make the "Pricelist" and "Payment Term" readonly if pricelist and payment term is set for the customer in sale order form.

It should be done on onchange of the customer field how can I do this in odoo9?

Is it possible to call a function on readonly attribute like following?


field_name = fields.Many2one('related_model', 'label', readonly="function_name")


def function_name(self):

     if condition:

         return True

     else:

         return False


아바타
취소
베스트 답변

Hello Sebin Siby,

set attrs on pricelist like

attrs="{'readonly': [('partner_id.pricelist_id', '!=', False)]}

set attrs on payment term same as like pricelist field just change payment term field name.

아바타
취소
작성자

I tried it but it's not working. The states and readonly attribute are set for that field while defining it in .py file. The changes made for readonly attribute from xml is not getting reflected on that field.

작성자

Now I need to remove the states and readonly attribute from .py file and defining it in xml.

I tried redefining that field without these attributes but the attributes doesn't chages.

Did you update your module and refresh your web page after you made your changes? Because changes made in the xml are not automatically reflected on the database.

관련 게시물 답글 화면 활동
3
12월 23
90809
3
9월 21
4992
1
9월 15
8876
4
4월 25
4999
3
7월 23
5637