Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3587 Lượt xem

For the function which I wrote in a TransientModel I'm getting the below error:

line 499, in export_xls
    datas['form'] = self.read(['start_date', 'end_date'])[0]

The code is:


@api.multi
def export_xls(self):
    context = self._context
    datas = {'ids': context.get('active_ids', [])}
    datas['model'] = 'wizard.stock.history'
    datas['form'] = self.read(['start_date', 'end_date'])[0]
    for field in datas['form'].keys():
        if isinstance(datas['form'][field], tuple):
            datas['form'][field] = datas['form'][field]
    if context.get('xls_export'):
        return self.env.ref('product_category_report.stock_xlsx').report_action(self, data=datas)

I'm taking stock report from odoo 11. For that purpose I have created a wizard and passing values. Now the error comes like this.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất


tmp = self.read(['start_date', 'end_date'])
if len(tmp) > 0:
  datas['form'] = tmp[0]
You're getting an empty result

    


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 19
3467
2
thg 3 21
28904
2
thg 10 22
9836
3
thg 6 22
12418
6
thg 2 25
53791