Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

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

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
qwebtemplatesale.order
2 Respostas
12903 Visualizações
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
Cancelar
Avatar
Hilar Andikkadavath
Melhor resposta

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
Cancelar
Pascal Tremblay
Autor

Thanks for your precious answers! Have a good day!

Avatar
Pascal Tremblay
Autor Melhor resposta

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
Cancelar
Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
AssertionError: Element odoo has extra content: template, line 5 Resolvido
qweb template
Avatar
Avatar
1
jan. 19
9573
Custom background
qweb template odoo17
Avatar
0
dez. 24
1976
Odoo 11 - I cannot get context on QWeb Template
qweb template context
Avatar
0
dez. 24
1795
How to pass multiple variable to template with t-call?
qweb template odoo16
Avatar
Avatar
2
jul. 24
4435
How to style product description output in sale.order report template?
qweb formatting template
Avatar
Avatar
1
mar. 21
4222
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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