Yep, fields_view_get() + context key set in the menu solved that.
Here's the solution.
Context: (note the bold part)
<record id="action_picking_int_form" model="ir.actions.act_window">
<field name="name">Move Items</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_picking_form"/>
<field name="target">current</field>
<field name="context">{'picking_type': 'int'}</field>
</record>
And view_get():
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(stock_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
if view_type == 'form':
doc = etree.XML(res['arch'])
note = doc.xpath("//field[@name='note']")
picking_type = context.get('picking_type')
if picking_type == 'in':
note[0].attrib['placeholder'] = 'Model | Serial Number | Model | Serial Number | ...'
elif picking_type == 'int':
note[0].attrib['placeholder'] = 'Location Barcode | Quant ID | Quant ID | Quant ID | ...'
res['arch'] = etree.tostring(doc)
return res
UPDATE:
Why does this solution show the same placeholder for both menus - for Receive New Products and for Move Products?
Both menus show Location | Barcode as a placeholder (taken from the last view definition). If smb asks, <data> tag doesn't have a noupdate flag.
<record id="view_picking_form" model="ir.ui.view">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<field name="note" position="replace">
<group col="4">
<field name="note" class="oe_inline" colspan="2" nolabel="1" placeholder="Add an internal note..."/>
<field name="info" style="color: blue;" colspan="2" nolabel="1"/>
</group>
</field>
</field>
</record>
<record id="view_picking_in_form" model="ir.ui.view">
<field name="name">stock.picking.in.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="arch" type="xml">
<field name="note" position="attributes">
<attribute name="placeholder">Model | Serial_Number</attribute>
</field>
</field>
</record>
<record id="view_picking_int_form" model="ir.ui.view">
<field name="name">stock.picking.int.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="arch" type="xml">
<field name="note" position="attributes">
<attribute name="placeholder">Location | Barcode</attribute>
</field>
</field>
</record>
<record id="action_picking_form" model="ir.actions.act_window">
<field name="name">Receive New Products</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_picking_in_form"/>
<field name="target">current</field>
<field name="context">{'picking_type': 'in'}</field>
</record>
<menuitem action="action_picking_form" id="menu_action_picking_form" parent="stock.menu_stock_warehouse_mgmt" sequence="3"/>
<record id="action_picking_int_form" model="ir.actions.act_window">
<field name="name">Move Products</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_picking_int_form"/>
<field name="target">current</field>
<field name="context">{'picking_type': 'int'}</field>
</record>
<menuitem action="action_picking_int_form" id="menu_action_picking_int_form" parent="stock.menu_stock_warehouse_mgmt" sequence="10"/>
Receive New Items: https://www.dropbox.com/s/uco8b99arlz2qf8/Receive_New_Items.png?dl=0
Move Items: https://www.dropbox.com/s/x706dftvmfieh0n/Move_Items.png?dl=0
If I set priorities for both views (and strictly for both views, just for one is not enough!) like this:
<record id="view_picking_in_form" model="ir.ui.view">
<field name="name">stock.picking.in.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="priority" eval="21"/>
<field name="arch" type="xml">
<field name="note" position="attributes">
<attribute name="placeholder">Model | Serial_Number</attribute>
</field>
</field>
</record>
<record id="view_picking_int_form" model="ir.ui.view">
<field name="name">stock.picking.int.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<field name="note" position="attributes">
<attribute name="placeholder">Location | Barcode</attribute>
</field>
</field>
</record>
... then Model | Serial_Number placeholder is shown in both menus.
Hence, it is either a bug in Odoo's view inheritance mechanism, or inheritance simply doesn't allow such tuning of placeholders and hence the only solution known to me so far is overriding the fields_view_get().