Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: Set field attributes in views dynamically from python

by
Stephen Raj
- 10/27/2016 06:15:29
Hi Cristian Esposito,

@api.one
@api.onchange('flag_riordino_products')
def onchange_flag_riordino_products(self):
    if self.flag_riordino_products: # if this flag == True: need to set domain
        domain = {'FIELD_NAME': [(CONDITION)]}}
    else:
        domain = {}
return {'domain': domain}

Try this. This may help you.

On Thu, Oct 27, 2016 at 3:22 PM, Cristian Esposito <cristian.esposito@hotmail.com> wrote:

Hi,


i need to set a domain on a standard field many2one, based on change of a custom value.

Example:

@api.one
@api.onchange('flag_riordino_products')
def onchange_flag_riordino_products(self):
if self.flag_riordino_products: # if this flag == True: need to set domain
# set domain
else:
# if the flag == False: no domain
Does someone have any idea?

Thanks a lot for your support

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

Stephen Raj D

​Team Lead[Python]

Bosco Soft Technologies Pvt Ltd
http://www.boscosofttech.com
Mobile: +91 8870312211
Skype: stephen.erpconsultant
​​
http://www.boscosofttech.com/images/temp_top_title_left_img.gif