Odoo Help

0

0
5 Answers
0
TECHQUK SAC Peru
16:44, 11/09/2019
Esto te puede servir.
<field name="nombre" class="o_required_modifier" placeholder="Ex. Juan Mejia"/>nombre = fields.Char('Nombre', required=True)
@api.onchange('nombre')    
def solo_mayusculas(self):        
if self.nombre:                
 self.nombre = str(self.nombre).upper()       
else:           
 self.nombre = '' 
0
Avatar

Jake Robinson Australia

--Jake Robinson--
8065
| 3 1 6
Glenmore Park, Australia
--Jake Robinson--

I help businesses grow with Odoo.

As a freelance Odoo consultant, I'm constantly learning more to provide the best service that I can. I have handled a wide range of projects, from 1 man teams to 40+ employee companies, across a number of business sectors. If you want to get the most out of your Odoo implementation, email me today at jake@programmedbyjake.com

If you want to learn more about implementing Odoo, check out my podcast: Going Odoo

Jake Robinson Australia
05:54, 11/04/2018

Hi

There's no default setting for this, to have it done properly you would need to hook the write method or make a widget.

A workaround is to add the following to the field definition in the view:

 style="text-transform: uppercase;"

This will change the rendering of the field to be uppercase, but it will still be stored as lowercase, so if you show it in another view without this style it will still be in lowercase.

Regards,
Jake Robinson
Dionysus Software

0
Avatar

Niyas Raphy India

--Niyas Raphy--
27060
| 7 7 11
Wayanad, Kerala, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123
Whatsapp : +917736136763
Happy to help :)

Niyas Raphy India
05:53, 11/04/2018

Hi,

Just do one thing, in the onchange of that field,

@api.onchange('field_name')
def set_upper(self):
    self.field_name = str(self.field_name).upper()
    return


Thanks

2 Comments
ProgrammedByJake, Jake Robinson Australia
05:59, 11/04/2018

Firstly, make sure you do a check if it is set:

self.field_name = str(self.field_name).upper() of self.field_name else ''

Without that it will set the field to "FALSE" if you delete the data in it.

If this field is set by an internal function the onchange won't be called, so if there's any reason this field will be edited by another function this is unsafe.

medmars Morocco
05:44, 10/05/2018

Yeah it set empty field by FALSE so i'm try to add your code but it give me an error

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now