Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1087 Lượt xem

Hello all,


After I have made all fields editable in the status ‘posted’ in Accounting(Account.move.line), I would now like to hide the delete icon, the buttons ‘Add a line’, ‘Add a section’ and ‘Add a note’ in the status ‘posted’. 


I used this to make the fields in the TreeView editable:

Override in --> account.move

invoice_line_ids = fields.One2many( # /!\ invoice_line_ids is just a subset of line_ids. 'account.move.line', 'move_id', string='Invoice lines', copy=False, readonly=False, domain=[('display_type', 'in', ('product', 'line_section', 'line_note'))], )

<xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">
​<attribute name="create">0</attribute>
   <attribute name="delete">0</attribute>
</xpath>

With this i hide it for all status.

Many thanks all!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You can use the following code to hide the delete icon, the buttons ‘Add a line’, ‘Add a section’, and ‘Add a note’ in the status ‘posted’.


XML

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']" position="attributes">
<attribute name="readonly">state == 'posted'</attribute>
</xpath>
</field>
</record>
</odoo>

Hope it helps

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 8 25
129
1
thg 8 25
49
1
thg 8 25
703
1
thg 8 25
408
2
thg 8 25
1584