✍️

How to Apply Bold and Italic Style in Odoo 15

Jul 17, 2024

How to Apply Bold and Italic Style in Odoo 15

Introduction

  • Discussing how to apply bold and italic styles in Odoo 15 Community Edition.
  • Tutorial focuses on customizing the tree view using decorations.

Background

  • Previous tutorial covered how to color tree view using decorations.
  • Example: Records in different states (done, draft, canceled) displayed in different colors.
  • Done records in green, canceled records in red.

Making Text Bold

  • Objective: Make the 'Total Amount' field bold in the tree view.
  • Example from Sales module where total is displayed in bold.
  • Steps:
    • Open appointment_view.xml in Pycharm.
    • Locate the total_amount field in the tree view.
    • Add decoration-bf="1" alongside the field definition.
    • Upgrade the module.
    • Confirm that the total field appears bold in the tree view.

Making Text Italic

  • Objective: Make the 'Gender' field italic.
  • Steps:
    • Open the same XML file.
    • Add decoration-it="1" to the gender field.
    • Upgrade the module.
    • Confirm that the gender field appears italic in the tree view.

Combining Decorations

  • It's possible to combine multiple decorations.
  • Example: Making a field both italic and bold, and adding color.
    • Add both decoration-it="1" and decoration-bf="1" for italic and bold.
    • Add decoration-success="1" for green color.
    • Apply conditions like gender == 'female' for conditional formatting.

Common Decorations

  • decoration-success - Green color.
  • decoration-danger - Red color.
  • decoration-warning - Yellow color.
  • decoration-info - Blue color.
  • decoration-muted - Gray color.

Troubleshooting

  • Spaces or incorrect syntax may cause issues.
  • Example: Conditional formatting for gender field may need correction.
  • Confirm keys and values used in conditions properly.

Conclusion

  • Overview of using decoration-bf for bold and decoration-it for italic in Odoo 15.
  • Conditional and multiple attributes can be applied.
  • Reach out with questions or connect on social media.

Contact

  • Email: [email protected]
  • Follow on LinkedIn, Facebook, Twitter, Instagram, GitHub.
  • Like, comment, and share for support.