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

Hello all,

I have a new report defined for the model res.partner to print shipping label.

All these qweb lines print the correct fields content :

<span t-field="o.street"/>
<span t-field="o.zip"/>
<span t-field="o.country_id"/>
<span t-field="o.id"/>


But impossible to use this line :

<span t-field="o.id" t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": false}' />


I get this error with this last line :

Traceback (most recent call last):
  File "/home/odoo/odoo-8.0-20161226/openerp/addons/base/ir/ir_qweb.py", line 600, in to_html
    content = self.record_to_html(cr, uid, field_name, record, options, context=context)
  File "/home/odoo/odoo-8.0-20161226/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/odoo-8.0-20161226/openerp/addons/base/ir/ir_qweb.py", line 951, in record_to_html
    value_rec = value_rec.sudo().with_context(show_address=True)
AttributeError: 'int' object has no attribute 'sudo'


Why??? How could I use the contact widget in this report?


EDIT #1

Why does this line work :

<address t-field="o.parent_id" t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true, "no_tag_br": true}' />

But not his one???

<address t-field="o.id"  t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true, "no_tag_br": true}' />

I don't want address from the parent... I want address from the current partner...


EDIT #2

I can use this to get what I want. But i feel like a cheater...

<h3 t-field="o.name" />
<span t-if="o.street" t-field="o.street" /><br />
<span t-field="o.street2" /><br />
<span t-field="o.city"/>, <span t-field="o.state_id"/>, <span t-field="o.country_id"/><br />
<span t-field="o.zip"/><br />




Avatar
Discard
Best Answer

Had the same problem. I browsed for the partner and saved into 'partner'. Then I had to use partner.self. 

<span t-field="partner.self"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'
style="border-bottom: 1px solid black; display:inline-block;"/>
Avatar
Discard
Best Answer

o.id is getting the partner id, that's an integer. You need the record, that's "o". So I guess that  the answer is:

<address t-field="o" t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true, "no_tag_br": true}' />

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 16
9114
1
May 22
1981
0
Mar 21
2838
5
Sep 20
3681
0
Oct 20
6105