Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Why does this line not work in the sale order qweb template?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
qwebtemplatesale.order
2 Antwoorden
12907 Weergaven
Avatar
Pascal Tremblay

Hello all,

On the template sale.report_saleorder_document in Odoo 10 enterprise.

One line causes an error, and I don't find the problem. It is weird because this line works on an other Odoo 10 installation.

These lines works well :

<span t-field="l.price_subtotal" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' />
<span t-field="l.price_total" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' />
<span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}" />

But this one doesn't work :

<span t-esc="amount_by_group[1]" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}" />

I get this error :

QWebException: unsupported operand type(s) for /: 'unicode' and 'float'
Traceback (most recent call last):
  File "/opt/odoo/addons/base/ir/ir_qweb/qweb.py", line 315, in _compiled_fn
    return compiled(self, append, values, options, log)
  File "<template>", line 1, in template_sale_report_saleorder_document_1191
  File "<template>", line 3, in body_call_content_1190
  File "<template>", line 136, in foreach_1172
  File "/opt/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 276, in _get_widget
    content = converter.value_to_html(value, field_options)
  File "/opt/odoo/addons/base/ir/ir_qweb/fields.py", line 322, in value_to_html
    formatted_amount = lang.format(fmt, display_currency.round(value),
  File "/opt/odoo/addons/base/res/res_currency.py", line 93, in round
    return tools.float_round(amount, precision_rounding=self.rounding)
  File "/opt/odoo/odoo/tools/float_utils.py", line 52, in float_round
    normalized_value = value / rounding_factor # normalize
TypeError: unsupported operand type(s) for /: 'unicode' and 'float'
Error to render compiling AST
TypeError: unsupported operand type(s) for /: 'unicode' and 'float'
Template: sale.report_saleorder_document
Path: /templates/t/t/div/div[3]/div/table/t/tr/td[2]/span
Node: <span t-esc="amount_by_group[1]" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/>
-1
Avatar
Annuleer
Avatar
Hilar Andikkadavath
Beste antwoord

Hi,

Please check the values returned by _get_tax_amount_by_group , I think ie unicode or string, not float.

this is the code that fetches amount_by_group

<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">    ...


python function _get_tax_amount_by_group() returns;

res = map(lambda l: (l[0].name, formatLang(self.env, l[1], currency_obj=currency)), res)
return res
1
Avatar
Annuleer
Pascal Tremblay
Auteur

Thanks for your precious answers! Have a good day!

Avatar
Pascal Tremblay
Auteur Beste antwoord

In my Odoo 10 on which I do my tests :

We have this in account_invoice and sale_order _get_tax_amount_by_group :

res = map(lambda l: (l[0].name, l[1]), res)

So, these lines work well in sale orders and invoices :

<span t-field="doc.amount_total" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' />
<span t-esc="amount_by_group[1]" t-options='{"widget": "monetary", "display_currency": o.currency_id}' />


On the Odoo 10 enterprise of my customer, the code in Python is not the same, we have this line in account_invoice and sale_order _get_tax_amount_by_group :

res = map(lambda l: (l[0].name, formatLang(self.env, l[1], currency_obj=currency)), res)

So, like mister Hilar said, this line will be sufficient in sale orders and invoices PDF report :

<span t-esc="amount_by_group[1]"  />
1
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
AssertionError: Element odoo has extra content: template, line 5 Opgelost
qweb template
Avatar
Avatar
1
jan. 19
9575
Custom background
qweb template odoo17
Avatar
0
dec. 24
1978
Odoo 11 - I cannot get context on QWeb Template
qweb template context
Avatar
0
dec. 24
1796
How to pass multiple variable to template with t-call?
qweb template odoo16
Avatar
Avatar
2
jul. 24
4436
How to style product description output in sale.order report template?
qweb formatting template
Avatar
Avatar
1
mrt. 21
4222
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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