I'm trying to use a custom module to customize various aspects of the interface, and can't seem to get the reference to a particular button correct. With the "stock" addon installed, the product "Inventory" tab has a section for "Stock and Expected Variations." I can see in the source code that this is added in the file "addons/stock/product_view.xml".
In this view, next to the "Quantity on Hand" (name="qty_available") field, there is a text button called "update" that lets users manually set the quantity available of that product. For our business, we don't want to allow that, so I thought a simple solution would be to hide the "update" button. In the source code, the button has attribute name="%(action_view_change_product_quantity)d", but in my custom module, I can't seem to refer to it with that name.
In my code, when I try to do:
<button name="%(action_view_change_product_quantity)d" position="replace" />
I get an error:
ValueError: No such external ID currently defined in the system: ui_customizations.action_view_change_product_quantity
My module is called ui_customizations, and in my __openerp__.py file I have:
"depends" : ['base', "product", "account", "stock"],
So it should be able to inherit correctly from the stock module. However no matter what I do, I can't seem to hide that update button. Here's my full code from the record level:
<record id="my_procurement_locations_form" model="ir.ui.view">
<field name="name">my.product.normal.procurement.locations.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<button name="%(action_view_change_product_quantity)d" position="replace" />
</field>
</record>
Anybody have any idea what I'm doing wrong?
-------------------------------------
Comments seem to be not working at the moment, so here's my addition. Thanks to Mertechdata for getting me going in the right direction. There are two things I was still missing after his comment. First, my inherid_id was wrong, and it needed to be:
<field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
Second, when referencing another module's ID names, you need to prepend the ID with the module name (otherwise it only looks in the current module:
<xpath expr="//button[@name='%(stock.action_view_change_product_quantity)d']" ...