Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Why is it impossible to use the contact widget on this res.partner qweb report?

Subscribe

Get notified when there's activity on this post

This question has been flagged
widgetqwebcontactres.partner
2 Replies
11582 Views
Avatar
Pascal Tremblay

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 />




0
Avatar
Discard
Avatar
Samo Arko
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;"/>
0
Avatar
Discard
Avatar
Esther Martín
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}' />

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How to render a view widget within Qweb template?
widget qweb res.partner
Avatar
Avatar
1
Jun 16
10877
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
contact res.partner
Avatar
Avatar
1
May 22
3547
Qweb Widgets V14
widget qweb
Avatar
0
Mar 21
4492
res.partner custom field in is_company
widget res.partner
Avatar
Avatar
5
Sep 20
5969
Can't get Widget to see the Qweb template
javascript widget qweb
Avatar
0
Oct 20
8180
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now