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

I created a form view and added a button so that when i hit the button i can generate values in the tree view inside the form view.

The values generated must be according to the values entered in the fields of the form view is this possible to do or not.

Thanks in advance




아바타
취소
베스트 답변

Hi  houssem salem,


Refer below code for creating records in the One2many field on button click.

def create_terms(self):
self.terms = False
terms_lines = []
terms_ids = self.env['so.terms.config'].search([])
for rec in terms_ids:
values = {
'name': rec.name,
'description': rec.description,
}
terms_lines.append((0, 0, values))
self.terms = terms_lines

terms = fields.One2many('sale.order.terms.conditions', 'order_id', string='Terms and Conditions')


아바타
취소
작성자

I already have values in the one2many fields so what im asking is that after filling the form view fields i can hit a generate values button that i have created that gives me the ability to retrieve data from other modules and prints that data into the tree view inside the form view .

베스트 답변

Hi,

Of course it is doable if you are good in odoo orm. I hope the tree inside form view, refers to a one2many field.


Odoo ORM: https://www.odoo.com/documentation/15.0/developer/reference/backend/orm.html


Thanks & Regards

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

Hi niyas,

yes my tree inside the form view refers to one2many fields but i can't figure out the function that can do the automated generation of the records. Please if you have an exemple to how it is done share it with me.


Thanks


아바타
취소