Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5263 มุมมอง

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']

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 24
1964
2
ก.พ. 23
2460
0
ธ.ค. 19
4663
5
ธ.ค. 19
3757
0
ส.ค. 19
4