Skip to Content
Menu
This question has been flagged

hello.

I have created a new module called 'stock_custom' that depends on 'stock', in which I create a group 'group_stock_X' that inherits from 'group_stock_user', that is,

<record id="stock.group_stock_user" model="res.groups">
    <field name="implied_ids" eval="[(4, ref('stock_custom.group_stock_X'))]"/>
</record>
I need the users of this group to be able to see the button 'On Hand' of the view 'stock.product_form_view_procurement_button' and 'stock.product_form_view_procurement_button' , I did the following and it did not resolve:

First attempt:

<record model="ir.ui.view" id="product_template_form_view_procurement_button">
    <field name="name">inherit.product.template.view.form</field>
    <field name="model">product.template</field>
    <field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
    <field name="groups_id" eval="[(4, ref('stock_custom.group_stock_X'))]"/>
    <field name="arch" type="xml">
        <xpath expr="//button[@name='action_open_quants']" position="attributes">
            <attribute name="groups">{stock_custom.group_stock_X}</attribute>
        </xpath>
    </field>
</record>
<record model="ir.ui.view" id="product_form_view_procurement_button">
    <field name="name">inherit.product.product.view.form</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
    <field name="groups_id" eval="[(4, ref('stock_custom.group_stock_X'))]"/>
    <field name="arch" type="xml">
        <xpath expr="//button[@name='%(stock.product_open_quants)d']" position="attributes">
            <attribute name="groups">{stock_custom.group_stock_X}</attribute>
        </xpath>
    </field>
</record>

Second attempt:

<record model="ir.ui.view" id="product_template_form_view_procurement_button">
    <field name="name">inherit.product.template.view.form</field>
    <field name="model">product.template</field>
    <field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
    <field name="groups_id" eval="[(4, ref('stock_custom.group_stock_X'))]"/>
    <field name="arch" type="xml">
        <xpath expr="//button[@name='action_open_quants']" position="replace">
            <button type="object"                
                name="stock.action_open_quants"
                attrs="{'invisible':[('type', '!=', 'product')]}"
                class="oe_stat_button" icon="fa-building-o">
                    <field name="qty_available" widget="statinfo" string="On Hand"/>
            </button>
        </xpath>
    </field>
</record>
<record model="ir.ui.view" id="product_form_view_procurement_button">
    <field name="name">inherit.product.product.view.form</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
    <field name="groups_id" eval="[(4, ref('stock_custom.group_stock_X'))]"/>
    <field name="arch" type="xml">
        <xpath expr="//button[@name='%(stock.product_open_quants)d']" position="replace">
            <button class="oe_stat_button"
                name="%(stock.product_open_quants)d"
                icon="fa-building-o"
                type="action" 
                attrs="{'invisible':[('type', '!=', 'product')]}">
                    <field name="qty_available" widget="statinfo" string="On Hand"/>
            </button>                    
        </xpath>
    </field>
</record>

I tried these but it didn't work out.
Please help me and thanks in advance
Avatar
Discard
Related Posts Replies Views Activity
2
Aug 24
3632
9
Jun 23
11130
2
Jan 22
2733
2
Dec 21
6268
0
Jun 21
1007