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

How to take a value from a popover and update Unit Price in sale.order.line?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
saleswidgetOdoo13.0
2 Respostas
4072 Visualizações
Avatar
Russ Schneider

Odoo.sh 13e  Sales app

Please see screenshot.  I have a popover widget that when you click on it, does calculations based on numbers passed to it.  

The screenshot is from runbot, and the popover is just like this example one.  Now the $14.00 that's in the popover, I'd like to click on it, and update the Unit Price (price_unit) for that line item, but no matter what I try, I can't get it to update.

How can I do this?

Screenshot: https://snipboard.io/eFYxRK.jpg


0
Avatar
Cancelar
Ray Carnes (ray)

The Widget you reference is pulling information already on the Sale Order Line.

Does your customization create a field on the Sale Order Line and have the Widget show it?

Also, is this a case to use Pricelists? (ie is there a calculation are you doing that can't be done with a Pricelist?)

Russ Schneider
Autor

@Ray Carnes:

No, it can't be done as a pricelist as these care choices made by the user on the fly. Client is particular that this works in a certain way.

The fields are all created in the model, sale.order.line.

Then I extended the view sale.view_order_form and added the fields invisible:

<record id="sale_order_line_tree_stock_price_custom" model="ir.ui.view">

<field name="name">sale.order.line.tree.stock.price.custom</field>

<field name="model">sale.order</field>

<field name="type">form</field>

<field name="inherit_id" ref="sale.view_order_form"/>

<field name="arch" type="xml">

<xpath expr="//page/field[@name='order_line']/tree/field[@name='price_unit']" position="before">

<field name="last_price" invisible="1"/>

<field name="last_date_order" invisible="1"/>

<field name="gross_profit_percent" invisible="1"/>

<field name="repl_cost_current" invisible="1"/>

<widget name="custom_price_widget" width="0.1"/>

</xpath>

</record>

Then there's the javascript call:

<record id="sale_order_line_view_price_custom" model="ir.ui.view">

<field name="name">sale.order.line.view.price.custom</field>

<field name="type">qweb</field>

<field name="inherit_id" ref="web.assets_backend"/>

<field name="arch" type="xml">

<xpath expr="." position="inside">

<script type="text/javascript" src="/mw_custom/static/src/js/saleOrderLinePriceCustom.js"/>

</xpath>

</field>

</record>

Which pulled from this template:

<templates>

<div t-name="mw_custom.icon">

<div>

<a tabindex="0" class="fa fa-usd text-primary"/>

</div>

</div>

<div t-name="mw_custom.CustomPricePopOver">

<table>

<tr>

<th>Last Price</th>

<td>$<span t-esc="data.last_price"/></td>

</tr>

<tr>

<td colspan="2"><span t-esc="data.last_date_order"/></td>

</tr>

<tr>

<td colspan="2"><hr/></td>

</tr>

<tr>

<th>GP%: <span t-esc="data.gp_price"/></th>

<td><a href="#">Calculate</a></td>

</tr>

<tr>

<td>Repl Cost: <span t-esc="data.repl_cost_current"/></td>

<td>Percent: <input type="text" size="3" id="gross_profit_percent"/></td>

</tr>

</table>

<button id="closeThis">Close</button>

</div>

</templates>

And populated everything and was able to handle all calculations with the JS, which went through MANY iterations, but no mater what I did, I couldn't get the results of the calculations to pass back to sale.order.line.

The result of the script would've had two: and by clicking "Use" buttons next to each, one of those was to update sale_oder_line.price_unit on the line we're working on. But it didn't seem that the line/row had an id yet because it's not saved yet, nor could I find a unique identifier for the specific field, and even when I tried to tree down through all the DOM elements, once I would mouse away from the line, price_unit would revert to whatever it had initially.

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
How to widget="float_toggle" value will be unlimited?
widget Odoo13.0
Avatar
Avatar
1
dez. 20
3917
odoo 13 widget dont run start function
widget Odoo13.0
Avatar
0
abr. 20
4409
Odoo automaticly replaces customer on sale order without reason Resolvido
sales ecommerce Odoo13.0
Avatar
Avatar
Avatar
Avatar
3
jan. 24
3328
odoo 13 : write() function updates on wrong record
sales coupon Odoo13.0
Avatar
Avatar
1
nov. 21
2925
Sale order - delivered quantities do not match with validated deliveries
sales warehouses Odoo13.0
Avatar
0
set. 21
2857
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