Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to change tree/form field value in frontend?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
frontendodoo9
2 Răspunsuri
5346 Vizualizări
Imagine profil
lieyanqzu

I wanna change required field value before "Save" via button click, but call button will write values first -- required fields may not have filled in, problem here.

So, change values in frontend should avoid this problem, that's why I want to know how to do it.

I'm using Odoo 9, ideas from other version will be also useful, please share your solution.

0
Imagine profil
Abandonează
Sameer Ahmad

can you be more specific about your issue?

Imagine profil
Sudhir Arya (ERP Harbor Consulting Services)
Cel mai bun răspuns

If you have predefined values for your fields, you can use "default" attribute on your fields or "default_get" method to set the default values to the fields.

If your fields depends on other field(s), you can either use "compute" or "onchange" methods to set the value.

-------------------------------UPDATE-------------------------------------

    @api.multi
def action_add(self):
for rec in self:
rec.result = rec.number1 + rec.number2

@api.multi
def action_multi(self):
for rec in self:
rec.result = rec.number1 * rec.number2

Call these methods from your buttons. This way you can use the fields for the calculation and store the value in another field. Make sure your fields must be of type either integer or float if you are doing mathematical calculation.

4
Imagine profil
Abandonează
lieyanqzu
Autor

For example, I have three fields "number1", "number2", "result"(required), and I want to use two buttons -- "Add" and "Multi" -- to calculate the "result" field value.

I know can add one field like "calculate method" Selection and "onchange" method, but the demand is should add button to do that.

Sudhir Arya (ERP Harbor Consulting Services)

Check my updated answer.

lieyanqzu
Autor

Thanks for your updating, but as I said in question "button call will call 'write' method first" and result field is required that leads to be unable to save values. Maybe Odoo10+ don't have this problem, but I'm using Odoo9. So, I wanna modify frontend JavaScript for manually calling some methods maybe in data.js or date_model.js to change values.

Sudhir Arya (ERP Harbor Consulting Services)

So why don't you make it optional field (remove required)?

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to get data n view using custom widget in odoo 9
odoo9
Imagine profil
0
sept. 23
2690
How to get data n view using custom widget in odoo 9
odoo9
Imagine profil
0
sept. 23
2379
How to Remove " ADD NEW COLUMN " from task kanban view of Project Module? Rezolvat
odoo9
Imagine profil
Imagine profil
Imagine profil
2
iun. 25
11998
How to edit the product website description Rezolvat
odoo9
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
6
oct. 23
23211
Front-end Odoo language
frontend
Imagine profil
Imagine profil
1
aug. 22
7853
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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