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

When opening the view_stock_move_line_operation_tree view from within receiving on a lot controlled item. The Lot Name field and the button are displayed. The user can enter a lot number manually (which is OK), however the following button cannot be selected.


<?xml version="1.0" encoding="utf-8"?>

<odoo>

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

        <field name="name">stock.move.line.operations.tree.inherit.szm</field>

        <field name="model">stock.move.line</field>

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


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

            <xpath expr="//field[@name='lot_name']" position="before">

                <button name="action_create_custom_lot_no_szm" type="object" class="btn btn-primary fa fa-plus-square-o" groups="stock.group_production_lot" context="{'default_company_id': parent.company_id, 'default_product_id': parent.product_id, 'active_picking_id': picking_id}" attrs="{'invisible': [('lot_id', '=', False),('lot_name', '!=', False)]}"/>

            </xpath>

    </field>


</record>

</odoo>

Ảnh đại diện
Huỷ bỏ
Tác giả

Sudhir,

The record is "saved" and ready for receipt, but the lot number needs to be entered first. The "Button" is designed to automatically create a lot number based on other rules. I just cannot figure out why the the button is inactive.

Thank you for replying.


It is inactive because of the attrs condition.

attrs="{'invisible': [('lot_id', '=', False),('lot_name', '!=', False)]}"

Odoo does not hide the field/button in the tree view when you use invisible in attrs but instead, it will make the field read-only and button inactive.

Your button is inactive because I think lot_id is blank and lot_name has value. Please double-check this.

Tác giả
Sudhir,
The change actually had an adverse effect. The button/column become invisible.
One thing that is bothering me is that if I define the XML as follows.

<button name="action_create_custom_lot_no_szm" type="object" class="btn btn-primary fa fa-plus-square-o" groups="stock.group_production_lot"/>

The button is displayed in the tree view, but the user cannot "click" on the button.

I'm beginning to think that adding buttons within a tree view (a list) is not possible.



On Tue, Nov 3, 2020 at 8:57 AM Sudhir Arya (ERP Harbor Consulting Services) <sudhir22.arya@gmail.com> wrote:

It is inactive because of the attrs condition.

attrs="{'invisible': [('lot_id', '=', False),('lot_name', '!=', False)]}"

Odoo does not hide the field/button in the tree view when you use invisible in attrs but instead, it will make the field read-only and button inactive.

Your button is inactive because I think lot_id is blank and lot_name has value. Please double-check this.

Sent by Odoo S.A. using Odoo.



--
Jeff R. Mueller, PMP
JRM Business Systems Solutions, LLC
c/o Precision Solutions
cell: (978)-430-6125

I think you are trying to click on the button before saving the record.

You need to first save the record and then you will be able to click on a button otherwise, the button will be inactive.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 21
4532
3
thg 3 15
9564
2
thg 2 23
3071
2
thg 10 20
5753
2
thg 10 20
4041