Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
4498 Vistas

I want to filter for parent_id only categories that are in the same configurator. I've tried filter

domain="[('configurator_id', '=', id)]" for the ID takes the categories ID. If I give for the right argument "configurator_id" or "configurator_id.id" it just raises error.

How can I create this filter?

<record id="tabla_configurator_form_view" model="ir.ui.view">
	<field name="name">Tabla Configurator Form View</field>
	<field name="model">tabla.configurator</field>
	<field name="arch" type="xml">
		<form>
			<sheet>
				<group string="Configurator" colspan="4">
					<field name="id" readonly="1"/>
					<field name="name" required="1"/>
					<field name="active"/>
				</group>
				<group string="Categories" colspan="4">
					<field name="category_ids" nolabel="1">
						<tree editable="bottom">
							<field name="name"/>
							<field name="configurator_id" invisible="1"/>
							<field name="parent_id" domain="[('configurator_id', '=', parent.id)]"/>
						</tree>
					</field>
				</group>
			</sheet>
		</form>
	</field>
</record>

Avatar
Descartar
Autor

As usual your blog is no help at all! The method that creates the domain filter gets only executed when I'm on the views of the model and even then it doesn't work! I need a filter that works when you're on the parent model view!

Autor Mejor respuesta

The domain that worked was:

<field name="parent_id" domain="[('configurator_id', '=', configurator_id)]"/>

Looks like pycharm didn't save it when I updated the module, when I tried it the first time.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
ene 23
6433
2
ene 23
951
1
ene 20
10902
3
ago 25
2386
2
nov 22
5050