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

How to hide/remove an "Add a line" in transfers when the status is done/cancelled?


Version: odoo 18 e+

아바타
취소
작성자 베스트 답변

Hello,

This will hide the  "Add a line" in transfers when the status is done/cancelled.

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_picking_form_inherit_restrict_new" model="ir.ui.view">
        <field name="name">stock.picking.restrict.new</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='move_ids_without_package']" position="attributes">
                <attribute name="options">{'create':[('state','not in',['done','cancel'])]}</attribute>
            </xpath>
        </field>
    </record>
</odoo>
아바타
취소
베스트 답변

Hi,

Please refer to the code:

<record id="view_picking_form_inherit" model="ir.ui.view">

    <field name="name">stock.picking.form.inherit.disable_add_line</field>

    <field name="model">stock.picking</field>

    <field name="inherit_id" ref="stock.view_picking_form"/>

    <field name="arch" type="xml">

        <xpath expr="//field[@name='move_line_ids']" position="attributes">

            <attribute name="readonly">state in ['done','cancel']</attribute>

        </xpath>

    </field>

</record>

When state is done or cancel, the field becomes readonly, so users cannot add new lines, and the “Add a line” button disappears automatically.


Hope it helps.

아바타
취소
관련 게시물 답글 화면 활동
1
11월 24
19550
5
8월 24
3455
0
8월 22
12862
0
1월 22
2870
1
3월 25
4869