تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5218 أدوات العرض

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
أبريل 24
1902
2
فبراير 23
2392
0
ديسمبر 19
4609
5
ديسمبر 19
3688
0
أغسطس 19
4