Community mailing list archives

community@mail.odoo.com

Re: Add data to Many2many using search in XML

by
Alien Group Lda, Alaney Kilson Dória
- 06/02/2016 02:27:13

Now a question arise, In documentation, shows that its possible to use attribute search in fields for xml,

"field

Each record can be composed of field tags, defining values to set when creating the record. A record with no field will use all default values (creation) or do nothing (update).

A field has a mandatory name attribute, the name of the field to set, and various methods to define the value itself:

Nothing
if no value is provided for the field, an implicit False will be set on the field. Can be used to clear a field, or avoid using a default value for the field.
search

for relational fields, should be a domain on the field's model.

Will evaluate the domain, search the field's model using it and set the search's result as the field's value. Will only use the first result if the field is a Many2one

"
So, from what I can assume it should work with any relational fields.  I saw some examples of this for many2one. In my case the field I want to search is unique so it should be possible to do it.

Regards
ALIEN GROUP LDA

Alaney Dória

CEO | Odoo Consultant

em.alaney.doria@alien-group.com

tm.+244 913 728 600

Linkedin Facebook Facebook
Código QR

Rua Doutor Agostinho Neto, 156, Bairro Azul, Luanda - Angola, Tel: +244 913 728 600 | +244 913 728 650,
Website: www.alien-group.com, Email: geral@alien-group.com

Não imprima este email caso não seja estritamente necessário. A Terra agradece-lhe!

On 06/02/2016 02:07 AM, Dominique KON SUN TACK wrote:

Hi Alaney,

it is not possible to use a 'search' in xml.
You can filter records by using a domain.

Regards

On 2 Jun, 2016 6:58 am, "Alaney Dória" <alaney.doria@alien-group.com> wrote:

Hi all,

It's possible to use search for many2many fields in xml?

ex: <field name="tags" search="[('some_field','=', some_value)]"

My intention is to add a set of fields  but I don't have xml id to identify the data, so I want to use search to find the related record and return ids.

Best regards
--
ALIEN GROUP
                        LDA

Alaney Dória

CEO | Odoo Consultant

em.alaney.doria@alien-group.com

tm.+244 913 728 600

Linkedin Facebook Facebook
Código QR

Rua Doutor Agostinho Neto, 156, Bairro Azul, Luanda - Angola, Tel: +244 913 728 600 | +244 913 728 650,
Website: www.alien-group.com, Email: geral@alien-group.com

Não imprima este email caso não seja estritamente necessário. A Terra agradece-lhe!

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

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