Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Kecerdasan Buatan
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Manajemen Properti
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Konsultasi
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Field inside html

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
1 Balas
2122 Tampilan
Avatar
Pete Charalampopoulos

I have a paragraph and most of it stays the same. what changes is the monetary values.

A/E Core Return Credit Grade A $100 Grade B $75 Grade C $50
30 Day Return Policy, Credit to be issued with in 7 days of receipt.

i have created 3 float fields grade_a, grade_b and grade_ how can i populate the field values inside the paragraph. This will move to the pdf for the customer 

0
Avatar
Buang
Pete Charalampopoulos
Penulis

Works like a charm. Thank you

Avatar
Jainesh Shah(Aktiv Software)
Jawaban Terbai

Hi @Pete Charalampopoulos

I hope you are doing well,

For you evaluate the values from the html field you will need to the following customisation in Odoo:

- In html field you will need to write as following:
ex:
A/E Core Return Credit Grade A ${object.grade_a} Grade B ${object.grade_b} Grade C ${object.grade_c}
30 Day Return Policy, Credit to be issued with in 7 days of receipt.

- You will need to make adjustment to the document file(xml). Where the html field is defined.
ex.  

 Please find the code  example from the below comments :


- You will need to create the method get_evaluated_val() define the method on res.users to use it throughout odoo.

def get_evaluated_val(self, obj, val, check=False):
"""Evaluate dynamic vals in html field as odoo only evaluates html"""
# Regex to match ${...} pattern
MAIN_REGEX = r"\${.*?}"
val = eval_val = val or ''

# Logic here is to find whole pattern matching ${...},
# Then extract ... from ${}, evaluate the value of ... using safe eval
# Replace the whole match ${...} with evaluated val in the main string
# Replace 1 match at a time to avoid errors next iterations if same
# value is used multiple times
try:
matches = re.finditer(MAIN_REGEX, val, re.MULTILINE)
for match in matches:
to_eval_val = (match.group()).strip().split("${")[1].split("}")[0]
val = safe_eval(to_eval_val, {"object": obj})
eval_val = eval_val.replace((match.group()), val or "", 1)
if not check:
return eval_val
return True
except Exception as e:
raise ValidationError(e)

- You will also need to define a check method on particular model ex. sale.order to check if dynamic fields exist or not.

@api.constrains("html_field")
def _check_html_field(self):
"""
Method to check the dynamic field exists or not.
"""
for record in self:
self.env.user.get_evaluated_val(
record, record.html_field, check=True
)

I hope this will be helpful.

Please note for the above method will only convert dynamic placeholders to value (text representation) but will not display it like field widgets do ie. it will not add currency symbol like monetary widget.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari


0
Avatar
Buang
Jainesh Shah(Aktiv Software)

Please find this comment for Example of :
- You will need to make adjustment to the document file(xml). Where the html field is difined.
ex.
<span t-if="doc.html_field" t-raw="doc.env.user.get_evaluated_val(doc, doc.html_field)"/>

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Karir
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah software terintegrasi dengan 70+ aplikasi seperti CRM, Akuntansi, Inventaris, Sales, eCommerce, Marketing, POS; plus fitur lokal Indonesia!

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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