Skip to Content
Menu
This question has been flagged
2 Replies
3944 Views

On my report ,I need to print current value params of m2o field that passing on wizard :

my wizard class :

 date_from = fields.Date('From')
    date_to = fields.Date('To')
    state_id = fields.Many2one('country.state', string='State')
    localaty_id = fields.Many2one('country.localaty', string='Localaty')

my func report :

def get_request_data(self, data):
        date_from = data['form']['date_from']
        date_to = data['form']['date_to']
        state = data['form']['state_id'][0]
        localaty = data['form']['localaty_id'][0]
        result = []
        records = self.pool.get('app.request')
        recs = records.search(self.cr, self.uid,['|',('req_date', '>=', date_from) ,( 'req_date','<=',date_to),('state_id.id','=',state), ('localaty_id.id','=',localaty)])        
        for rec in records.browse(self.cr,self.uid,recs):
                vals = {
                    'number': rec.number,
                    'date': rec.req_date,
                    'subject': rec.subject,
                    'state': rec.state_id.name,
                    'localaty': rec.localaty_id.name,
                    'person': rec.req_person.name,
                    'status': rec.status
                      }
                result.append(vals)

        return result


my template :

<tr><p align="center"><b>Requests Reprot</b></p>
                                    <div style="text-align:center;">
                                        <div><b>State</b>:<t t-esc="data['form']['state_id.name']"/></div>
                                        <div><b>Localaty</b>:<t t-esc="data['form']['localaty_id.name']"/></div>
                                        <div><b>From</b>: <t t-esc="data['form']['date_from']"/><b>To</b>: <t t-esc="data['form']['date_to']"/></div>
                                    </div>
                                </tr>


it's give this error :

QWebException: "state_id.name" while evaluating
"data['form']['state_id.name']"

Avatar
Discard
Author Best Answer

hello @Sehrish :

I have report generated through wizard ok? that wizard contain many of fields , one of these fields it's many2one (type) ,here I need to print or view current value of field (many2one) was passing by wizard on report template 

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 24
324
1
Jul 24
273
1
May 24
1629
1
May 24
645
0
Mar 24
4