odoo pandas

        fieldstr = '''id,debit,credit,balance'''
        self.env.cr.execute('''select %s from account_move_line
                        order by id desc''' % fieldstr)
        try:
            a = self.env.cr.fetchall()

        except:
            pass

        df = pd.DataFrame(a, columns=fieldstr.split(','))
        df.to_excel(r'D:\odoo\odoo16\attachments\1.xlsx', index=False)

  

posted @ 2023-07-28 16:27  CrossPython  阅读(45)  评论(0)    收藏  举报