콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3153 화면

Good afternoon,

I'm trying to make a column not visible according to a condition, but I don't know why the change does not take effect.

odoo11

* I have no error of any kind. is updated correctly.

Steps:

1-create in the model res_company a new field called: 

    tipo_envio = fields.Selection(selection=[("0","0 - P"),("3","3 - E")])

2-from the invoice view (account_invoice), filter the value according to the new field created in res_company.

current value in res_company.shipment_type = 0

<record model="ir.ui.view" id="des.view_account_invoice_mobile">
  <field name="name">Cambios</field>
  <field name="model">account.invoice</field>
  <field name="inherit_id" ref="account.invoice_form"/>
  <field name="arch" type="xml">
  <field name="invoice_line_ids" position="inside">
     <form>
        <group>
<field name="company_id" invisible="1"/>
<field name="otros" attrs="{'invisible':[('company_id.tipo_envio','not in',['3'])]}"/>  
        </group>
      </form>
    </field>
   </field>
</record>

Also try creating a new field in the account_invoice_line model

related_tipo_envio = fields.Selection(related="company_id.tipo_envio",store=True)

but it doesn't work either.

<field name="otros_cargos_items" attrs="{'invisible':[('related_tipo_envio','!=','3')]}"/>

<field name="factor_isc" attrs="{'invisible': [('related_tipo_envio','in',('0','1','2'))]}"/>

thanks,

아바타
취소
베스트 답변

Hi Gianca,

You need to make sure the conditional field is showed on the view too
<field name="related_tipo_envio" invisible="1"/>
<field name="otros_cargos_items" attrs="{'invisible':[('related_tipo_envio','!=','3')]}"/>
<field name="factor_isc" attrs="{'invisible': [('related_tipo_envio','in',('0','1','2'))]}"/>

Regards,
Ivan

아바타
취소
작성자

Hello, thanks for the answer. I also tried that option. but I read I'm reading and it seems that in the tree view, you can't make a hill invisible like that. I still can't figure out how to do it.

If it is on tree view, it is impossible to hide the field for certain record

If you wish to hide, it will apply to all record in tree view

작성자

thanks for your support. I want to hide the entire column of the account_invoice_line, on the invoice.

for example the price field.

It only works when I make it invisible = "1", but not when it depends on another value.