Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5264 Widoki

Hi, i work on Openerp7.

i want to make zip code and city obligatory on res.partner.form in a custom module.

I've tried to inherit XLM view and put this fields as required. It seems ok but according the country of the company, class format_address() in base.res_partner.py modify the view and then zip code and city are no longer required even if i inherit format_adress() class and put in code for example :

<field name="zip" required="1" placeholder="ZIP mandatory" />

required="1" seems don't work...

How can I do ?

Awatar
Odrzuć
Najlepsza odpowiedź

I was able to get this field to be mandatory by just inheriting and changing the attribute 'required':

image description

This results in the field becoming mandatory on the form view:

image description

Awatar
Odrzuć
Autor

As I say in my question :It seems ok but according the country of the company, class format_address() in base.res_partner.py modify the view and then zip code and city are no longer required even if i inherit format_adress() class and put in code for example : <field name="zip" required="1" placeholder="ZIP mandatory" />

required="1" seems don't work...

How can I do ?

Sorry. I didn't check my option with different countries.