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

I am building a function to generate a docx report when a sales order is created. So far, I have found an amazing python module to achieve this (docx). To achieve this, I am hooking to the create() function. However, I cant find a way to access the sales order lines inside the create function. Here is my code:

    def create(self, cr, uid, vals, context=None):
if vals.get('name', '/') == '/':
vals['name'] = self.pool.get('ir.sequence').next_by_code(
cr, uid, 'sale.offer') or '/'
order_lines = vals.get('order_line')# How do I get things like order item names and quantities
return super(sale_offer, self).create(cr, uid, vals, context=context)

Any ideas will be highly appreciated.

아바타
취소
베스트 답변

 Add these codes after order_lines = vals.get('order_line'). Hope  it helps :)

    for line in order_lines:
name = line[-1]['field you want to get']

아바타
취소
관련 게시물 답글 화면 활동
0
4월 24
2092
2
2월 23
2551
0
12월 19
4805
5
12월 19
3851
0
8월 19
4