Hello,
I've created xls report from wizard.Now I want to add my signature image of parent company that is stored in database. I've tried below code , but I get output as a string for that field instead of Image.I've already checked resources from net to include image using Workbook, but didn't really much helpful as needed.
wizard/bank_report.py
...
...
def print_bank_report(self, cr, uid, ids, context=None):
employee_obj = self.pool.get('hr.employee')
payslip_obj = self.pool.get('hr.payslip')
payslip_line_obj = self.pool.get('hr.payslip.line')
wiz_obj=self.browse(cr,uid,ids)
amount = 0.0
total_amount = 0.0
total_employee = employee_obj.search(cr,uid,[('company_id','=',wiz_obj.company_id.id)],context=context)
total_payslip = payslip_obj.search(cr,uid,[('date_from','=',wiz_obj.from_date),('date_to','=',wiz_obj.to_date)],context=context)
sig = wiz_obj.company_id.parent_id.signature_image
res1 = []
res2 = []
for employee in employee_obj.browse(cr, uid, total_employee, context=context):
for payslip in payslip_obj.browse(cr, uid, total_payslip, context=context):
if employee.id == payslip.employee_id.id:
if employee.bank_name.name == 'SBOP':
print employee.bank_name.name
total_lines = payslip_line_obj.search(cr,uid,[('slip_id','=',payslip.id),('code','=','NET')])
for lines in payslip_line_obj.browse(cr,uid,total_lines):
amount = lines.amount
total_amount += lines.amount
if employee.bank_name.name == 'SBOP':
res1.append ({
'employee':employee.name,
'account_number':employee.bank_ac,
'amount':amount,
'total_amount':total_amount,
'remark': employee.company_id.name,
'ifsc_code': employee.ifsc_code,
'sig':sig,
})
...
..
Here, In .py file, I've created 'res1' then added successfully this into worksheet using workbook = xlwt.Workbook().
In output of sig field, I got too long String in .xls file. How can I get image in .xls file? Or suggest me different possibilities to decode this string into other image format?!