openerp - How to get the following situation solved in odoo 8? -
i trying print many2many field value in qweb pdf report
following code
purchase_quotation.py
class purchase_quotation(osv.model): _name="purchase.quotation" _rec_name='vno' _columns={ 'name':fields.many2one('res.users','name', readonly=true), 'date':fields.date('order date', required=true), 'vno':fields.char('voucher no',size=40,readonly=1), 'branch':fields.selection([ ('blocka', 'block a'), ('blockb', 'block b'), ('admin', 'admin'), ], 'branch/office', readonly= false, select=true, required=true), 'user_manager_id':fields.many2one('res.users','manager'), 'approve_by':fields.char('approved by'), 'order_line': fields.one2many('product.text', 'pro_ref', 'order lines',required=true), }
purchase_order.py
class purchase_order(osv.osv): _inherit = "purchase.order" _columns = { 'vno_ref':fields.many2many('purchase.quotation', 'voch_ref' , string='ref.voucher no'), 'spo':fields.many2one('res.users','submit to', domain = [('is_approver','=',true)],), }
code in qweb pdf report
<div class="col-xs-4 pull-right"> <strong>order date:</strong> <p t-field="o.date_order" t-field-options='{"widget": "date"}'/> <strong>ref voucher no:</strong> <p t-field="o.vno_ref"/> </div>
how can display values of many2many fields in qweb pdf report. having idea on this?thanks
just check sale order report u find best solution
i sale order line having tax_id part of many2many field.
you can access field using below way
<tr t-foreach="o.order_line" t-as="l"> <td> <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/> </td> </tr>
same way can implement field on own way qweb view report rendering , after check print pdf report
i hope answer may helpful :)
Comments
Post a Comment