Community: Framework mailing list archives

expert-framework@mail.odoo.com

R: Set field attributes in views dynamically from python

by
Cristian Esposito
- 11/02/2016 07:28:34

What does this operation will do?

I didn’t use any @api and it works..

What does the @api.multi (and self._ensure_one()) is needed for?

 

Thank you

Cristian Esposito

347 5389673

 

Da: Irfan Juneja [mailto:iajuneja@gmail.com]
Inviato: mercoledì 2 novembre 2016 12:23
A: Community: Framework <expert-framework@mail.odoo.com>
Oggetto: Re: Set field attributes in views dynamically from python

 

Please use @api.multi, 

and multiple records are there than use 

self._ensure.one()


Immagine rimossa dal mittente. Odoo (OpenERP)

Irfan Juneja / Technical Consultant 
iajuneja@gmail.com / 
+91-9624291840

Odoo (OpenERP) 
Ahmedabad, Gujarat, India
http://www.odoo.com

Immagine rimossa dal mittente. Twitter Immagine rimossa dal mittente. Immagine rimossa dal mittente. Facebook Immagine rimossa dal mittente. Immagine rimossa dal mittente. Google + Immagine rimossa dal mittente. Immagine rimossa dal mittente. Instagram Immagine rimossa dal mittente. Immagine rimossa dal mittente. Skype Immagine rimossa dal mittente.

 

 

On Wed, Nov 2, 2016 at 1:23 PM, Cristian Esposito <cristian.esposito@hotmail.com> wrote:

The @api.one was the problem.

It seems that the @api.one can’t return the domain as this:

 

{‘domain’ : domain}

 

Thank you everybody for the help!

 

Cristian Esposito

347 5389673

 

Da: Adrian Enns [mailto:enns@guard-tec.de]
Inviato: giovedì 27 ottobre 2016 17:27
A: Community: Framework <expert-framework@mail.odoo.com>
Oggetto: Re: Set field attributes in views dynamically from python

 

http://odoo-new-api-guide-line.readthedocs.io/en/latest/decorator.html#warning-and-domain

 

@api.onchange

....

 

Warning and Domain

To change domain or send a warning just return the usual dictionary. Be careful not to use @api.onein that case as it will mangle the dictionary (put it in a list, which is not supported by the web client).


 

 

 

Immagine rimossa dal mittente. Immagine rimossa dal mittente.

GUARD-TEC
Christian-Lassen-Str. 9
53117 Bonn
Tel.:   0228 / 28 699 500
Mob.: 0176 / 62 31 08 25
Mail: enns@guard-tec.de
Web: www.guard-tec.de



Das Unternehmen GUARD-TEC ist eine Marke / Unternehmenszweig der "WEBER-TECH GROUP" und wird vertreten durch den Geschäftsinhaber Waldemar Weber. Gerichtsstand Bonn.



Privacy & Confidentiality Notice

The information contained in this e-mail is intended for the named recipients only. It may contain privileged and confidential information and if you are not the adressee or the person responsible for delivering this to the adressee, you may not copy, distribute or take action in reliance on it. If you have received this e-mail in error, please notify us immediately by returning the original message to the sender by e-mail.       

 

2016-10-27 12:17 GMT+02:00 Bohdan Lisnenko <lem8r.ka11a@gmail.com>:

Maybe set condition in domain?

 

2016-10-27 12:52 GMT+03:00 Cristian Esposito <cristian.esposito@hotmail.com>:

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

 

_______________________________________________
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

 

_______________________________________________
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

_______________________________________________
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

 

_______________________________________________
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