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
296 Widoki

Hi, I’m working on Odoo 18 and I have two fields in my “Produzione Pasti” form:

  • Sede (the catering location)
  • Servizio Associato (the service)

I need the Servizio Associato dropdown to show only the services available for the selected Sede, rather than listing every service.

Here’s my current XML view (I’ve left the domain empty for now because i don't know how to edit it without causing errors):

xml

<data> <xpath expr="//field[@name='x_name']" position="attributes"> <attribute name="force_save">1</attribute> <attribute name="readonly">1</attribute> <attribute name="required">1</attribute> <attribute name="string">Nuovo Pasto</attribute> </xpath> <xpath expr="//group[@name='studio_group_ced1b4_left']" position="attributes"> <attribute name="string">Scelta del centro cottura</attribute> </xpath> <xpath expr="//group[@name='studio_group_ced1b4_left']" position="inside"> <field name="x_studio_sede" options="{'create_name_field':'x_name','no_create':True}" required="1"/> </xpath> <xpath expr="//group[@name='studio_group_ced1b4_right']" position="attributes"> <attribute name="string">Selezionare il servizio</attribute> </xpath> <xpath expr="//group[@name='studio_group_ced1b4_right']" position="inside"> <field name="x_studio_servizio_associato_1" options="{'create_name_field':'x_name','no_create':True,'no_open':True}" domain="[]"/> </xpath> <xpath expr="//form/sheet" position="after"> <chatter/> </xpath> </data> Thank You:)

Awatar
Odrzuć

What's the relationship between these fields?

Najlepsza odpowiedź

Hi,


Try with the following code


<field name="x_studio_servizio_associato_1"
options="{'create_name_field':'x_name','no_create':True,'no_open':True}"
domain="[('x_studio_sede_id', '=', x_studio_sede)]"/>

Make sure your "Servizio Associato" model (whatever it’s named) has a Many2one field.


Hope it helps

Awatar
Odrzuć