Skip to Content
Menu
This question has been flagged
1 Reply
2536 Views
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_test">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<div class="oe_structure">
<div t-if="o.workorder_ids">
<h5 style="margin-top: 40px; font-weight: bold;">А.БҮТЭЭГДЭХҮҮНИЙ ДАМЖЛАГА:</h5>
<table>
<tbody t-if="lines">>
<t t-foreach="lines" t-as="l">
<tr>
<td style="padding-bottom: 10px;">
<span><t t-esc="l['name']"/></span>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>

Here is my python file

# -*- coding: utf-8 -*-
from odoo import api, models
from gevent.hub import sleep
class MrpTest(models.AbstractModel):
  _name = 'production_report.report'
  @api.multi
  def render_html(self, docids, data=None):
  production_obj = self.env['mrp.production'].browse(docids)
  workorder_lines = []
  for production in production_obj.workorder_ids:
  bar_data = workorder.name 
  barcode = code128.Code128(bar_data.encode('utf-8')) 
  barcode.barWidth = inch * 0.008 
  barcode.barHeight = 0.3 * inch
  print 'barcode ::',bar_data
  workorder_line ={'name':bar_data,
  'production_id':workorder.production_id,
  'qty_workorder':workorder.qty_workorder,
  'workcenter_id':workorder.workcenter_id,
  }
  workorder_lines += [workorder_line]
  docargs = {
  'doc_ids': docids,
  'doc_model': 'mrp.production',
  'lines':workorder_lines,
  'docs': self.env['mrp.production'].browse(docids),
  'data': data,
  'barcode':barcode
  }  
  return self.env['report'].render('report_test', {'lines': workorder_lines})

The problem is :

1. My xml, python file doesn't connect

2. I can't print barcode \example value is :: сайна уу\


Please help, I need any solution?


Ouput is only header /<h5>this value</h5>/

Avatar
Discard
Best Answer

 

#object is your record set
<span t-field="object.barcode"/>

Avatar
Discard
Related Posts Replies Views Activity
4
Dec 22
11314
1
Dec 18
1823
1
Jan 18
4532
0
Jul 17
3449
0
May 17
1777