Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Intelligence artificielle
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Field inside html

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
1 Répondre
2125 Vues
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
Ignorer
Pete Charalampopoulos
Auteur

Works like a charm. Thank you

Avatar
Jainesh Shah(Aktiv Software)
Meilleure réponse

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
Ignorer
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)"/>

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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